Skip to content

fix: always release canvas leadership when a demotion handler throws - #8

Merged
beastyrabbit merged 1 commit into
mainfrom
t3code/sonarqube-fix-run
Sep 29, 2026
Merged

beastyrabbit merged 1 commit into
mainfrom
t3code/sonarqube-fix-run

Conversation

@beastyrabbit

Copy link
Copy Markdown
Owner

Note

🤖 Claude Opus 5.5 responding on behalf of beastyrabbit

SonarQube's main analysis flagged a critical issue in the canvas backend's leadership handoff. If a demotion handler threw synchronously, the error skipped the cleanup that releases the PostgreSQL advisory lock and the retained connection. Another replica could then not take over the canvas until that connection died. Handler failures are now always collected and reported together, and the lock is always released.

Two smaller findings are fixed as well. The frontend image's entrypoint is now root-owned, so the runtime node user can no longer modify it. Convex codegen output (convex/_generated/**) is excluded from SonarQube analysis because it isn't hand-written source.

Verification

  • New lifecycle assertion: a synchronously throwing handler makes stop() reject with an AggregateError and leaves no advisory lock held. It fails against the previous leader.ts.
  • Lint, format, typechecks, frontend tests, backend tests against an isolated PostgreSQL (40/40), both builds, the runtime-config test, and Playwright (7/7) all pass.
  • Built the frontend image and ran it: the entrypoint is root:root 755, not writable by node, and the app answers with HTTP 200.
  • Independent pre-PR review (OpenAI GPT-6 Sol, high): no findings.

The disposalFinished check in lifecycle.test.ts fails intermittently on unmodified main as well. That timing flake is not addressed here.

The remaining SonarQube findings were triaged separately. The hard-coded moddrop:moddrop URLs are the loopback-only dev database default; production reads DATABASE_URL from the cluster secret. The http:// bases only parse URLs. The vm call executes the repo's own build output in a verification script. None of these warrant code changes. The cognitive-complexity findings are left for a dedicated refactor.

Somewhere a GPU is overheating so I don't have to think.

- leader: wrap demotion handlers in async so a synchronous throw becomes a
  rejection; previously it escaped Promise.allSettled and skipped the
  advisory unlock and client release (typescript:S4123)
- Dockerfile: keep the entrypoint root-owned so the runtime node user
  cannot modify it (docker:S6504)
- sonar: exclude Convex codegen output convex/_generated/** from analysis
  (javascript:S7724 on generated files)

Powered by human calories and mass GPU cycles.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T11:12:30.673860Z 99eb84b PR opened
🔒 Security Review ✅ Completed 2026-09-29T11:15:29.381699Z 99eb84b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sonarqube-skyway-gmbh

Copy link
Copy Markdown

@beastyrabbit
beastyrabbit merged commit 76b6f59 into main Sep 29, 2026
3 checks passed
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