Data-Flow Foundation F1+F2 — PR1: types + interfaces#130
Merged
Conversation
…) [P1.1] Introduces packages/core/src/identity.ts with the EntityBase interface (id, createdAt, deletedAt) and generateDeterministicId(), which delegates to crypto.randomUUID and throws on unsupported runtimes instead of falling back to Math.random. Sweeps both Math.random generateId instances per plan decision D-P3 / audit R11: packages/core/src/findings/factories.ts now re-exports generateDeterministicId as generateId (preserving all external call sites) and uses it internally; apps/azure/src/lib/persistence.ts drops its local generateId in favour of the canonical import from @variscout/core/identity. Also fixes pre-existing toFixed violations in createFactorFinding (feedback_fix_absorbed_violations_at_seam): guards with Number.isFinite before each .toFixed() call. Four new Vitest tests cover UUID format, uniqueness, throw-on-missing-crypto, and EntityBase runtime shape. Test count: 3226 -> 3230. Co-Authored-By: ruflo <ruv@ruv.net>
…Base [P1.2] Extends ProcessHub, OutcomeSpec, and ProcessHubInvestigation to implement EntityBase (id, createdAt: number, deletedAt: number | null) per audit R1/R7. Renames ProcessHubInvestigation.modified → updatedAt (number). Converts ProcessHub.createdAt/updatedAt and latestActivity fields across rollup/review/ cadence types from ISO strings to Unix ms numbers. Sweeps all downstream consumers in @variscout/ui, @variscout/azure-app, and @variscout/pwa; all 3230+1604+1042+189 tests pass and all four tsc builds are clean. Co-Authored-By: ruflo <ruv@ruv.net>
…on [P1.3] EvidenceSource, EvidenceSnapshot, RowProvenanceTag, and SnapshotProvenance all extended to EntityBase (id, createdAt: number, deletedAt: number|null). All ISO-string timestamps (createdAt, updatedAt, importedAt, lastSeenAt) converted to Unix ms numbers. RowProvenanceTag substantive shape change per R8: adds snapshotId FK, rowKey (was the Map's composite key), plus EntityBase fields. Sidecar Map<rowKey, RowProvenanceTag> preserved as runtime index. Both paste wedges (useEditorDataFlow, usePasteImportFlow) updated to populate all required fields; snapshotId='' is the placeholder until F3 wires snapshot-creation. EvidenceSourceCursor relocated from apps/azure/src/db/schema.ts to packages/core/src/evidenceSources.ts per R4. lastSeenAt: string → number. Azure schema now re-exports the type from @variscout/core; Dexie composite key [hubId+sourceId] is unchanged. EvidenceSnapshot.importedAt + createdAt: kept both fields (importedAt is the domain name from ADR-077 D6; createdAt is EntityBase lifecycle). Same value at creation. Avoids renaming churn across ADR + tests. Consumer sweep: ProcessHubEvidencePanel nowMs(), 12 azure test files, 3 pwa test files, SnapshotTimelineStrip test, provenance tests. ADR-077 amended with Amendment — 2026-05-06 block per convention. Co-Authored-By: ruflo <ruv@ruv.net>
- Adds EntityBase lifecycle fields (id, createdAt: number, deletedAt: number|null) to Finding, Question, SuspectedCause, CausalLink, FindingComment, ActionItem, ImprovementIdea, InvestigationCategory, and related types. - Converts all ISO-string createdAt/updatedAt fields to Unix ms (number) atomically. - Renames CausalLink.hubId → suspectedCauseId (R5) — the FK pointed at SuspectedCause, not ProcessHub. - Adds FindingComment.parentId + parentKind discriminator for polymorphic parent. - Adds investigationId FK to Finding, Question, and SuspectedCause. - Sweeps all consumers: stores, hooks, ui, charts, azure-app, pwa — 8338 tests green. - Fixes pre-existing .toFixed() violation in useJournalEntries (replaced with formatStatistic). Co-Authored-By: ruflo <ruv@ruv.net>
Backfill `investigationId` + `deletedAt` on all test fixtures across `@variscout/core`, `@variscout/hooks`, and `@variscout/stores` that reference the domain entity types (`Finding`, `Question`, `SuspectedCause`, `FindingComment`, `InvestigationCategory`, `ActionItem`, `PhotoAttachment`, `OutcomeSpec`, `ProcessHubInvestigation`). Hard `investigationId` required as 2nd arg in `createQuestion` factory; all single-arg call-sites updated. All `Date.now()` / ISO timestamp literals in VALUE positions replaced with deterministic `1714000000000`. `FilterAction` missing fields (`id`, `source`, `timestamp`, `label`) added. `SpecLimits` field names corrected to lowercase `lsl`/`usl`. `parentKind` corrected to camelCase `'finding'`/`'suspectedCause'`. Logs `'general-unassigned'` investigationId placeholder pattern as architectural debt in `docs/investigations.md`. All packages: zero new tsc errors; full monorepo test suite green. Co-Authored-By: ruflo <ruv@ruv.net>
….4b] SustainmentRecord, SustainmentReview, and ControlHandoff now extend EntityBase (id, createdAt: number, deletedAt: number | null). tombstoneAt is fully removed; all 20 call-sites updated to deletedAt !== null soft-delete semantics. ControlHandoff recordedAt renamed to createdAt (EntityBase). Dexie Version 9 added to rename the indexed column. All 3230 core + 1042 azure tests pass, @variscout/ui build clean. Co-Authored-By: ruflo <ruv@ruv.net>
ProcessMapNode.parentStepId, ProcessMapArrow.fromStepId/toStepId, ProcessMapTributary.stepId, and ProcessMapHunch.tributaryId/stepId retyped from plain `string` to `ProcessMapNode['id']` / `ProcessMapTributary['id']` per R6 typed-FK audit. ProcessMap interface itself is unchanged — per spec D3 the canvas state is a 1:1 single-row schema embedded in the hub blob; no surrogate id at the map level and no EntityBase extension (that is F3 territory). 3230 core tests + 261 store tests pass; UI, PWA, and Azure-app builds all clean; no consumer fixtures required adjustment (string aliases are transparent at runtime). Co-Authored-By: ruflo <ruv@ruv.net>
… cascadeRules [P2.1-P2.5] Adds the action surface (packages/core/src/actions/) and persistence surface (packages/core/src/persistence/) to @variscout/core. - 10 action sub-unions (outcome/evidence/evidenceSource/investigation/ finding/question/causalLink/suspectedCause/hubMeta/canvas), each in their own file under actions/. - HubAction top-level discriminated union; discriminator is `kind` with SCREAMING_SNAKE_CASE values per plan R2 (matching the existing canvas convention at core/canvas/types.ts). - canvasActions.ts re-exports CanvasAction from canvas/types.ts as-is; no redefinition (R2: canvas was the source-of-truth). - HubRepository interface in persistence/HubRepository.ts with single dispatch(action) write path + 10 grouped read APIs per D-P1. - cascadeRules data + transitiveCascade BFS helper covering 12 EntityKinds (hub/outcome/evidenceSnapshot/rowProvenance/evidenceSource/ evidenceSourceCursor/investigation/finding/question/causalLink/ suspectedCause/canvasState) per spec D4/D6. - Exhaustiveness test in actions/__tests__/exhaustiveness.test.ts ensures every action kind literal has a TypeScript-level case branch. - ./actions and ./persistence sub-path exports added to package.json. - Root barrel (src/index.ts) re-exports HubAction, all 10 sub-unions, HubRepository, EntityKind, cascadeRules, transitiveCascade. - No implementation classes (PwaHubRepository/AzureHubRepository) — those are PR2/PR3 territory. P2 is interfaces + types only. Tests: 3241 pass (baseline 3230 + 11 new: 1 exhaustiveness + 10 cascade). Build: full monorepo build green. Refs: spec D4/D6, plan tasks P2.1-P2.5, locked decision D-P1. Co-Authored-By: ruflo <ruv@ruv.net>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
jukka-matti
added a commit
that referenced
this pull request
May 6, 2026
Plan updated with Session 1 status block: 8 commits landed across P0+P1.1-P1.5+P1.4 fix+P1.4b+P2.1-P2.5; PR1 opened at #130 awaiting CI/merge. Resume point + watchlist items captured for fresh Session 2 to start PR2 (PWA repository + composition migration). Co-Authored-By: ruflo <ruv@ruv.net>
2 tasks
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>
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR1 of 3 in the Data-Flow Foundation F-series (F1+F2: type-level normalization + repository pattern). Pure-types + interfaces in
@variscout/coreplus consumer fixes across the monorepo. No runtime behavior change. F3 (PR7 in canvas migration sequence) swaps the PWA Dexie backend without changing this PR's surface.Spec:
docs/superpowers/specs/2026-05-06-data-flow-foundation-design.mdPlan:
docs/superpowers/plans/2026-05-06-data-flow-foundation-f1-f2.mdAudit (P0):
docs/superpowers/plans/2026-05-06-data-flow-foundation-f1-f2-audit.md— 15 plan-revising findings (R1–R15) absorbed before P1 dispatch.What landed
160978ea@variscout/core/identity(EntityBase+generateDeterministicId); sweeps bothMath.randomgenerateIdinstances34cb664dProcessHub+OutcomeSpec(surrogate id added) +ProcessHubInvestigationextendEntityBasea006f420EvidenceSource,EvidenceSnapshot,RowProvenanceTag) extend EntityBase;EvidenceSourceCursorrelocated azure→core (R4); ADR-077 amended94051a31CausalLink.hubId → suspectedCauseIdrename (R5)51abfb80createFinding/createQuestion/createSuspectedCauseinvestigationIdhardening;'general-unassigned'debt logged ininvestigations.mdbb6c078dtombstoneAt → deletedAtrename (R3)5c6b9183ProcessMapNode,ProcessMapTributary,ProcessMapArrow,ProcessMapHunch);ProcessMapitself stays non-EntityBase per spec D3 (R6)e7a9938eHubActiondiscriminated union (kinddiscriminator + SCREAMING_SNAKE_CASE per R2) +HubRepositoryinterface +cascadeRules(12 EntityKinds) + exhaustiveness testArchitectural decisions absorbed
kinddiscriminator +SCREAMING_SNAKE_CASEaction values match the existing canvas migration convention (packages/core/src/canvas/types.ts);CanvasActionre-exported as-is.createdAt: number(Unix ms) atomically across all entities — half the codebase had ISO strings, converted in same PR perfeedback_no_backcompat_clean_architecture.id,createdAt,deletedAtREQUIRED — no optional/loose typing.'general-unassigned'placeholder forFinding.investigationId/Question.investigationIduntil F6 multi-investigation lifecycle ships; logged as architectural debt indocs/investigations.md.RowProvenanceTag.snapshotId = ''at paste-flow call sites — F3 wiring gap, documented in code comments + ADR-077 amendment.Scope
data-flow-foundation-f1-f2.worktrees/data-flow-foundation-f1-f2/Test plan
pnpm --filter @variscout/core test— 3241 tests passing (3230 baseline + 11 new actions/cascade tests)@variscout/ui,@variscout/azure-app,@variscout/pwatsc all 0 errors)bash scripts/pr-ready-check.sh— green (tests + lint + docs:check + PWA dist integrity)claude --chromewalk that existing dev-state hubs still render identically (no runtime behavior change expected)Known follow-ups (deferred to PR2 or later F-series slices)
generateDeterministicIdname doesn't match implementation (UUID v4 is non-deterministic); rename togenerateEntityIdif the Important issue surfaces during PR2 review.id: \snapshot-${Date.now()}`inProcessHubEvidencePanel.tsx:333— should reuse capturedtimestamp` variable. F3 will replace this surface entirely.useEvidenceSourceSync.markSeenoverwritescreatedAton every put — F3 normalization concern.Math.randominpackages/core/src/__tests__/stackDetection.test.ts— out of scope perfeedback_fix_absorbed_violations_at_seam(file not touched in this PR).🤖 Generated with ruflo