feat/int-base
safeviewing older commit2ed62f4 · incrementalPR #268reviewed 2026-07-13 04:13 UTC0H · 0M · 0L · 3I- Purpose
- Land all shared seams the 12 device-integration ports depend on — manifests, catalog seeds, ARN-seed registry entries, CDK path entries, and legacy-registry/credential migration scripts — so each per-brand branch only touches its own vendor directories.
- Goal
- feat: device-integrations foundation — manifests, seeds, migration tooling (PR #268)
- Sub-goals
- SG-1: 12 integration manifests + registration (done)
- SG-2: Catalog seed rows — Makes, Integrations, MetricTypes incl. battery/load (done)
- SG-3: ARN-seed REGISTRY entries + missing-Lambda tolerance (done)
- SG-4: CDK paths.ts handler entries for all 12 vendors (done)
- SG-5: D3 registry-migration script (dry-run first) (done)
- SG-6: D2 credential-copy script (dry-run first) (done)
- SG-N: Framework improvements — retire stale manifest co-location guidance (done)
- SG-7: 1M calendar-month granularity end-to-end (done)
- SG-8: Canonical multi-gran worker contract docs (done)
- SG-9: Fix inert coverage clamp (union-based, 1M-safe) (done)
- SG-10: Consolidation merge — fold 12 brand branches into int-base (done)
- SG-11: Sync latest main + hoymiles seed credentialFields fix (done)
- SG-12: Combined validation on the one int-base estate (all 12 brands) (done)
- SG-13: Review remediation — confirmed Loop C triage findings R1–R6, R12, R14 (done)
- SG-14: Review 4 Loop-C-uncovered brands (victron/abb/sma/solark) (done)
- What
- This incremental commit (2ed62f48) adds: (1) .claude/rules/site-metrics-seam.md — 21-line operational rule documenting the backfill/collection-order inversion hazard in decideRecordMetrics (extend-open sets endedAt < startedAt on older-window collection → clampWindowToCoverage silent read-blackout; two mitigation rules: deep history on its own coarse source, deactivate all streams before a deep-history pass); (2) .branch/scale-notes.md — 69-line SCALE validation record for 20 devices / 4 brands (hoymiles, shelly, huawei, solis) on the feat-int-base preview estate, documenting recent/deep collection results, rate-cap behavior, cross-grain integral spread, disjoint-coverage proof, and dedupe verification.
- Why
- The inversion hazard was observed live during SG-12 validation (0 rows read while 287 sat in Tinybird, repaired by deleting the inverted coverage row). Documenting it as a seam rule makes it part of the canonical read-path contract so future brand branches and cutover runbooks inherit the guard. The scale-notes capture the empirical evidence supporting SG-7 and SG-9 at realistic device counts.
- Areas
- services/metrics+161−0infra/cdk+41−0.branch/tools+29−0packages/integration-manifests+16−0scripts/metrics+12−0domains/metrics+12−0domains/cross-domain+4−0packages/database+3−0infra/tinybird+2−0.claude/rules+2−0
- Blast
- 288 files changed, +41,176/-130 across the full branch (excluding noise). Largest area: services/metrics (161 files — 12 vendor integration workers). This incremental commit is 2 doc files only.
Findings · 3
security1
Dev AWS account number visible in scale-notes
.branch/scale-notes.md:3
Line 3 discloses the dev account number (706877673155) and Supabase branch ID (mckgaguxbalrnsmnpccc). These are dev-environment-only identifiers in a private repo with no prod exposure, but worth awareness if the file is shared outside the repo.
improvement2
Seam rule could cross-reference the SG-9 code guard
.claude/rules/site-metrics-seam.md:68
The new 'Backfill/collection ORDER' rule explains the inversion hazard and operational procedures but doesn't point to the code defence: the union-based clampWindowToCoverage fix from SG-9 (domains/metrics/src/metric/metric.queries.ts). A brief '(defended at read by clampWindowToCoverage — see SG-9)' cross-reference would complete the picture for future readers.
Inversion recovery procedure lacks concrete repair step
.claude/rules/site-metrics-seam.md:75
The rule says 'repaired by deleting the inverted row + re-collecting forward' but doesn't give the SQL or reference a runbook. A future engineer hitting this in production would need to discover the repair independently. Even a one-liner ('DELETE FROM metric_coverages WHERE source_id = ? AND ended_at < started_at') or a pointer to a runbook would reduce incident response time.
History · 11 commits
- f7b9554safeincremental0H · 0M · 0L2026-07-13 20:18
- 9ca23adneeds attentionincremental0H · 3M · 3L2026-07-13 19:17
- 595484fneeds attentionincremental1H · 3M · 7L2026-07-13 04:29
- 2ed62f4safeincremental0H · 0M · 0L2026-07-13 04:13current
- 2812f54needs attentionincremental1H · 3M · 10L2026-07-11 00:19
- 1794b23needs attentionincremental2H · 2M · 5L2026-07-10 21:59
- e5674dcneeds attentionincremental3H · 7M · 6L2026-07-09 19:29
- ca45a96needs attentionincremental0H · 3M · 3L2026-07-09 18:56
- 5d19484safeincremental0H · 0M · 1L2026-07-08 02:04
- dd403feneeds attentionincremental12H · 22M · 12L2026-07-07 20:02
- e663ae9needs attentionincremental2H · 7M · 7L2026-07-07 19:02