Skip to content

pm-stack: #4825 cost-anomaly production caller (opt-in PM_COST_ANOMALY_ENABLED) - #17128

Merged
dezren39 merged 7 commits into
mainfrom
archer/4825-cost-anomaly-activation
Nov 30, 2026
Merged

dezren39 merged 7 commits into
mainfrom
archer/4825-cost-anomaly-activation

Conversation

@dezren39

@dezren39 dezren39 commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

#4825 slice: the production caller for the cost-anomaly detector

Lane 0052-I (bravo SUSTAIN author lane, fallback rank 154). Claim: #4825 (comment)

Every piece of #4825 existed except the production caller: the detector (cost-anomaly.ts), the tick intake (AlertTickOptions.costAnomalyEvidence), the evidence producer, and the certified source seams — but startAlertEngine never injected a loader, so in production the detector could only be fed by test fixtures (COST-ANOMALY.md: "No production caller injects a loader yet").

What this lands

  • New src/cost-anomaly-activation.ts — the opt-in switch + loader builder. PM_COST_ANOMALY_ENABLED must be an explicit 1/true; off (default) builds no loader at all. When on, the loader runs the producer (loadCostAnomalyEvidence) over the injected deps on every alert tick.
  • src/server-wiring.ts — builds costAnomalyEvidence from the production rollup store (spendRollupStore.readAll(), the same store behind the spend cards). Auxiliary certified seams are deliberately not supplied until production ingestion lands, so those classes stay suppressed — never fabricated.
  • src/alerts.ts — startAlertEngine gains an optional AlertTickOptions parameter and passes costAnomalyEvidence into runAlertTick. Default behaviour is byte-identical when no loader is passed.
  • src/server.ts — passes the wiring loader into startAlertEngine.
  • COST-ANOMALY.md — records the landed caller and what still remains (production rollup ingestion + census data producers). impl(pm-stack): cost-anomaly detection to Needs-you via the alert throat (#1259 slice 4) #4825 stays open for that remainder.

Verification (oracle: the suites' own assertions)

  • bun test on the branch head (aggregator extracted from the branch tarball, bun install): 104 pass / 0 fail across cost-anomaly-activation-4825 (new), cost-anomaly-wiring-4825, cost-anomaly-4825, cost-anomaly-producer-4825, cost-anomaly-sources-4825, cost-anomaly-rollup-sources-4825, cost-anomaly-presentation-4825, and alerts.test.ts.
  • New tests pin: the gate (unset/0/false/yes → off; 1/true → on), no loader while off, uncertified seams → tick posts nothing (honest silence), certified closure seam → exactly one burn warning through the production loader, certified closure + busiest-root → both store-fed warnings.
  • bunx tsc --noEmit: no errors in any touched file (the only errors are pre-existing partial-extraction artifacts for sibling packages pm-stack/projector / pm-stack/grist, absent from the extracted tree).

Refs #4825 (slice; the issue remains open for production ingestion).


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

@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 42 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

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: 0eae7476-eea0-4409-8924-19e347182067
Commits

Reviewing files that changed from the base of the PR and between fab7a96 and 4281523.

Files selected for processing: 7

  • pm-stack/aggregator/COST-ANOMALY.md
  • pm-stack/aggregator/src/alerts.ts
  • pm-stack/aggregator/src/cost-anomaly-activation.ts
  • pm-stack/aggregator/src/cost-anomaly.ts
  • pm-stack/aggregator/src/server-wiring.ts
  • pm-stack/aggregator/src/server.ts
  • pm-stack/aggregator/test/cost-anomaly-activation-4825.test.ts
  • 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

@dezren39

Copy link
Copy Markdown
Member Author

🤖 Lane 0212-P shepherd (xaltha, 2026-11-30) — verify-then-merge: full diff read against #4825 purpose. The activation module is opt-in only (PM_COST_ANOMALY_ENABLED = explicit 1/true; off builds no loader), startAlertEngine default behaviour unchanged when no loader passed, auxiliary certified seams deliberately unsupplied so uncertified classes suppress rather than fabricate, and the new test file covers the gate, honest-silence, and both store-fed warnings. PR is MERGEABLE, non-draft, no CHANGES_REQUESTED. Merging with a merge commit under the standing merge authority (CI is not a gate).

@dezren39
dezren39 merged commit 94e7883 into main Nov 30, 2026
2 checks passed
@dezren39
dezren39 deleted the archer/4825-cost-anomaly-activation branch November 30, 2026 08:17
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