GeezerVison is showing github.com — aggregator: reader flip — orchestration section from orch_runs.document (#10504) by dezren39 · Pull Request #10509 · developing-today/code
Conversation
dezren39
commented
Nov 15, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Implements #10504, the reader flip sequenced behind the verified writer cutover (task 14838, PR #10381): the fleet-feed collector's orchestration section is now read from the latest public.orch_runs.document; orchestration.json stays generated every pass as the export only.
What
- New
src/orchestration-db.ts — the flip's decision logic with injected readers, so it is unit-testable without a database:
LATEST_ORCH_RUN_SQL: newest run's complete document (ORDER BY generated_at DESC, run_id DESC LIMIT 1).
orchestrationDocumentFromRows: anything but one well-shaped row is a read failure — a partial document is never served.
resolveOrchestrationDocument: DB first, validated by the shared orchestrationSectionProblem gate. Any DB failure (transport, missing token/ref, no rows, invalid document) falls back to the file document and carries the reason in dbError so it is surfaced, never hidden.
orchestrationSourceFromEnv: ORCHESTRATION_SOURCE=file is the rollback rehearsal made real — the DB is not consulted, and nothing is lost because the writer's step 3 never stopped writing the file.
- Collector (
scripts/collect-fleet-feed.ts): the impl(orchestrator): recurring orchestration job — queue triage, priority ladder, blocker awareness, goal measurement #899 section block resolves through the module, reading via the same Management API SQL route + Bitwarden management token as the AA section. A DB failure that serves the file document marks the section error, which the aggregator already renders as error — collector error: …; serving embedded section … — dashboard shape unchanged, failure named (the pm stack → Supabase phase 1 (#3142): reader flip — aggregator/dashboard reads latest orch_runs.document, orchestration.json becomes export-only #10504 fallback contract). Missing file with no DB failure keeps the pre-impl(orchestrator): recurring orchestration job — queue triage, priority ladder, blocker awareness, goal measurement #899 skipped state.
pm-stack/shared-schema/ORCHESTRATION.md: the flip and its rollback are recorded beside the writer contract; the live source's impl(orchestrator): recurring orchestration job — queue triage, priority ladder, blocker awareness, goal measurement #899 comment updated.
Verification
bun test test/orchestration-db.test.ts — 10/10: row parsing, env source selection, DB success without touching the file, DB failure → last-good file + surfaced reason, invalid DB document never served, rollback never consults the DB, missing-file states. Related suites (supabase-export, orchestration, feed, collector publication/args): only the 3 registry failures that reproduce identically on pristine main.
tsc --noEmit — clean.
- Live: the latest
orch_runs.document is byte-identical to orchestration.json (run orch-2026-11-15T111533Z, checked via the writer's own Management API route from the sandbox), so the impl(aggregator): slice 2 — mobile, needs-Drew/needs-orchestrator tiers, time-granular roadmap, session clarity #898 dashboard shape is preserved by construction. A/B collector runs (pristine main vs this branch) against the live document produce identical outcomes, and the flipped collector with a valid file embeds the section while surfacing the DB failure in the section meta, exactly as designed. A sandbox probe through the collector's exact bws + Management API route reads the DB row live.
- One full scheduled cycle: the writer's dual cycle was verified at filing (task 14838) and DB↔file equality still holds at this pass; the first post-merge collector cycle serves the same section from the DB once aggregator: orchestration section omitted — publisher emits dependency status 'blocked', validator rejects it #10508 (below) clears the current invalid document.
Filed separately: #10508
The current published document — both copies, byte-identical — fails the shared structural check: the publisher emits dependency status "blocked", which DEPENDENCY_STATUSES in feed.ts does not include, so the section is omitted today under the old reader too (reproduced with the pristine-main collector). That publisher/validator vocabulary drift is its own fix (validator list + contract corpus, or publisher mapping); this PR preserves the behavior exactly and does not mask it.
Queue task 17362 (lane code-d). Closes #10504.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by CodeRabbit
- New Features
- The fleet feed now uses the latest orchestration run’s data by default.
- If that data is unavailable or invalid, the feed can fall back to the orchestration file. You can also configure the feed to use the file directly.
- When fallback data is used after a database read failure, the orchestration section is still marked as being in error.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…nt (#10504)
Phase 1 of #3142, sequenced behind the verified writer cutover
(task 14838): the fleet-feed collector now reads the orchestration
section from the latest public.orch_runs.document on Supabase
muse-dev2, through the same Management API SQL route and Bitwarden
management token as the AA section. orchestration.json — still
regenerated by the writer every pass — becomes export-only: the
fallback and the rollback path.
- New src/orchestration-db.ts: the flip's decision logic with
injected readers. LATEST_ORCH_RUN_SQL (newest run's complete
document), orchestrationDocumentFromRows (a partial or malformed
row is a read failure, never served), resolveOrchestrationDocument
(DB first, validated by the shared orchestrationSectionProblem
gate; any DB failure — transport, no rows, invalid document —
falls back to the file and carries the reason so it is surfaced),
orchestrationSourceFromEnv (ORCHESTRATION_SOURCE=file is the
rollback: the DB is not consulted and nothing is lost, because
the writer never stopped writing the file).
- Collector: the #899 section block resolves through the new
module. A DB failure serving the file document marks the section
"error", which the aggregator already surfaces as "error —
collector error: …; serving embedded section …" — the dashboard
shape is unchanged and the failure is named, per the #10504
fallback contract. Missing file + no DB failure keeps the
pre-#899 "skipped" state.
- ORCHESTRATION.md records the flip + rollback beside the writer
contract; the live source's #899 comment updated.
Verification:
- bun test test/orchestration-db.test.ts: 10/10 (row parsing, env
source, DB success without touching the file, DB failure →
last-good file + surfaced reason, invalid DB document never
served, rollback never consults the DB, missing-file states).
Related suites: supabase-export + orchestration + feed +
collector publication/args — only the 3 registry failures that
reproduce identically on pristine main.
- tsc --noEmit clean.
- Live: orch_runs latest document is byte-identical to
orchestration.json (run orch-2026-11-15T111533Z, verified via the
writer's own Management API route), so the served shape is
preserved by construction. A/B collector runs (pristine main vs
this branch) on the live document produce identical outcomes;
the flipped collector with a valid file embeds the section and
surfaces the DB failure in the section meta, as designed.
- Known live-data blocker, filed as #10508: the current published
document (both copies) fails the shared structural check —
the publisher emits dependency status "blocked", which
DEPENDENCY_STATUSES does not include — so the section is
currently omitted under both the old and new reader. Once
#10508 lands, the next collector run serves the section from
the DB with no further change here.
Queue task 17362.
Codex Review Summary: ❌ Failed
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
❌ Failed 2026-11-15T13:22:11.524106Z We couldn’t complete this review. Comment @codex review to try again. |
03b3ae0 |
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 15, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Caution
Review failed
The pull request is closed.
Walkthrough
-
The fleet-feed collector now reads the latest orch_runs.document by default. It can fall back to orchestration.json after a database failure or read the file directly when ORCHESTRATION_SOURCE=file is set.
Changes: Orchestration reader
| Layer / File(s) |
Summary |
Resolve DB and file sources pm-stack/aggregator/src/orchestration-db.ts, pm-stack/aggregator/test/orchestration-db.test.ts |
Adds database row parsing, source selection, and resolution with file fallback. Tests cover valid and invalid rows, database failures, and file rollback behavior. |
Wire resolution into the fleet feed pm-stack/aggregator/scripts/collect-fleet-feed.ts, pm-stack/aggregator/src/sources/live.ts, pm-stack/shared-schema/ORCHESTRATION.md |
The collector resolves and normalizes orchestration documents, then sets section status based on the result. Source comments and the contract document the database reader, fallback, and file selection. |
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant FleetFeedCollector
participant resolveOrchestrationDocument
participant Supabase
participant OrchestrationFile
FleetFeedCollector->>resolveOrchestrationDocument: Resolve orchestration source
resolveOrchestrationDocument->>Supabase: Read latest orch_runs.document
alt Database document is valid
Supabase-->>resolveOrchestrationDocument: Return document
else Database read or validation fails
resolveOrchestrationDocument->>OrchestrationFile: Read orchestration.json
OrchestrationFile-->>resolveOrchestrationDocument: Return fallback document or file error
end
resolveOrchestrationDocument-->>FleetFeedCollector: Return document, source, and errors
Loading
Possibly related issues
- Issue 5005 — The reader flip moves orchestration reads to Supabase while retaining the file as fallback and rollback.
- Issue 3142 — This change implements the orchestration reader portion of the Supabase migration epic.
Merge Risk: Low · up to 03b3a
-
The new DB-first orchestration reader falls back to the file correctly. When both sources fail, however, the reported section error can omit one source's failure detail, which makes diagnosis harder. This is a small follow-up and does not block the change.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
🤖 Agent note · merge disposition (task 17362, lane code-d)
- Codex review: the connector's run failed to complete (Codex usage limits, per its own comment at 2026-11-15T13:22Z) — no findings were produced (zero review comments). Nothing to disposition; the failure is a reviewer quota limit, not a code finding.
- CodeRabbit: no inline findings posted as of merge.
- Verification stands on the PR body's evidence: orchestration-db tests 10/10, related suites clean apart from 3 registry failures reproducing identically on pristine main, tsc clean, live DB↔file document equality, A/B collector equivalence, and the sandbox live probe of the DB read route.
- Merging under the standing merge authority (verified done; CI runs on main).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 15, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|