Repository navigation
feat: publish v1 SQL contract, stable read views, and writable-table contract (CR3) - #17
Merged
Merged
Conversation
Add generated spec/sql migrations and contract metadata, stable sql_v1_* read views, schema drift verification, and CR3 progress tracking. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Michael Whitham <mwhitham@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Initialization and transaction guidance need corrections so direct clients create valid files and preserve correct state.
3 open findings
What changed in this PR
Implements CR3 by publishing Athletic Standard’s v1 SQL contract for direct SQLite clients, building on CR1–CR2 enforcement.
Changes:
- Publishes generated SQL migrations and writable-table guidance.
- Adds five stable read views.
- Adds contract generation, drift checks, and integration tests.
| File | Description |
|---|---|
| tests/v1-sql-contract.test.ts | Tests SQL contract compatibility and enforcement. |
| src/db/sql-contract.ts | Defines public contract metadata and transaction recipes. |
| src/db/migrations/read-views.ts | Defines five stable read views. |
| src/db/migrations/001-initial.ts | Installs read views with the schema. |
| spec/sql/README.md | Documents direct-client requirements. |
| spec/sql/migrations/001-initial.sql | Publishes the generated SQL migration. |
| spec/sql/contract.json | Publishes machine-readable contract metadata. |
| scripts/generate-sql-contract.ts | Generates contract artifacts. |
| scripts/check-schema-drift.ts | Checks artifact freshness and schema parity. |
| scripts/check-public-data.ts | Updates the approved synthetic fixture hash. |
| package.json | Adds generation and drift-check commands. |
| build-history/v1.0.0/progress.md | Marks CR3 complete. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Document per-transaction defer_foreign_keys, child collection replacement, and application_id initialization. Extend drift checks and contract tests. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Michael Whitham <mwhitham@users.noreply.github.com>
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.


Implements CR3 from the contribution-readiness plan (step after merged PR #16 / CR1–CR2).
What changed
spec/sql/migrations/001-initial.sqlis generated from the TypeScript migration source (pnpm generate:sql-contract).sql_v1_database_info,sql_v1_current_records,sql_v1_active_records,sql_v1_record_revisions, andsql_v1_record_deletionsare created during schema install.spec/sql/contract.jsonandspec/sql/README.mddocument stable writable tables, internal tables, required pragmas, migration rules, and transaction recipes (D125).pnpm check:schema-driftandtests/v1-sql-contract.test.tsverify generated files stay fresh and thatcreateDatabase()matches asqlite3-applied migration.build-history/v1.0.0/progress.mdmarks CR3 done.Out of scope (CR4):
ath migrate, interactive migration prompts, and backup flows are not part of this PR.Verification