Skip to content

Refactor session runtime, settings data seams, STT adapters, and ingestion#13

Merged
justinpbarnett merged 35 commits intomainfrom
sandcastle/integrated-runtime-settings-ingestion-refactor
Apr 27, 2026
Merged

Refactor session runtime, settings data seams, STT adapters, and ingestion#13
justinpbarnett merged 35 commits intomainfrom
sandcastle/integrated-runtime-settings-ingestion-refactor

Conversation

@justinpbarnett
Copy link
Copy Markdown
Owner

@justinpbarnett justinpbarnett commented Apr 27, 2026

Summary

This integrates a Sandcastle-generated refactor across several app seams:

  • Extracts a testable session runtime
  • Deepens local app data/storage helpers
  • Extracts reference card layout and entity card presentation models
  • Adds Files and Voice settings category controllers
  • Introduces shared world data ingestion
  • Splits Deepgram browser/native capture adapters
  • Adds lifecycle-safe STT wrapper behavior
  • Migrates file upload and Google Docs ingestion through shared ingestion paths
  • Ignores the local .sandcastle/ work/log directory

Validation

  • TypeScript: just check
  • Unit tests: npm test
  • Web build: just build-web
  • Screenshots: just screenshot

Task: complete issue #2 data source settings tracer bullet. PRD: issue #2; no separate PRD was referenced.

Key decisions: moved data source defaults/types/load/save into the local app data seam; DataSourcesProvider now delegates hydration/persistence/reset defaults without direct write-token or reset-generation checks; successful data source saves still re-enable cache writes.

Files changed: src/storage/app-data.ts, src/storage/app-data.test.ts, src/context/data-sources.tsx, package.json.

Notes: package-lock.json had pre-existing unstaged libc metadata deletions and was intentionally left out.
Task/PRD: Completed GitHub issue #3 (no separate PRD referenced) by moving CardGrid layout math into a pure reference-card model.

Decisions: Kept existing grid constants and measured-height fallback unchanged; shared card-size column config with UI settings; added npm typecheck script for validation.

Files: package.json; src/reference-card-layout.ts; src/reference-card-layout.test.ts; src/components/CardGrid.tsx; src/context/ui-settings.tsx.

Notes: npm run typecheck, npm run test, npm run lint, and expo web export passed. Targeted Playwright responsive/card interaction run was blocked by missing local Chromium install.
Task/PRD: completed issue #1 (no separate PRD referenced).

Decisions: added non-React SessionRuntime with detector injection and snapshot subscriptions; moved card stack helpers out of STT-tied session helpers; kept useSession appendTranscript/cards/transcript/recentDetections call patterns unchanged; added npm typecheck script.

Files: package.json; src/context/card-stack.ts; src/context/session-helpers.ts; src/context/session-runtime.ts; src/context/session-runtime.test.ts; src/context/session.tsx.

Notes: npm run typecheck, npm run test, npm run lint, and npx expo export --platform web pass. Relevant Playwright entity e2e was attempted after installing Chromium but blocked by missing OS library libnspr4.so.
Merged issue #1 session runtime extraction, issue #2 local app data settings seam, and issue #3 reference card layout model. Verified after each merge with npm run typecheck and npm run test.
Task/PRD: completed issue #6; related issue #3 reference card surface was already closed, and no separate PRD was referenced.

Key decisions: added a pure entity card presentation model for summary bullets, type labels, accent color passthrough, image state, pinned state, and pin/dismiss action metadata; kept EntityCard visual styles and callbacks in place while rendering from the model.

Files changed: src/entity-card-presentation.ts; src/entity-card-presentation.test.ts; src/components/EntityCard.tsx.

Notes: npm run typecheck, npm run test, and npm run lint pass. Pre-existing package-lock libc metadata diff was left unstaged.
Task/PRD: Completed GitHub issue #5; no separate PRD was referenced (built on #2 local app data seam).

Key decisions: moved upload add/remove/list queues into src/storage/app-data; resetStoredAppData now waits for pending upload mutations itself; SRD cache reads/writes use app-data cache sessions and any successful non-cache app-data write re-enables cache writes after delete-all.

Files changed: app/settings.tsx; src/storage/app-data.ts; src/storage/app-data.test.ts; src/entities/providers/file-upload.ts; src/entities/providers/file-upload.test.ts; src/entities/providers/srd.ts.

Notes: npm run typecheck, npm run test, and npm run lint pass. package-lock.json had pre-existing unstaged libc metadata deletions and was left untouched.
Task/PRD: completed issue #9; PRD/reference is issue #9 with related local app data seam from #2.

Decisions: moved Voice draft state and saved-indicator timer into a settings category controller; added validated voice defaults/load/save to the local app data seam; routed session STT load through that seam so saved Web Speech/Deepgram settings select the next provider.

Files changed: app/settings.tsx; src/settings/voice-settings-category.ts(.test); src/storage/app-data.ts(.test); src/stt/build-provider.ts(.test).

Notes: npm run typecheck, npm run test, and npm run lint pass. Existing package-lock.json libc metadata diff was left unstaged.
Task/PRD: completed GitHub issue #4; no separate PRD referenced (follow-up to #1).

Key decisions: SessionRuntime now owns STT provider creation/reuse, status/error/provider-name snapshots, transcript gates, generation checks, detection interval start/clear, and stop reset; SessionProvider is a React adapter over runtime commands.

Files changed: src/context/session-runtime.ts, src/context/session-runtime.test.ts, src/context/session.tsx.

Notes: npm run typecheck, npm run test, npm run lint, and npx expo export --platform web pass. Targeted Playwright session/entity e2e was attempted after installing Chromium but blocked by missing system library libnspr4.so. Pre-existing package-lock.json metadata diff left unstaged.
Task/PRD: completed GitHub issue #8; reference is issue #8 with local app data behavior from #5.

Key decisions: moved Files upload/paste/remove/delete-all state and commands into a tested category controller; Settings now only wires layout/dependent resets; AI parsed uploads use the same category save path so uploadsVersion is bumped after storage changes.

Files changed: app/settings.tsx; src/settings/files-settings-category.ts; src/settings/files-settings-category.test.ts.

Notes: npm run typecheck and npm run test pass. Full npm run lint is blocked by pre-existing src/storage/app-data.ts max-lines violation; changed files pass targeted eslint. Existing package-lock.json diff left unstaged.
Task/PRD: completed GitHub issue #7; related runtime seam from #4; no separate PRD referenced.

Key decisions: added a late-event-safe STT wrapper that gates adapter callbacks by capture generation, cancels stop-during-start stale completions, and restarts a fresh adapter generation on resume; buildProvider now wraps Web Speech and Deepgram while preserving current startup failures.

Files changed: src/stt/lifecycle-safe-provider.ts, src/stt/lifecycle-safe-provider.test.ts, src/stt/build-provider.ts, src/stt/build-provider.test.ts.

Notes: npm run typecheck and npm run test pass. npm run lint remains blocked by pre-existing src/storage/app-data.ts max-lines; pre-existing package-lock.json libc metadata diff left unstaged.
Task/PRD: completed GitHub issue #11; related voice capture seam from #7; no separate PRD referenced.

Key decisions: kept DeepgramProvider as the public buildProvider/session seam, moved browser MediaRecorder/WebSocket streaming and native chunk upload flows into internal adapters, and split lifecycle coverage by platform.

Files changed: src/stt/deepgram.ts, src/stt/deepgram-browser.ts, src/stt/deepgram-native.ts, src/stt/deepgram-shared.ts, and Deepgram adapter tests.

Notes: npm run typecheck and npm run test pass. Existing package-lock.json libc metadata diff left unstaged.
Task/PRD: completed GitHub issue #10; no separate PRD referenced; related blockers #8/#5/#2 were already closed.

Key decisions: added shared entity ingestion for markdown/text/json normalization; kept MarkdownProvider as a thin wrapper; routed FileUploadProvider through ingestion with invalid JSON fallback.

Files changed: src/entities/ingestion.ts, src/entities/ingestion.test.ts, src/entities/providers/markdown.ts, src/entities/providers/file-upload.ts, src/entities/providers/file-upload.test.ts.

Notes: npm run typecheck, npm run test, and targeted eslint pass; web export succeeded but Playwright entity e2e is blocked by missing Chromium; pre-existing package-lock diff left unstaged.
Merged issue #10 shared world data ingestion for uploads and issue #11 Deepgram browser/native capture adapter split. Verified after each merge with npm run typecheck and npm run test.
Task/PRD: completed GitHub issue #12; references shared ingestion issue #10; no separate PRD.

Key decisions: kept Google Docs as the fetch/export source adapter, extracted export URL/text helpers, routed fetched text directly through shared ingestMarkdownContent, and preserved browser proxy/native direct URL plus CORS failure behavior.

Files changed: src/entities/providers/google-docs.ts; src/entities/providers/google-docs.test.ts.

Notes: npm run typecheck, npm run test, and targeted eslint pass. Existing package-lock.json libc metadata diff left unstaged.
Merged issue #12 migration of Google Docs through shared world data ingestion. Verified with npm run typecheck and npm run test.
@justinpbarnett justinpbarnett merged commit 944237e into main Apr 27, 2026
3 checks passed
@justinpbarnett justinpbarnett deleted the sandcastle/integrated-runtime-settings-ingestion-refactor branch April 27, 2026 18:19
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