Skip to content

📝 Add docstrings to remediation/hyperplan-audit-fixes - #43

Merged
BillyOutlast merged 1 commit into
remediation/hyperplan-audit-fixesfrom
coderabbitai/docstrings/27b0f0b
Jul 26, 2026
Merged

BillyOutlast merged 1 commit into
remediation/hyperplan-audit-fixesfrom
coderabbitai/docstrings/27b0f0b

Conversation

@coderabbitai

@coderabbitai coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Docstrings generation was requested by @BillyOutlast.

The following files were modified:

  • server/server/internal/tasks/index.ts
  • server/server/internal/tasks/registry/objects.ts
  • torrential/src/downloads/download.rs
  • torrential/src/server/mod.rs
These file types are not supported
  • .github/dependabot.yml
  • .github/workflows/codeql.yml
  • .gitignore
  • .husky/pre-commit
  • .omo/plans/remediation-plan.md
  • .omo/review/agent-hooks-audit.md
  • .omo/review/ci-cd-audit.md
  • .omo/review/code-quality-audit.md
  • .omo/review/cross-attack-high-effort.md
  • .omo/review/documentation-audit.md
  • .omo/review/sonarqube-audit.md
  • .omo/review/test-coverage-audit.md
  • AGENTS.md
  • CLAUDE.md
  • desktop/main/package.json
  • fallow.toml
  • libraries/base/package.json
  • server/components/UserFooter.vue
  • server/package.json
  • server/pages/account/security.vue
  • server/pages/admin/settings.vue
  • server/pages/admin/settings/index.vue
  • server/pages/library/game/[id]/index.vue
  • server/pages/store/[id]/index.vue
  • server/prisma/models/auth.prisma
  • server/prisma/models/client.prisma
  • server/prisma/schema.prisma
ℹ️ Note

CodeRabbit cannot perform edits on its own pull requests yet.

Docstrings generation was requested by @BillyOutlast.

* #42 (comment)

The following files were modified:

* `server/server/internal/tasks/index.ts`
* `server/server/internal/tasks/registry/objects.ts`
* `torrential/src/downloads/download.rs`
* `torrential/src/server/mod.rs`
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Author

Important

Review skipped

This PR was authored by the user configured for CodeRabbit reviews. CodeRabbit does not review PRs authored by this user. It's recommended to use a dedicated user account to post CodeRabbit review feedback.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6e9677ee-deb1-45b6-a0a5-67171edc8abf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "auto_review"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@greptile-apps

greptile-apps Bot commented Jul 26, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds and improves documentation comments across four files in response to a docstring generation request: two TypeScript task files get new/refined JSDoc, and two Rust files in the torrential crate get /// doc comments.

  • tasks/index.ts: Clean JSDoc added to defineDropTask; no issues.
  • tasks/registry/objects.ts: Existing JSDoc improved overall, but the useful "Batched: one query per model" implementation note on findReferencedIds was dropped.
  • downloads/download.rs: Doc comment added to the private create_backend function, but every /// line is separated by a bare blank line (non-idiomatic for Rust), and the no_run doctest example calls the private function directly.
  • server/mod.rs: Detailed new /// doc was added to wait_for_message_id, but the original /** Uses the waitmap... */ block comment was not removed \u2014 rustdoc will render both, producing duplicate output.

Confidence Score: 3/5

The Rust changes in server/mod.rs leave a stale block comment alongside the new doc, so rustdoc renders both — the published documentation for wait_for_message_id will be incorrect until the old comment is removed.

The duplicate comment on wait_for_message_id directly undermines the goal of this PR: instead of replacing the old, incomplete description, the change accumulates it with the new one, producing misleading rendered docs. The download.rs formatting and private-fn doctest issues are less urgent but add noise that the project’s cargo fmt mandate would flag.

Files Needing Attention: torrential/src/server/mod.rs needs the old /** */ block comment removed; torrential/src/downloads/download.rs needs blank-line formatting corrected and the private-fn doctest reconsidered.

Important Files Changed

Filename Overview
torrential/src/server/mod.rs New /// doc comment added to wait_for_message_id, but the old /** */ block comment was not removed — both will be rendered by rustdoc, producing duplicate/contradictory documentation.
torrential/src/downloads/download.rs Doc comment added to private create_backend with non-idiomatic blank lines between every /// line, and a no_run doctest example that calls the private function — both style issues require cleanup.
server/server/internal/tasks/index.ts Clean JSDoc added to defineDropTask; accurate description, correct @param and @returns tags, no issues.
server/server/internal/tasks/registry/objects.ts Existing docstrings improved with better descriptions and proper @param/@returns wording; the "Batched" implementation note on findReferencedIds was inadvertently dropped.

Comments Outside Diff (1)

  1. server/server/internal/tasks/registry/objects.ts, line 84-96 (link)

    P2 Removal of "batched" implementation note loses useful context

    The previous findReferencedIds docstring included "Batched: one query per model instead of one per object per model", which is a meaningful design note — it tells future readers why the code iterates models rather than objects, and guards against someone "simplifying" it in a way that would cause N×M queries. The replacement description omits this. Consider re-adding the batching rationale to the @returns or as a separate note.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: server/server/internal/tasks/registry/objects.ts
    Line: 84-96
    
    Comment:
    **Removal of "batched" implementation note loses useful context**
    
    The previous `findReferencedIds` docstring included "Batched: one query per model instead of one per object per model", which is a meaningful design note — it tells future readers why the code iterates models rather than objects, and guards against someone "simplifying" it in a way that would cause N×M queries. The replacement description omits this. Consider re-adding the batching rationale to the `@returns` or as a separate note.
    
    How can I resolve this? If you propose a fix, please make it concise.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix All With AI
Fix the following 4 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 4
torrential/src/server/mod.rs:118-121
**Duplicate doc comment left on `wait_for_message_id`**

The old `/** Uses the waitmap to wait for a response from a query */` block comment (lines 118–120) was kept alongside the new `///` line doc. In Rust, both `/** */` and `///` comments desugar to `#[doc = "..."]` attributes, so rustdoc will render them concatenated — the function will show a short, now-incomplete legacy description immediately before the detailed new one, making the published documentation confusing and redundant. The old block comment should be removed.

### Issue 2 of 4
torrential/src/downloads/download.rs:52-94
**Non-idiomatic blank lines interspersed in doc comment**

Every `///` doc comment line is separated by a blank (non-`///`) line — e.g. `/// Creates...`, blank, `///`, blank, `/// Returns...`. Idiomatic Rust uses only `///` separator lines for blank lines within a doc block. The non-`///` blank lines will be silently ignored by `rustdoc`, so the paragraphs render correctly by accident, but `cargo fmt` will not normalise them, and the pattern is inconsistent with the rest of the codebase. Each empty separator should be a `///` line, not a bare blank line.

### Issue 3 of 4
torrential/src/downloads/download.rs:64-76
**Doctest example references a private function**

`create_backend` has no `pub` visibility, so the `no_run` doctest example calls a function that can never be imported in the doctest harness's generated module. While `no_run` prevents compilation errors today, the example is misleading to readers and would silently fail if the annotation were ever removed. Consider removing the `# Examples` section from a private function's doc, or replacing it with a prose description of the typical call site in `create_download_context`.

### Issue 4 of 4
server/server/internal/tasks/registry/objects.ts:84-96
**Removal of "batched" implementation note loses useful context**

The previous `findReferencedIds` docstring included "Batched: one query per model instead of one per object per model", which is a meaningful design note — it tells future readers why the code iterates models rather than objects, and guards against someone "simplifying" it in a way that would cause N×M queries. The replacement description omits this. Consider re-adding the batching rationale to the `@returns` or as a separate note.

Reviews (1): Last reviewed commit: "📝 Add docstrings to `remediation/hyperp..." | Re-trigger Greptile

Comment on lines 118 to +121
/**
Uses the waitmap to wait for a response from a query
*/
/// Waits for a response associated with a message ID and parses its payload.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Duplicate doc comment left on wait_for_message_id

The old /** Uses the waitmap to wait for a response from a query */ block comment (lines 118–120) was kept alongside the new /// line doc. In Rust, both /** */ and /// comments desugar to #[doc = "..."] attributes, so rustdoc will render them concatenated — the function will show a short, now-incomplete legacy description immediately before the detailed new one, making the published documentation confusing and redundant. The old block comment should be removed.

Prompt To Fix With AI
This is a comment left during a code review.
Path: torrential/src/server/mod.rs
Line: 118-121

Comment:
**Duplicate doc comment left on `wait_for_message_id`**

The old `/** Uses the waitmap to wait for a response from a query */` block comment (lines 118–120) was kept alongside the new `///` line doc. In Rust, both `/** */` and `///` comments desugar to `#[doc = "..."]` attributes, so rustdoc will render them concatenated — the function will show a short, now-incomplete legacy description immediately before the detailed new one, making the published documentation confusing and redundant. The old block comment should be removed.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +52 to +94
/// Creates a version backend using the filesystem location specified by the version data.

///

/// Returns an internal server error when the backend configuration is invalid, the version

/// path does not exist, or the backend cannot be constructed. Panics if the backend type is

/// absent from `version_data.source`.

///

/// # Examples

///

/// ```no_run

/// # let version_data: &VersionResponse = todo!();

/// let backend = create_backend(version_data)?;

/// # Ok::<(), StatusCode>(())

/// ```

///

/// # Errors

///

/// Returns `StatusCode::INTERNAL_SERVER_ERROR` when the backend configuration, version path,

/// or backend construction is invalid.

///

/// # Panics

///

/// Panics if `version_data.source.backend` is `None`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Non-idiomatic blank lines interspersed in doc comment

Every /// doc comment line is separated by a blank (non-///) line — e.g. /// Creates..., blank, ///, blank, /// Returns.... Idiomatic Rust uses only /// separator lines for blank lines within a doc block. The non-/// blank lines will be silently ignored by rustdoc, so the paragraphs render correctly by accident, but cargo fmt will not normalise them, and the pattern is inconsistent with the rest of the codebase. Each empty separator should be a /// line, not a bare blank line.

Prompt To Fix With AI
This is a comment left during a code review.
Path: torrential/src/downloads/download.rs
Line: 52-94

Comment:
**Non-idiomatic blank lines interspersed in doc comment**

Every `///` doc comment line is separated by a blank (non-`///`) line — e.g. `/// Creates...`, blank, `///`, blank, `/// Returns...`. Idiomatic Rust uses only `///` separator lines for blank lines within a doc block. The non-`///` blank lines will be silently ignored by `rustdoc`, so the paragraphs render correctly by accident, but `cargo fmt` will not normalise them, and the pattern is inconsistent with the rest of the codebase. Each empty separator should be a `///` line, not a bare blank line.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +64 to +76
/// # Examples

///

/// ```no_run

/// # let version_data: &VersionResponse = todo!();

/// let backend = create_backend(version_data)?;

/// # Ok::<(), StatusCode>(())

/// ```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Doctest example references a private function

create_backend has no pub visibility, so the no_run doctest example calls a function that can never be imported in the doctest harness's generated module. While no_run prevents compilation errors today, the example is misleading to readers and would silently fail if the annotation were ever removed. Consider removing the # Examples section from a private function's doc, or replacing it with a prose description of the typical call site in create_download_context.

Prompt To Fix With AI
This is a comment left during a code review.
Path: torrential/src/downloads/download.rs
Line: 64-76

Comment:
**Doctest example references a private function**

`create_backend` has no `pub` visibility, so the `no_run` doctest example calls a function that can never be imported in the doctest harness's generated module. While `no_run` prevents compilation errors today, the example is misleading to readers and would silently fail if the annotation were ever removed. Consider removing the `# Examples` section from a private function's doc, or replacing it with a prose description of the typical call site in `create_download_context`.

How can I resolve this? If you propose a fix, please make it concise.

@BillyOutlast
BillyOutlast merged commit 4d0ba58 into remediation/hyperplan-audit-fixes Jul 26, 2026
4 checks passed
BillyOutlast added a commit that referenced this pull request Jul 26, 2026
* remediation: Phase 1 config + Phase 2 quick fixes (hyperplan audit)

Phase 1 — Config hygiene:
- Pin vue/vue-router from 'latest' to concrete versions (server, desktop, base)
- Dependabot npm interval: weekly → daily
- Add fallow.txt/fallow.json to .gitignore
- Remove redundant server/.editorconfig (subset of root)
- Remove commented-out arktype generator in schema.prisma
- Remove 7 commented-out code blocks across server/
- Fix CLAUDE.md:35 (pre-commit falsehood: says pnpm test, actual is typecheck)
- Fix CLAUDE.md:79 (dead path reference to server/.husky/pre-commit)
- Create fallow.toml with Nuxt path excludes
- Switch CodeQL build-mode: none → autobuild for JS/TS + Rust

Phase 2 — Correctness quick fixes:
- Fix torrential download.rs:57 double unwrap chain (P0)
- Fix torrential server/mod.rs:134 inner unwrap defeating error return (P0)
- Fix Promise boolean at session/index.ts:195: add await (P1)
- Fix 3 pre-existing type errors (settings InputEvent, IGDBID, igdb ratingCoverUrl)

* remediation: Phase 2-3 remaining items (hyperplan audit)

P1-3: Add @@index([userId]) on Client + Session, @@index([expiresAt]) on Session
- Prevents full table scans on every user lookup and session cleanup

P1-4: Fix N+1 query in objects.ts findUnreferencedStrings
- Replaced per-object-per-model queries with batched findMany per model
- Reduces DB queries from O(objects × models) to O(models)

PROC-2: Narrow drop/no-prisma-delete ESLint rule to entity allowlist
- Allow hard-delete on join tables (companyGame, gameTag)
- Allow hard-delete on auth tokens (apiToken, session, certificate, invitation)
- Allow hard-delete on auth mechanisms (linkedAuthMec, linkedMFAMec)
- Entities requiring soft-delete (game, user, library, etc.) still blocked

PROC-4: Add pre-commit Rust fmt check
- Detects changed .rs files and runs cargo fmt --check
- Covers torrential, cli, and desktop/src-tauri workspaces

* remediation: P1-5 replace console.error with structured logger

- oidc/index.ts: replace console.warn + 3x console.error with logger.warn/error
- webauthn/finish.post.ts: add logger import, replace console.error
- desktop/composables/game.ts: remove debug console.log

OIDC logout failures now produce structured log entries with error context
instead of bare stderr output. Production errors become visible to monitoring.

* remediation: fix lint errors, add missing migration, fix pre-commit hook

- Fix 10 import/first ESLint errors in test files (vi.mock hoisting)
- Fix no-explicit-any: type systemACLs as SystemACL in confused-deputy test
- Add Prisma migration for @@index on Session(userId, expiresAt) and Client(userId)
- Filter pre-commit cargo fmt by workspace prefix to avoid cross-workspace checks

* Update torrential/src/server/mod.rs

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* 📝 Add docstrings to `remediation/hyperplan-audit-fixes` (#43)

Docstrings generation was requested by @BillyOutlast.

* #42 (comment)

The following files were modified:

* `server/server/internal/tasks/index.ts`
* `server/server/internal/tasks/registry/objects.ts`
* `torrential/src/downloads/download.rs`
* `torrential/src/server/mod.rs`

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: apply CodeRabbit auto-fixes

Fixed 7 file(s) based on 10 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

* fix: restore Rust fmt check in pre-commit, set CodeQL Rust build-mode to none

- Restore Rust formatting check stripped by CodeRabbit autofix
- Change CodeQL Rust build-mode from autobuild to none (avoids CI failures)
- Restore @ts-expect-error comments needed for Prisma dynamic access

* fix: format test file, fix torrential recieve_loop unwrap

- Format dependency-pinning.test.ts (prettier)
- Fix message.type_.unwrap() in recieve_loop to use ok_or_else (Greptile finding)
- Note: pre-commit cargo fmt skipped (proto files not generated locally)

* fix: correct SonarCloud org mapping, enable in-code resolution

- Update SonarCloud org from heretek-drop to billyoutlast
- Update project key from Heretek-Drop_drop to BillyOutlast_drop
- Enable sonar.issues.issueResolution.enabled for SONAR-RESOLVE
- Add missing exclusions to editorconfig CI

* test: add coverage for OIDC logout and session signout

- Add oidc-logout.test.ts covering handleLogout error paths
- Add signout tests to session-fixation.test.ts
- Covers 5 previously uncovered lines (codecov/patch)

* fix: address CodeRabbit review #4781108218

- Pin vue/vue-router to exact versions, allow standard ^ ranges for others
- Use hasSome instead of per-id has predicates in objects.ts

* fix: set CodeQL JS/TS build-mode to none

JS/TS doesn't need compilation for CodeQL analysis. autobuild is for compiled languages only.

* refactor: split extractReferencedIds into helpers, use Set for O(1) lookups

- Extract extractScalarReferences and extractArrayReferences
- Use Set<string> instead of Array.includes for validIds
- Reduces cognitive complexity from 22 to under 15

* fix: editorconfig violations

- Add final newlines to sonarcloud-issues.json, game.test.ts, vitest.config.ts
- Remove trailing whitespace in nginx.conf

* chore: remove sonarcloud-issues.json dump file

* style: run prettier and eslint --fix across codebase

- Format Vue components and TypeScript files
- Remove unused eslint-disable directives
- Fix session-fixation.test.ts formatting

* chore: trigger CI after disabling SonarCloud automatic analysis

* ci: update SonarCloud to recommended config v8.1.0

- Update action to v8.1.0
- Remove continue-on-error
- Remove args (using sonar-project.properties)

* ci: make pnpm audit non-blocking

npm registry endpoint is returning malformed URLs. Making audit step
non-blocking so CI can proceed.

* fix: add sonar.organization to sonar-project.properties

* ci: optimize SonarCloud configuration

- Add sonar.tests for proper test code separation
- Add sonar.qualitygate.wait=true to fail CI on quality gate failure
- Add sonar.qualitygate.timeout=600 for larger projects
- Optimize exclusions (add .nuxt, .output)
- Add SonarQube cache to CI workflow

* fix: remove sonar.tests to prevent double indexing

sonar.sources= overlaps with sonar.tests, causing test files to be
indexed twice. Use exclusions instead.

---------

Co-authored-by: John Smith <you@example.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant