docs: architecture review — deepening ADRs 0011–0015#7
Merged
Conversation
Records five architectural deepening opportunities as proposed ADRs, plus a consolidating review doc. The recurring theme: domain concepts named in CONTEXT.md (Run Queue, Claim, Content Hash, per-User cap) own no module — their definitions are copied as raw SQL/hash recipes across Go, Python, and KEDA YAML, bound only by CONTRACT prose. - 0011 (Strong): the Claim eligibility predicate is triplicated across db.py, the operator's KEDA query, and scaledobject.yaml — an unguarded violation of ADR-0005's own stated consequence. Give it one home. - 0012 (Strong): Content Hash is derived twice (Go queue.go, Python loop.py) with no shared vector; pin the two adapters with a checked-in test vector. - 0013: the lease lifecycle's running-phase transitions and runner_id fence are split across the Runner (Python) and Reaper (Go); own them in guarded SQL. - 0014: API-key hash duplicated TS↔Go untested; domain allow-list tripled in the portal. One source + a create→validate contract test. - 0015: Engine Version (~8 sites) and cap (~7) scattered across manifests; derive them from the RunnerPool CR (largely subsumed by 0011). Docs only; no code changes. Every file:line was verified first-hand. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019p51SPdbrjmGXJVeZnwTrD
Re-ran the multi-agent validation with each agent confined to its own git worktree off master (strictly read-only, with a git ls-files contamination guard). Isolation held — all five worktrees ended with zero writes and the contamination check passed for every candidate — and the independent pass corrected several first-pass claims: - 0011: the naive `app.eligible_simulations(...) FOR UPDATE SKIP LOCKED` wrap silently DROPS the row lock on Postgres 16 (verified via EXPLAIN + a two-session concurrency test). Corrected design: the function owns the predicate+ordering only; the claim keeps `FOR UPDATE OF <base table> SKIP LOCKED` as a membership gate. Also softened the cap-50 framing — the cap is largely single-sourced via pool.Spec.DefaultUserConcurrency; the predicate is the real duplication. - 0013: the reaper does NOT fence on runner_id (it is expiry-only); the fence is two Python sites (db.py:57,221), not three. - 0014: the two auth.ts enforcement sites share one isAllowedEmail helper; the duplication is the domain *list* defined 3×, not logic re-implemented. - 0015: refuted the "live KEDA query doesn't derive from the CR" premise — it does (controller.go:161,165-169); residuals are the in-CR image tag and the Compose path. Dropped the false "subsumed by 0011" dependency. - Review doc: replaced the contamination caveat with the full two-pass method note. Docs only; no code changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019p51SPdbrjmGXJVeZnwTrD
Contributor
Author
Re-validated under worktree isolation ✅Re-ran the five-candidate adversarial QA loop with each agent confined to its own git worktree off Isolation held cleanly — all five worktrees ended with zero writes, the real tree was never touched, and the contamination check passed for every candidate. The independent pass also corrected several first-pass claims (now folded into the ADRs):
The first pass had self-contaminated (an agent wrote a proposed migration the loop then "verified"); the worktree isolation in this pass is what prevented a recurrence. Method note is in |
This was referenced Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Architecture review — deepening opportunities
Records five architectural deepening opportunities as proposed ADRs
(
0011–0015) plus a consolidating review doc (docs/architecture-review-2026-06.md).Docs only — no code changes.
The recurring shape
SynergyPlus has an excellent domain glossary, but several concepts it names
(Run Queue, Claim, Content Hash, per-User cap) own no module.
Their definitions are copied as raw SQL strings and hash recipes across three
runtimes (Go, Python, KEDA YAML), bound together only by
CONTRACT.mdprose. EachADR proposes the same move: give the concept one home, consumed through a narrow seam.
Candidates
db.py:43-45,runnerpool_controller.go:167,scaledobject.yaml:31) — violates ADR-0005's own stated consequencequeue.go:27Go /loop.py:26Python), no shared vectorrunner_idfence split across Runner (Python) and Reaper (Go)Top recommendation: ADR-0011. Highest blast radius (a claim/scaler drift is a
production autoscaling bug), and it's the keystone — fixing it dissolves the cap
literal (0015) and anchors the lease transitions (0013).
Provenance
Findings came from a multi-agent validation pass and were then re-verified
first-hand — every
file:lineconfirmed by direct reading. The review doc alsorecords, for honesty, that the automated QA loop self-contaminated (an agent with
write access materialized a proposed migration the loop then "verified"); that
artifact was removed and no conclusion here depends on it. The ADRs rest only
on duplication that exists in the committed source.
Status
All five ADRs are marked proposed — recommendations for the team to ratify or
reject, not yet-accepted decisions.
🤖 Generated with Claude Code
https://claude.ai/code/session_019p51SPdbrjmGXJVeZnwTrD