Skip to content

Address CodeRabbit test-quality findings#468

Merged
nitrobass24 merged 2 commits into
developfrom
fix/coderabbit-findings
May 5, 2026
Merged

Address CodeRabbit test-quality findings#468
nitrobass24 merged 2 commits into
developfrom
fix/coderabbit-findings

Conversation

@nitrobass24
Copy link
Copy Markdown
Owner

Test-only hardening from the CodeRabbit review on PR #467 (develop → master). Once this lands on develop, PR #467 picks up all of these automatically.

Acted on (8)

# File Change
2 option.component.spec.ts Suite-level afterEach(useRealTimers) so failing assertions can't leak fake timers across tests
3 path-pairs.service.spec.ts Renamed test from "preserve existing list when refresh fails" → "clear pairs when refresh fails (catchError emits empty array)" — the body always asserted []
4 version-check.service.spec.ts Import packageJson and use 'v'+packageJson.version instead of hardcoded 'v0.17.0'
7 integrations.spec.ts Fail fast on API errors in beforeEach/afterEach (GET + each DELETE)
8 settings.spec.ts Drop 3 redundant field.clear() calls — fill() already clears, separate clear() races with Angular signal re-render
10 test_context.py Remove leaked StreamHandler in _make_context (assertLogs installs its own capture handler)
11 test_active_scanner.py self.addCleanup(scanner.close) right after each construction so multiprocessing resources always close on assertion failure
12 test_web_app_job.py Same StreamHandler removal as #10

Skipped (with reasons)

# File Reason
1 option.component.ts (export DEBOUNCE_TIME_MS) Touches production code for a one-constant DRY win. Low value — the duplicated literal 1000 in the spec hasn't drifted in years.
5 docker-image/Dockerfile (pin python:3.13-alpinepython:3.13-alpine3.23) Reproducibility win, but blindly pinning a tag I haven't verified exists on Docker Hub risks breaking the build in a release sync PR. Worth doing carefully in its own PR.
6 test-image/Dockerfile (pin uv:0.11) Same reasoning as #5.
9 test_status.py (resp.json instead of json.loads(str(resp.html))) Cosmetic refactor, no behavior change. Both are correct. Skipping to keep the diff minimal.
13 auto_queue.py (try/except around to_file) Production change introducing new HTTP 5xx error path. Deserves its own PR with tests for the failure mode.
14 config.py (copy-then-write atomicity) Production change, larger refactor. Also deserves its own PR with tests.
15 integrations.py (persistence ordering) Production change with crash-safety implications. Deserves its own PR with discussion of the failure scenarios.
16 path_pairs.py (try/except around to_file) Same as #13 — production change, deserves its own PR.
17 package.json version bump Release decision. Already flagged in PR #467 description as a checklist item. Needs the user's call on 0.17.1 (patch) vs 0.18.0 (minor — defensible given hot-reload and image-size work in this batch).

Validation

  • All 8 changed files parse / type-check (Python via py_compile; TS diagnostics show only pre-existing issues at unrelated lines)
  • CI on this PR will run the full Vitest + pytest + Playwright suites
  • The Playwright integrations.spec.ts change is the riskiest — fail-fast may surface latent issues, which is the point. If it does, that's a real bug we want to know about.

🤖 Generated with Claude Code

All test-side hardening only — no production code changes. The bigger
production findings (auto_queue/path_pairs/config/integrations error
handling and ordering) are deferred for individual PRs with proper test
coverage rather than bundled here.

- option.component.spec.ts: add suite-level afterEach(useRealTimers) so
  a failing assertion inside vi.useFakeTimers() can't leak fake timers
  into the next test. Removed the per-test useRealTimers() calls that
  the new afterEach makes redundant.

- path-pairs.service.spec.ts: rename "preserve existing list when refresh
  fails" to "clear pairs when refresh fails (catchError emits empty
  array)" — the test body always asserted [] so the old name was
  contradictory.

- version-check.service.spec.ts: import packageJson and use
  'v'+packageJson.version in the same-version test instead of
  hardcoding 'v0.17.0'. Future version bumps no longer break this test.

- integrations.spec.ts: fail fast on API errors in beforeEach and
  afterEach (GET + each DELETE). Stops the test with a clear error
  instead of silently proceeding against unknown state.

- settings.spec.ts: drop redundant field.clear() calls (3 sites). fill()
  already clears before typing; calling clear() separately races with
  Angular's signal-driven re-render. Pattern matches the existing fix
  in "text field change saves to backend".

- test_context.py / test_web_app_job.py: stop attaching a StreamHandler
  in _make_context. assertLogs() in the tests installs its own capture
  handler, so the addHandler call only leaked across tests (loggers are
  singletons). Drops the now-unused import sys too.

- test_active_scanner.py: register self.addCleanup(scanner.close) right
  after each ActiveScanner construction so multiprocessing resources
  always get closed even if assertions raise. Trailing scanner.close()
  calls left in place — Queue.close() is idempotent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Warning

Rate limit exceeded

@nitrobass24 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 50 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6a3053c8-2bbf-497d-a6b1-38f314e8b7a8

📥 Commits

Reviewing files that changed from the base of the PR and between 660f99b and 66c40dc.

📒 Files selected for processing (10)
  • CHANGELOG.md
  • src/angular/package.json
  • src/angular/src/app/pages/settings/option.component.spec.ts
  • src/angular/src/app/services/settings/path-pairs.service.spec.ts
  • src/angular/src/app/services/utils/version-check.service.spec.ts
  • src/e2e-playwright/tests/integrations.spec.ts
  • src/e2e-playwright/tests/settings.spec.ts
  • src/python/tests/unittests/test_common/test_context.py
  • src/python/tests/unittests/test_controller/test_scan/test_active_scanner.py
  • src/python/tests/unittests/test_web/test_web_app_job.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/coderabbit-findings

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.

Minor bump for the develop → master sync. New user-facing functionality
(LFTP hot-reload + differentiated restart notifications) and a
non-trivial operational improvement (image size from 114 MB to 64 MB)
warrant the minor over a patch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@nitrobass24 nitrobass24 merged commit ecfa8f5 into develop May 5, 2026
18 checks passed
@nitrobass24 nitrobass24 deleted the fix/coderabbit-findings branch May 5, 2026 04:14
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