Skip to content

Data-Flow Foundation F1+F2 — PR3: Azure repository + ESLint guard#132

Merged
jukka-matti merged 10 commits into
mainfrom
data-flow-foundation-pr3
May 6, 2026
Merged

Data-Flow Foundation F1+F2 — PR3: Azure repository + ESLint guard#132
jukka-matti merged 10 commits into
mainfrom
data-flow-foundation-pr3

Conversation

@jukka-matti
Copy link
Copy Markdown
Owner

Summary

  • AzureHubRepository + cascadeArchive + applyAction (P5) — implements HubRepository; HUB_PERSIST_SNAPSHOT bootstrap; cascade in single Dexie transaction; per-action handlers for all 36 HubAction kinds; sustainment/handoff out of scope (no kinds in union).
  • Storage facade + useEvidenceSourceSync cursor migration (P6) — services/storage.ts saveProcessHub/saveEvidenceSource/saveEvidenceSnapshot route through dispatch; useEvidenceSourceSync cursor put via dispatch; cloud-sync paths untouched.
  • ESLint guard + dispatch-only docs (P7) — eslint.config.js blocks dexie package imports and **/db/schema imports outside R12+R13 allow-list; CLAUDE.md files updated in packages/stores, apps/pwa, apps/azure.
  • 1042 → 1179 azure-app tests (+137 across P5-P7).

Plan-reality deltas (documented in decision-log)

  1. Sustainment/handoff dispatch deferred (no SUSTAINMENT_/HANDOFF_ HubAction kinds; out of F1+F2 scope).
  2. P6 sub-tasks consolidated (call-site analysis showed only storage.ts facade + cursor sync were real migration targets).
  3. Bootstrap cache-fill at storage.ts:548 left direct (cloud→local cache, not write-dispatch).
  4. P7.2 ESLint rule extended to also block **/db/schema imports (broader regression guard).
  5. --chrome walk deferred to user pre-merge (mirrors PR2 precedent).

Final review (P8.1 Opus)

Ready to merge. 0 Critical, 0 Important, 3 Minor doc polish — bundled into P8.3 closeout commit.

Test plan

  • bash scripts/pr-ready-check.sh green (verified pre-push)
  • User performs claude --chrome walk in Azure (sign in, paste CSV, evidence sources flow, archive cascade, multi-hub isolation) before squash-merge
  • Squash-merge after CI green and chrome walk signed off

🤖 Generated with ruflo

jukka-matti and others added 10 commits May 6, 2026 17:22
Adds AzureHubRepository implementing HubRepository from @variscout/core/persistence.
Dispatch short-circuits HUB_PERSIST_SNAPSHOT to saveProcessHubToIndexedDB (bootstrap);
all other action kinds throw explicit P5.2/P5.3 not-yet-implemented error. Read APIs
wire against existing Azure Dexie tables (processHubs, evidenceSources, evidenceSnapshots,
evidenceSourceCursors); F3-pending entities (investigations, findings, questions,
causalLinks, suspectedCauses) are stubbed. Module-scoped azureHubRepository singleton
mirrors PWA composition-root pattern. apps/azure/CLAUDE.md updated with
persistence-boundary invariant documenting R12+R13 exceptions.

Co-Authored-By: ruflo <ruv@ruv.net>
…-hub outcomes test + dispatch error test

- hubs.list() now filters h.deletedAt === null; hubs.get stays unscoped (comment added)
- outcomes.get has O(n hubs) comment noting F3 normalization will remove the scan
- AzureHubRepository.read.test: hubs.list tombstone test + multi-hub outcomes.get test
- AzureHubRepository.test: HUB_PERSIST_SNAPSHOT error propagation test
- Fix 4: corrected misleading fake-indexeddb comment ("kept at line 1" → "must be the first import statement")

Co-Authored-By: ruflo <ruv@ruv.net>
Adds cascadeArchiveDescendants(parentKind, parentId, archivedAt) in
apps/azure/src/persistence/cascadeArchive.ts. Uses transitiveCascade()
from @variscout/core/persistence; wraps all Dexie writes in a single
'rw' transaction covering evidenceSnapshots, evidenceSources,
evidenceSourceCursors, and processHubs. Per-kind stubs with F3 comments
for investigation/finding/question/causalLink/suspectedCause/rowProvenance/
canvasState (no Azure tables today). Outcome cascade explicitly deferred
to P5.3 per-action handler (hub blob mutation). Evidence source cursor
hub-range query uses compound PK [hubId+sourceId] between(). 10 new tests
covering: evidenceSource→cursor cascade, hub multi-table cascade,
investigation no-op, rollback, idempotency, empty-descendants. Barrel
updated to re-export the helper.

Co-Authored-By: ruflo <ruv@ruv.net>
… fan-out test

- Fix 1: add ## Atomic call pattern (P5.3+) section to cascadeArchiveDescendants
  JSDoc prescribing the outer-transaction wrapping pattern P5.3 must use to
  keep parent-row update + descendant cascade atomic; explains Dexie 4 zone reuse.
- Fix 2: replace hedge comment in rollback test with confident pass-confirmation
  statement — rollback path verified green at P5.2 baseline (1098 tests).
- Fix 3: add cursor2 for src2 in the hub multi-table cascade test to cover the
  fan-out path (hub → both evidenceSource cursors via compound key-range scan).

Co-Authored-By: ruflo <ruv@ruv.net>
Implements all HubAction handlers in a new applyAction.ts module (Option B):
- Hub-blob mutations (HUB_UPDATE_GOAL, HUB_UPDATE_PRIMARY_SCOPE_DIMENSIONS,
  OUTCOME_ADD, OUTCOME_UPDATE, OUTCOME_ARCHIVE) — read-modify-write via
  saveProcessHubToIndexedDB.
- Direct Dexie table writes (EVIDENCE_ADD_SNAPSHOT, EVIDENCE_ARCHIVE_SNAPSHOT,
  EVIDENCE_SOURCE_ADD, EVIDENCE_SOURCE_UPDATE_CURSOR, EVIDENCE_SOURCE_REMOVE).
- EVIDENCE_SOURCE_REMOVE atomically wraps cascade + parent soft-delete in a
  single db.transaction; outer table list is a superset of cascadeArchiveDescendants'
  internal transaction to satisfy Dexie zone propagation.
- Session-only kinds (INVESTIGATION_*, FINDING_*, QUESTION_*, CAUSAL_LINK_*,
  SUSPECTED_CAUSE_*) — documented no-ops with F3 comment.
- Canvas kinds — documented no-ops with HUB_PERSIST_SNAPSHOT-flow comment.
- TypeScript exhaustiveness via assertNever() ensures compile-time completeness.

AzureHubRepository.dispatch now delegates to applyAction after the
HUB_PERSIST_SNAPSHOT short-circuit.

Adds 73 new tests (1098 → 1171). Adds sustainment-deferral note to
apps/azure/CLAUDE.md Invariants section.

Co-Authored-By: ruflo <ruv@ruv.net>
…ernal barrel + idempotency notes

Co-Authored-By: ruflo <ruv@ruv.net>
…cade + cursor sync)

Migration A: replace saveProcessHubToIndexedDB, saveEvidenceSourceToIndexedDB,
saveEvidenceSnapshotToIndexedDB in the three StorageProvider save methods with
azureHubRepository.dispatch(HUB_PERSIST_SNAPSHOT | EVIDENCE_SOURCE_ADD |
EVIDENCE_ADD_SNAPSHOT). Cloud-sync blocks unchanged. List/cache paths (lines 548,
595, 642) intentionally kept on direct localDb helpers (read-sync only).
Bootstrap save in listProcessHubs (line 548) left on direct call — it syncs cloud
→ local cache, not a hub-write dispatch path.

Migration B: replace db.evidenceSourceCursors.{get,put} in useEvidenceSourceSync
with azureHubRepository.evidenceSources.getCursor (Option B-1) and
dispatch(EVIDENCE_SOURCE_UPDATE_CURSOR). No direct Dexie usage remains in the file.

Tests: storage.test.ts — added db.processHubs mock for ensureDefaultProcessHubInIndexedDB;
added persistence mock for azureHubRepository.dispatch; added saveProcessHub /
saveEvidenceSource / saveEvidenceSnapshot tests asserting dispatch called with correct
action shapes. useEvidenceSourceSync.test.ts — replaced db.evidenceSourceCursors mock
with azureHubRepository mock; updated markSeen test to assert dispatch call shape.

Tests: 1173 → 1178 ✓ (5 new). Build: clean.

Co-Authored-By: ruflo <ruv@ruv.net>
…ence paths

Add hoisted mocks + vi.mock factory entries for all six evidence-blob
functions (listBlobEvidenceSnapshots, saveBlobEvidenceSnapshot,
updateBlobEvidenceSnapshots, listBlobEvidenceSources,
saveBlobEvidenceSource, updateBlobEvidenceSources). Previously the
saveEvidenceSnapshotToCloud path called undefined blob functions which
were silently swallowed, letting the cloud-sync assertion pass without
the blob calls ever firing. Tighten the existing snapshot online test
to assert exact dispatch shape (provenance: []) + blob function calls.
Add parallel online + cloud-sync test for saveEvidenceSource covering
dispatch shape and blob function calls. Tests: 1178→1179.

Co-Authored-By: ruflo <ruv@ruv.net>
- P7.1: Update packages/stores, apps/pwa, apps/azure CLAUDE.md files to
  explicitly state the dispatch-only invariant (domain stores never import
  dexie directly; access via HubRepository / pwaHubRepository.dispatch /
  azureHubRepository.dispatch). Update "will add" references to past tense
  now that P7.2 delivers the rule. Enumerate R12+R13 exceptions clearly in
  each file.
- P7.2: Add ESLint no-restricted-imports rule in eslint.config.js blocking
  dexie package imports and **/db/schema glob imports outside the documented
  allow-list (persistence/, db/, wallLayoutStore.ts, azure services/storage
  + localDb + cloudSync + lib/persistence, test files). Smoke-tested: rule
  fires on ProcessHubEvidencePanel.tsx with clear actionable message; passes
  cleanly against current codebase (0 errors).
- P7.3: Confirmed pnpm lint is already a step in pr-ready-check.sh (no
  script change needed). pr-ready-check passes end-to-end.

Co-Authored-By: ruflo <ruv@ruv.net>
…ered

- Minor #1: add bootstrap cache-fill comment above storage.ts:548 for-loop
- Minor #2: R12 self-document comment on wallLayoutStore Dexie import
- Minor #3: fix plan frontmatter category (implementation-plan/audit → implementation)
- decision-log: F1+F2 closeout entry (what/why/deltas) + session backlog row
- spec: 2026-05-06-data-flow-foundation-design.md status active → delivered

Co-Authored-By: ruflo <ruv@ruv.net>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mean-beoynd-lite-pwa Ready Ready Preview, Comment May 6, 2026 4:49pm
variscout_website Ready Ready Preview, Comment May 6, 2026 4:49pm

@jukka-matti jukka-matti merged commit 2490fc8 into main May 6, 2026
3 checks passed
@jukka-matti jukka-matti deleted the data-flow-foundation-pr3 branch May 6, 2026 17:28
jukka-matti added a commit that referenced this pull request May 6, 2026
PR3 (Azure repository + ESLint guard) merged at 2490fc8, completing
F1+F2 across all three squash commits on origin/main:
- d2822ea PR #130 (F1 types)
- 7fc1a36 PR #131 (F2 PWA)
- 2490fc8 PR #132 (F2 Azure + ESLint guard)

Plan updated with F1+F2 SHIPPED block + Session 3 closeout (P5-P8
delivered, plan-reality deltas, F-series forward, watchlist).
Original Session 2 closeout preserved as PR2 history.

Spec already flipped status: active → delivered as part of PR3 P8.2.

Co-Authored-By: ruflo <ruv@ruv.net>
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