Skip to content

feat: wire closed-loop production consumers (Phase J)#34

Closed
psdjungpulzze wants to merge 1 commit into
feat/peter-phase-i-engagementfrom
feat/peter-phase-j-consumers
Closed

feat: wire closed-loop production consumers (Phase J)#34
psdjungpulzze wants to merge 1 commit into
feat/peter-phase-i-engagementfrom
feat/peter-phase-j-consumers

Conversation

@psdjungpulzze
Copy link
Copy Markdown
Contributor

Phase J — Wire Production Consumers (Final Phase)

The substrate's read side has `applyCostCalibration`, `getThreshold`, and `getCalibration` helpers ready, but no production code calls them yet. This PR wires the three remaining consumers so every loop actually steers behavior:

Wiring Consumer Producer feeds it
J1 Cost forecast `budget.ts:checkMonthlyBudget` corrects its monthly extrapolation via `applyCostCalibration` `calibrate-predictors` (Phase G)
J2 Auto-flag severity `imports/[importId]/commit` auto-flag block consults `getThreshold("flag-auto:")` and uses the multiplier to upgrade or downgrade per-tenant `tune-thresholds` (Phase H)
J3 Digest engagement `run-daily-digest` skips users whose engagement-rate calibration is below a floor `tune-engagement` (Phase I)

Depends on: #33 (Phase I — engagement). Branched off Phase I.

Cold-start safety preserved end-to-end

  • `LOOPS_ENABLED !== "true"` → all three consumers fall through to today's behavior
  • No calibration/threshold present → identity transform / hardcoded baseline
  • Substrate read fails → warn-log + cold-start fallback

Test plan

  • J1: budget.ts test — forecast corrected by calibration
  • J2: import-commit test — severity multiplied by threshold
  • J3: run-daily-digest test — low-engagement user skipped
  • `npm run typecheck` clean
  • `npm test` — no new failures vs. Phase I baseline

Final state

After this PR every archetype has full producer + storage + learning + production consumer. The closed-loop architecture is end-to-end functional.

@psdjungpulzze
Copy link
Copy Markdown
Contributor Author

Closing without changes. After review the Phase J wirings (cost calibration into budget, threshold-tuned auto-flag severity, engagement-based digest suppression) all involve user-visible behavior changes whose risk/reward doesn't favor speculative wiring. The substrate-side helpers (applyCostCalibration, getThreshold, getCalibration(\"engagement-rate:*\")) are ready in the merged Phases G/H/I — pick them up in a focused PR when there's a concrete operator or user trigger.

@psdjungpulzze psdjungpulzze deleted the feat/peter-phase-j-consumers branch May 6, 2026 08:38
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