feat/repoint-yoy
safeabf5ae8 · incrementalPR #339reviewed 2026-07-23 03:07 UTC0H · 0M · 0L · 1IThe branch
- Purpose
- Energía build PR #2 — repoint consumption_yoy_spike onto the clean calendar-allocated ConsumptionMonth[] series (from PR #1) to eliminate period-length biases causing false YoY spikes.
- Goal
- Wire detectConsumptionYoySpike to the clean series, add confidence gating, bump detectorVersion @1→@2.
- Sub-goals
- SG-1: Shell fetchOrgConsumptionSeries — fetch inputs, group by contract, run buildConsumptionSeries, pass flat series
- SG-2: Detector — consume ConsumptionMonth[], compare only high-confidence non-partial months
- SG-3 (this increment): require 12 TRUSTWORTHY months before firing (loop-review follow-on)
- SG-4 (this increment): log invalid-period contract skips in observability (loop-review follow-on)
The changes (whole branch)
- What
- Reorder usable filter before 12-month count in detectConsumptionYoySpike; add log parameter to fetchOrgConsumptionSeries and emit log.info when buildConsumptionSeries returns an error.
- Why
- Previous loop-review (full, e348403) raised two HIGH findings: thin-baseline YoY spike possible with 12 total but few trustworthy months; and silent contract suppression in the shell made data gaps invisible.
- Areas
- domains/utility/src/finding/finding.decisions.ts+17−10domains/utility/src/finding/finding.shells.ts+11−1
- Blast
- +28/-11 lines, 2 files, domain-internal only — no API surface, no handler, no migration
➖typecheck· not run in this session➖tests· PR: 128 unit tests green (not re-run here)➖ci· CI GraphQL not accessible with this token➖coderabbit· no .coderabbit.yaml
Findings · 1
conventions1
info
Comment 'loop-review · HIGH' attribution left in production code
domains/utility/src/finding/finding.decisions.ts:33
Handy during authoring, will look odd to a future reader. Consider rephrasing as a plain description of the invariant.