Skip to content

Refactor FS access to bounded-context repositories#145

Open
danielbdyer wants to merge 1 commit into
mainfrom
codex/refactor-file-access-to-use-repositories
Open

Refactor FS access to bounded-context repositories#145
danielbdyer wants to merge 1 commit into
mainfrom
codex/refactor-file-access-to-use-repositories

Conversation

@danielbdyer
Copy link
Copy Markdown
Owner

Motivation

  • Reduce broad path+FS coupling by introducing context-specific repository contracts for intent, knowledge, control, resolution, execution, and governance so application code depends on narrow persistence ports instead of raw file operations.
  • Keep a single canonical filesystem implementation/export and deprecate duplicate barrel usage to centralize filesystem behavior and error mapping.

Description

  • Added repository ports and Effect tags in lib/application/ports.ts for IntentRepository, KnowledgeRepository, ControlRepository, ResolutionTaskRepository, ExecutionRepository, and GovernanceRepository and their contracts.
  • Implemented local adapters in lib/infrastructure/repositories/local-context-repositories.ts that encapsulate path resolution and (de)serialization (YAML for knowledge, JSON for tasks/runs) while delegating I/O to the canonical lib/infrastructure/fs/local-fs.ts FS adapter.
  • Wired repository services into the local service composition and layers (lib/composition/local-services.ts, lib/composition/layers.ts) so repositories are provided alongside the FileSystem service.
  • Migrated application flows to repositories: buildInterpretationSurfaceProjection/task projection now uses ResolutionTaskRepository, applyDriftEvents uses KnowledgeRepository, and run persistence uses ExecutionRepository.writeRunArtifacts(...) (lib/application/task.ts, lib/application/drift.ts, lib/application/run.ts).
  • Removed the duplicate FS barrel lib/infrastructure/local-fs.ts so lib/infrastructure/fs/local-fs.ts is the single canonical export, and added focused repository contract tests in tests/repository-contracts.spec.ts.

Testing

  • Ran npm run build and confirmed the build completed successfully.
  • Ran the focused repository contract suite with npx playwright test tests/repository-contracts.spec.ts and all tests passed (3 passed).
  • Note: npm run typecheck surfaced pre-existing repository-wide diagnostics unrelated to this change; those are baseline issues (typecheck report at .tesseract/reports/typecheck-report.json) and did not block the targeted build/tests above.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant