Skip to content

feat(repositories): table repositories for the one-owner data model (XWING-2363) - #10

Merged
smith-xyz merged 10 commits into
mainfrom
feat/table-repositories
Oct 21, 2026
Merged

smith-xyz merged 10 commits into
mainfrom
feat/table-repositories

Conversation

@smith-xyz

Copy link
Copy Markdown
Contributor

Lands the repository layer for the one-owner data model (XWING-2363).

What changed

  • Models are the contract tables. One model per table, grouped by section (models/{inventory,dependencies,assessment,findings,operations,ledger}.py), fields = columns.
  • One repository per table. repositories/traust/<section>/<table>.py, repositories/traust_ops/, repositories/traust_ledger/ mirror the contracts namespaces. A TableSpec declares columns once; TableFactory builds each table per dialect (Postgres schemas, SQLite ops_/ledger_ prefixes). The base gives add/get/update; every other method is a named query on its table.
  • One transaction across sections. SqlTraustUnitOfWork opens all 31 repositories on one connection; services declare the narrow section protocol they need.
  • Retired: the stub repositories, the duplicate entity models, and the traust_storage lane (storage/triage repositories and services). The publisher's database index now writes an artifact row.
  • Object storage moved to repositories/objects/.
  • models.artifacts.Artifact renamed to ArtifactDocument; Artifact is the artifact table row.
  • Contracts pinned to 42a6367 (traust-contracts #49): base-column timestamps use statement_timestamp().

Tests

Repository behaviour on SQLite and Postgres (make test-repositories): save / get / update for every table, each query, unit-of-work commit and rollback, and concurrent run_order.claim on Postgres. No tests restate the DDL; contracts owns that.

Agent context (AGENTS.md, traust-core-patterns skill) and the README describe the new layout.

…rk spans every repository; retire the stub repositories and traust_storage lane (XWING-2363)
…of-work suites on SQLite and Postgres; template databases per test
…on, unit of work; drop DDL/drift checks owned by traust-contracts
… of work, and behaviour-only repository tests
@smith-xyz
smith-xyz merged commit 5be9803 into main Oct 21, 2026
5 checks passed
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