You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5937f58
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(state): type the day camera-usage helpers under strict TS
Converts state/cameraUsage.js to strict .ts (behavior-preserving). Public functions
(inferredCameraKeys / referencedCameraKeys / resolveDayCameraUsage → Camera[] /
findCameraAffectedDays) and the cameraKey helper are typed; raw animal/day inputs stay
`unknown` (permissive, per the shape-safe-boundary convention).
- Reads the day collections through the typed selectors (getDayTasks /
getDayAssociatedVideos / getDayFsGuiYamls) instead of inline
`Array.isArray(day?.x) ? day.x : []` — behavior-equivalent (the selectors ARE that
guard) and removes raw `day?.x` access under the `unknown` input.
- task.camera_id is widened back to `unknown` (`const cameraId: unknown = task?.camera_id`)
so the stray-scalar tolerance stays live per the type, not just at runtime.
- Two small documented reads remain: FsGuiYaml's interface omits `camera_id` (a
pre-existing type gap; that field is read tolerantly via a cast), and
`refs.has(cameraKey(...) as string)` preserves the exact `has(null) → false` runtime
behavior without adding a redundant null branch.
No .ts consumers (workspaceUtils/CamerasContainer/CamerasUsedSection are JS), so the
rename is transparent. Verified: typecheck clean, cameraUsage suite (20) + golden
baselines (145) byte-identical, full suite 4793, CI=true build clean, e2e 104.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .claude/docs/research/architecture-assessment.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ or enforced tokens** (F6), and **deferred lint debt that weakens the build gate*
36
36
37
37
| Gap | Evidence | Why it bites refactoring |
38
38
| --- | --- | --- |
39
-
| **No static types** ⏳ PARTIAL | Incremental TS underway (`tsc --noEmit` CI gate live): `io/yaml.ts`, `state/workspaceTypes.ts` + the task-catalog modules, `domain/deviceOverrideMerge.ts`, and the Phase-9a validation leaf modules (`repairRouting`/`geometryProvenance`/`dayOverrideValidation`/`stepStatus`) are `.ts` under `strict`; the **entire `validation/` directory** (leaf predicates + `rules/*` families + `rulesValidation` composer + `index`/`schemaValidation`/`rawShape`/`quickChecks`/`useQuickChecks` + the shared `issueTypes.ts`) is now `.ts` under `strict`; the `state/` migration is underway — the persistence layer (`state/workspaceMigrations.ts` + `state/persistence.ts`) the canonical read layer (`state/workspaceSelectors.ts`, `unknown`-in / typed-container-out), and a first selector-consumer (`state/configDiff.ts`) are `.ts`. Remaining: most of `state/` (`workspaceUtils`/`workspaceTransitions`/`workspaceActions`/…) + `domain/`, most components, `useWorkspace`, and the legacy form path stay JS (`checkJs:false`) | Rename a domain fn or change an `Animal`/`Day` shape → **silent until a test happens to exercise it.** No safe IDE rename, no null-safety. Tooling agent scored type-safety **2/10** (improving as the pure core converts). |
39
+
| **No static types** ⏳ PARTIAL | Incremental TS underway (`tsc --noEmit` CI gate live): `io/yaml.ts`, `state/workspaceTypes.ts` + the task-catalog modules, `domain/deviceOverrideMerge.ts`, and the Phase-9a validation leaf modules (`repairRouting`/`geometryProvenance`/`dayOverrideValidation`/`stepStatus`) are `.ts` under `strict`; the **entire `validation/` directory** (leaf predicates + `rules/*` families + `rulesValidation` composer + `index`/`schemaValidation`/`rawShape`/`quickChecks`/`useQuickChecks` + the shared `issueTypes.ts`) is now `.ts` under `strict`; the `state/` migration is underway — the persistence layer (`state/workspaceMigrations.ts` + `state/persistence.ts`) the canonical read layer (`state/workspaceSelectors.ts`, `unknown`-in / typed-container-out), and the first selector-consumers (`state/configDiff.ts`, `state/cameraUsage.ts`) are `.ts`. Remaining: most of `state/` (`workspaceUtils`/`workspaceTransitions`/`workspaceActions`/…) + `domain/`, most components, `useWorkspace`, and the legacy form path stay JS (`checkJs:false`) | Rename a domain fn or change an `Animal`/`Day` shape → **silent until a test happens to exercise it.** No safe IDE rename, no null-safety. Tooling agent scored type-safety **2/10** (improving as the pure core converts). |
40
40
| **Oversized files/components** ⏳ PARTIAL | ~~`domain/validation.js` 1142~~ ✅ split (Phase 9a) into routing/provenance/producers/composer/step-status modules · ~~`validation/rulesValidation.js` 1108~~ ✅ split into `validation/rules/*` families (reference / opto / channelMap / electrodeGroup / dandiSubject / identity / behavioralEvent) + a 96-LOC composer · `valueList.js` 1073 · ~~`ValidationSummary/index.jsx` 1033~~ ✅ decomposed (Phase 9c-1) into rows-helpers / batch-action hook / ExportReport / BatchExportPreflight / DayStatusTable (index now 306) · ~~`DevicesStep.jsx` 825~~ ✅ decomposed (Phase 9c-3) into CamerasUsedSection / OverrideCleanupSection / ConfigVersionPanel / ElectrodeGroupsAccordion (step now 424) · `OptogeneticsFields.jsx` 826 · ~~`RecordingDaysTab.jsx` 822~~ ✅ decomposed (Phase 9c-2) into AnimalSetupCard / ExistingDataReview / DayList / DuplicateDayModal (tab now 496) · ~~`useWorkspace.js` 851~~ ✅ split into `workspaceActions` (createWorkspaceActions factory) / `useWorkspacePersistence` (status + autosave + saveNow) / `workspaceHydration` (resolveInitialWorkspace) + a pure `getAnimalDays` in `workspaceSelectors` (hook now 98) | High intrinsic load to change; many concerns per file; merge-conflict magnets. |
41
41
|**~2,000 LOC legacy dead-weight**|`OptogeneticsFields.jsx` (826, imported only by `LegacyFormView`), `element/*`, `*Fields`, `LegacyFormView.jsx` — parallel to the workspace path | Every workspace UX/styling change risks needing a legacy twin; or the legacy code rots unmaintained. |
42
42
|**CSS: no scoping, partial tokens** (= F6) | Global CSS, `.button-primary` redefined in 6 files, two different error icons, ~60% token adoption, mixed `.css`/`.scss`| Visual inconsistency *and* fragile edits — changing a shared style can leak across components. |
0 commit comments