Skip to content

feat(pm-stack): production rollup ingestion — queue bindings/pool exports + aggregator ingestion (#18127) - #18130

Merged
developing-today-fleet[bot] merged 11 commits into
mainfrom
archer/2052p-18127-rollup-ingestion
Dec 1, 2026
Merged

developing-today-fleet[bot] merged 11 commits into
mainfrom
archer/2052p-18127-rollup-ingestion

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #18127. Follow-on slice of #4825, filed by lane 2037-G from the design/decision record on #4825 (file-export route, producer-side exporters, aggregator-side ingestion). Lane 2052-P (bravo SUSTAIN 2026-11-30), claim comment 7299319124. Authored via the Git-API contents route (no checkout); every edited file's base was verified byte-identical to main at fd6bc06 before writing.

What lands

Queue-side bindings exporter — pm-stack/queue-bindings-export/ (new, in the shape of pm-stack/opencode-usage-export/):

  • queue-bindings-export.mjs: read-only pull over the queue's source dumps; emits the versioned bindings document (queue-bindings-export/v1, SpendLaneBinding[]) and pool document (queue-pool-export/v1, ProjectPoolItem[]), each with a coverage block (window start/end + whole-window ok assertion). ok is asserted only when the source dump asserted completeness; conflicting duplicate bindings/pool refs are a hard failure, never a silent pick; a missing/invalid source writes a failure document and exits non-zero — a failed tick never looks like a reading.
  • queue-bindings-export.test.mjs (node --test, offline fixtures), README, systemd service/timer, install-laptop.sh.

Aggregator ingestion module — pm-stack/aggregator/src/spend-ingestion.ts (new):

  • Opt-in flag PM_SPEND_INGESTION_ENABLED (only 1/true; default off — off, no export is read and no store write happens, mirroring the PM_COST_ANOMALY_ENABLED activation tests).
  • On the alert tick's cadence (startSpendRollupIngestion, wired in server.ts from server-wiring.ts's spendRollupIngestion), it reads the usage export + bindings export + pool export from configured paths (env overrides; defaults under ~/atlas/), runs projectSpendAttribution → rollup events (source event time, per-provider token pools) → buildSpendRollups → SpendRollupStore.append.
  • Rules: missing/stale/error export or a coverage block that does not assert ok ⇒ the tick appends nothing (attribution's sourceStatus contract — suppression, never fabrication). A window is labelled complete only when the intersection of the three ok coverage windows covers it whole. Re-ticks are skipped-identical no-ops under the store's immutability rules.
  • Tests test/spend-ingestion-18127.test.ts: gate, default-off (no reads), missing-export, failure-document, stale, not-ok coverage, happy path against the real store (week complete / month partial, folded child sessions, re-tick no-op), unattributed scope.

Docs: COST-ANOMALY.md records ingestion as landed and updates the Still-needed section (#4825 stays open for the census producers + operator opt-in).

Verification

Remote dispatch on the exact head (fleet-run, developing-today/fleet): bun install + the new ingestion suite + the cost-anomaly/spend suites + bunx tsc --noEmit in pm-stack/aggregator, and node --test for the exporter — run id and conclusion recorded on #18127 before merge. CI is not a gate; the merge decision is the full-diff read against #18127's acceptance criteria.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…, wiring (#18127)

Lane 2052-P (bravo SUSTAIN 2052). File: pm-stack/aggregator/src/spend-ingestion.ts
…, wiring (#18127)

Lane 2052-P (bravo SUSTAIN 2052). File: pm-stack/aggregator/test/spend-ingestion-18127.test.ts
…, wiring (#18127)

Lane 2052-P (bravo SUSTAIN 2052). File: pm-stack/aggregator/src/server-wiring.ts
…, wiring (#18127)

Lane 2052-P (bravo SUSTAIN 2052). File: pm-stack/aggregator/src/server.ts
…, wiring (#18127)

Lane 2052-P (bravo SUSTAIN 2052). File: pm-stack/aggregator/COST-ANOMALY.md
…, wiring (#18127)

Lane 2052-P (bravo SUSTAIN 2052). File: pm-stack/queue-bindings-export/queue-bindings-export.mjs
…, wiring (#18127)

Lane 2052-P (bravo SUSTAIN 2052). File: pm-stack/queue-bindings-export/queue-bindings-export.test.mjs
…, wiring (#18127)

Lane 2052-P (bravo SUSTAIN 2052). File: pm-stack/queue-bindings-export/README.md
…, wiring (#18127)

Lane 2052-P (bravo SUSTAIN 2052). File: pm-stack/queue-bindings-export/queue-bindings-export.service
…, wiring (#18127)

Lane 2052-P (bravo SUSTAIN 2052). File: pm-stack/queue-bindings-export/queue-bindings-export.timer
…, wiring (#18127)

Lane 2052-P (bravo SUSTAIN 2052). File: pm-stack/queue-bindings-export/install-laptop.sh
@coderabbitai

coderabbitai Bot commented Dec 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b1b8f2a5-e8b3-46b1-99b3-86e5f4e3aa1b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

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.

impl(pm-stack): production rollup ingestion — bindings/pool exports + aggregator ingestion slice (#4825 follow-on)

0 participants