Skip to content

Review tail: lifecycle correctness, pluggability, pgx, SSRF redirect#3

Merged
datariot merged 2 commits into
mainfrom
fix/review-tail-round3
Jul 7, 2026
Merged

Review tail: lifecycle correctness, pluggability, pgx, SSRF redirect#3
datariot merged 2 commits into
mainfrom
fix/review-tail-round3

Conversation

@datariot

@datariot datariot commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Non-security tail from the framework review, plus the SSRF redirect residual noted in PR #2.

Correctness

  • Start held the app mutex across all of startup — bundle dials (10s timeouts), server starts, component Start. A component calling IsRunning() from its own Start would deadlock; any observer blocked for the whole startup. The lock now guards only the state-flag transitions (starting/running); startup I/O runs unlocked. Start-vs-Stop is now well-defined: Stop wins, a second concurrent Start is rejected.
  • Readiness-delay goroutine raced Stop — a bare time.Sleep then SetReady(true) with no cancellation could flip the service back to ready after Stop set it not-ready. Now cancellable via a stop channel that Stop closes.

Pluggability

  • Added WithLogging, WithObservability, WithHealthRegistry options — the framework had dead nil-check default branches but no way to inject these, contradicting the 'pluggable' claim. Added the missing Observability() accessor.

Modernization

  • lib/pq → jackc/pgx/v5/stdlib — lib/pq is maintenance-only; pgx is a drop-in database/sql driver. Pool settings unchanged; lib/pq fully removed from the module graph.

Security follow-up

Verified: full -race suite, golangci-lint (0 issues), all 7 examples build.

🤖 Generated with Claude Code

datariot and others added 2 commits July 6, 2026 19:21
…t guard

framework:
- Start no longer holds a.mu across bundle/server/component startup; the lock now guards only state-flag transitions (starting/running), so a component calling IsRunning() from its own Start no longer deadlocks and observers don't block for the whole startup. Start-vs-Stop race is well-defined (Stop wins; second Start rejected).
- readiness-delay goroutine is now cancellable via readinessStop; Stop closes it so a shutdown during ReadinessInitialDelay can no longer flip the service back to ready.
- WithLogging/WithObservability/WithHealthRegistry options make the infrastructure managers injectable (the nil-check defaults were dead code); added Observability() accessor.

postgresql: migrate lib/pq (maintenance mode) -> jackc/pgx/v5/stdlib; drop-in database/sql driver, pool settings unchanged.

httpclient: AllowedHosts SSRF guard now also rejects redirects to disallowed hosts, not just the initial URL.

Co-Authored-By: Claude Fable 5 <[email protected]>
@datariot datariot merged commit 44f947e into main Jul 7, 2026
5 of 6 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