feat/multi-gran
safee4f79c8 · incrementalPR #289reviewed 2026-07-09 05:04 UTC0H · 0M · 1L · 2IThe branch
- Purpose
- Fix the eGauge worker fetching once at sources[0].granularity and projecting all channels from a single CSV — causing 15m channels to receive 5m-cadence data mislabeled as 15m.
- Goal
- Let a single metrics collection run collect multiple granularities per device, returning one MetricsPayload per (variable × granularity) at its native cadence.
- Sub-goals
- SG-1: groupChannelsByGranularity helper + contract doc clarification
- SG-2: eGauge worker fetch-per-distinct-granularity (the core fix)
- SG-3: Growatt regression test — same variable at 5m/1d → two fetches/payloads
- SG-4: Aggregator test — one variable × two granularities → two channels per device invocation
- SG-5: Live validation against real eGauge devices — DONE (this commit records it)
- SG-6: Framework docs fold-back (metrics-pipeline.md, integrations/CLAUDE.md, engine/CLAUDE.md)
The changes (whole branch)
- What
- This commit: marks SG-5 done in .branch/ tracking files only — no code change. Branch total: new groupChannelsByGranularity helper, eGauge worker refactor (group-fetch-project per granularity), Growatt+aggregator handler tests, metrics-pipeline.md docs.
- Why
- eGauge devices have a native retention split (5m recent / 15m aged). The pipeline sent both channels but the worker fetched once — 15m channels got wrong-cadence data. No schema or wire-type change needed; granularity multiplicity already fits the existing per-source array.
- Areas
- .branch+157−0services/metrics/engine+130−13services/metrics/integrations/egauge+155−40services/metrics/integrations/growatt+113−0.claude/rules+27−4
- Blast
- 13 files, +632/-53. No schema change, no wire-type reshape, no read-path change. Code blast radius = eGauge worker + test suites only.
docs-only-commit live-prod-registry-read-during-validation
➖CI· no checks data accessible➖CodeRabbit· no .coderabbit.yaml
Findings · 3
correctness1
low
PR body still says SG-5 is deferred but scope.md now marks it done
.branch/scope.md
Reviewer sees a contradiction. Recommend updating the PR body to remove the 'Not done in this PR' section and note SG-5 completed via live worker test.
security1
info
Live validation read from production DynamoDB registry (management account)
.branch/intent.md
Read-only device ID lookup; no writes. Worth noting for audit trail — preview-branch validation against real prod infra.
conventions1
info
Intent log SG-5 row still carries '(this)' placeholder instead of resolved SHA e4f79c87
.branch/scope.md
Prior completed entries resolved '(this)' to the actual SHA in the same commit (SG-6 → 9312968f). Minor tracking inconsistency.