kernel: real SqliteMetadataStore — SQLAlchemy models for all entities + initial migration - #74
Merged
Merged
Conversation
…ration 001 Replaces the bootstrap stub (engine + empty MetaData) with the persistence floor every M1 service sits on: tables for all fourteen entities, a mapping layer that keeps SQLAlchemy out of every domain and port signature, a unit of work scoped to one Project-aggregate operation, and a forward-only migration mechanism gated by the workspace format_version.
This was referenced Jul 26, 2026
JArmandoAnaya
added a commit
that referenced
this pull request
Aug 21, 2026
…ration 001 (#74) Replaces the bootstrap stub (engine + empty MetaData) with the persistence floor every M1 service sits on: tables for all fourteen entities, a mapping layer that keeps SQLAlchemy out of every domain and port signature, a unit of work scoped to one Project-aggregate operation, and a forward-only migration mechanism gated by the workspace format_version.
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.
Replaces the bootstrap stub (engine + empty
MetaData) with the persistence floor every M1 service sits on.What landed
adapters/_tables.py, private) — flat columns where the model is flat; child tables forbatch_assetandannotation_job_asset; JSON for the immutable nested values (annotation_schema.classes,annotation.geometry,release.manifest).adapters/_mappers.py, private) — oneEntityMappingper entity, so no SQLAlchemy type reaches a domain or port signature.adapters/__init__still exports onlySqliteMetadataStore.Repository[T]plus aUnitOfWork, instead of ~50 per-entity methods. Every child entity has exactly one parent FK, solist(parent_id=...)covers every scoped read.adapters/migrations.py) — an orderedMIGRATIONSlist withFORMAT_VERSIONderived from it.initialize()runs what is missing and refuses a workspace stamped ahead of this build.with store.unit_of_work() as uow:commits on clean exit, rolls back on any exception.kernel/errors.py—VisionSetErrorand the three errors this layer raises.DatasetMember/DatasetChangedomain models (shapes only; the rules are kernel: DatasetService — promotion from completed batches, mutation change log #11's).docs/persistence.md.Decisions
format_versionwould then duplicatealembic_version.classes/geometry/manifestas JSON, membership/progress as child tables — immutable values that rehydrate whole vs. relations edited one row at a time.DATETIMEstorage drops the timezone; naive datetimes are rejected at construction.PRAGMA foreign_keys = ONper connection — SQLite ships with foreign keys off, so every FK here would otherwise be decorative. There is a test that fails without the listener.Scope: persistence only. No services, no state machines, no name-uniqueness rules — those are #4–#12.
Gates
uv run pytestuv run ruff check ./ruff format --check .uv run mypy src/visionset/kerneluv run mypy src/visionsetuv run lint-importsscripts/export_openapi.pyCloses #3