← all branches

feat/repoint-yoy

safe
abf5ae8 · incrementalPR #339reviewed 2026-07-23 03:07 UTC0H · 0M · 0L · 1I
The 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+1710domains/utility/src/finding/finding.shells.ts+111
Blast
+28/-11 lines, 2 files, domain-internal only — no API surface, no handler, no migration
typecheck· not run in this sessiontests· PR: 128 unit tests green (not re-run here)ci· CI GraphQL not accessible with this tokencoderabbit· 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.