Skip to content

Conversation

@035966-L3
Copy link
Contributor

@035966-L3 035966-L3 commented Nov 14, 2025

Summary by CodeRabbit

  • Chores
    • Improved error reporting across discussions, problem solutions, and contests by including domain context in missing-item errors for clearer diagnostics and troubleshooting.

@coderabbitai
Copy link

coderabbitai bot commented Nov 14, 2025

Walkthrough

This PR standardizes not-found error construction to pass domainId as the first parameter. Changes appear in three files: packages/hydrooj/src/handler/discussion.ts, packages/hydrooj/src/handler/problem.ts, and packages/hydrooj/src/model/contest.ts. In each location, when a resource (discussion history, solution/reply, or contest) is missing the thrown NotFound error is now instantiated with domainId followed by the resource identifier instead of only the identifier. No other control-flow or behavioral changes are present.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Homogeneous, repetitive edits (reordering error constructor arguments).
  • No logic or control-flow changes.
  • Quick checks:
    • Confirm each error constructor signature expects (domainId, id) in that order.
    • Verify domainId is in scope at each call site.
    • Run/spot-check tests or typings for affected modules.

Possibly related PRs

Suggested reviewers

  • undefined-moe

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding missing domainId parameters to error constructors across multiple files for improved error tracing.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1966b84 and 5e4119e.

📒 Files selected for processing (1)
  • packages/hydrooj/src/handler/problem.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/hydrooj/src/handler/problem.ts (1)
packages/hydrooj/src/error.ts (1)
  • SolutionNotFoundError (78-78)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
packages/hydrooj/src/handler/problem.ts (1)

915-915: LGTM! Error construction now includes domainId for proper tracing.

The change correctly adds domainId as the first parameter to SolutionNotFoundError, making it consistent with other error throws in this file (lines 845, 903) and aligning with the PR's objective to standardize error tracing.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@035966-L3 035966-L3 marked this pull request as draft November 14, 2025 09:16
@035966-L3 035966-L3 changed the title Add 7 missing 'domainId' for error tracing Add 6 missing 'domainId' for error tracing Nov 14, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f7bff9 and 1966b84.

📒 Files selected for processing (3)
  • packages/hydrooj/src/handler/discussion.ts (1 hunks)
  • packages/hydrooj/src/handler/problem.ts (2 hunks)
  • packages/hydrooj/src/model/contest.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
packages/hydrooj/src/model/contest.ts (1)
packages/hydrooj/src/error.ts (1)
  • ContestNotFoundError (80-80)
packages/hydrooj/src/handler/problem.ts (1)
packages/hydrooj/src/error.ts (2)
  • ProblemNotFoundError (77-77)
  • SolutionNotFoundError (78-78)
packages/hydrooj/src/handler/discussion.ts (1)
packages/hydrooj/src/error.ts (1)
  • DiscussionNotFoundError (81-81)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (4)
packages/hydrooj/src/model/contest.ts (1)

846-850: LGTM!

The error constructor now correctly receives domainId as the first parameter, providing proper domain context for error tracing.

packages/hydrooj/src/handler/discussion.ts (1)

354-368: LGTM!

All four DiscussionNotFoundError constructor calls now consistently include domainId as the first parameter, providing proper domain context for error tracing across different discussion entity types (history, tail reply, reply, discussion).

packages/hydrooj/src/handler/problem.ts (2)

216-228: LGTM!

The error constructor correctly receives domainId and pid from the reference object, which remains accessible since pdoc is reassigned only after the check.


913-921: LGTM!

The error constructor correctly receives domainId as the first parameter, with both variables accessible in scope.

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