Open identity commands on an existing database only #184

Merged
weichen merged 3 commits from feature/d1-identity-open into main 2026-10-12 15:05:05 +00:00
Owner

Why: identity ensure/verify must not create or migrate a database.

Evidence: go test of identity, store, and unknown-subcommand cases passed locally (SELF).

Impact: version --json publishes the capability document, including schema.target and schema.compatFloor.

Refs: recovery plan r3.1 D1/D2

Why: identity ensure/verify must not create or migrate a database. Evidence: go test of identity, store, and unknown-subcommand cases passed locally (SELF). Impact: version --json publishes the capability document, including schema.target and schema.compatFloor. Refs: recovery plan r3.1 D1/D2
weichen added 2 commits 2026-10-12 14:45:19 +00:00
Why: identity ensure/verify went through the normal store open, which
creates a database and runs migrations. A deploy gate that calls the
candidate before stopping the old service could migrate production
ahead of the switch, and a missing database was turned into an empty one.
Evidence: go test ./pkg/identity/ ./internal/store/ ./cmd/agent-system/ -run 'TestCapabilities|TestEnsure|TestVerify|TestDSN|TestUsage|TestSystemIdentity|TestOpenIdentity|TestUnknownSubcommand' passed in this worktree.
Impact: identity CLI refuses a missing file or a missing agent_system_identity table, does not migrate, reads DSN from the environment or a 0600 file, and version --json plus identity capabilities emit one capability document. Unknown top-level commands exit 2.
Refs: recovery plan r3.1 D1; Dev feature/svc-d1-identity-flow

Co-authored-by: Cursor <cursoragent@cursor.com>
Publish schema target and compatibility floor
ci / vet-and-test (pull_request) Successful in 47s
5c26a86331
Why: a rollback can only be safe when the candidate says which schema it
will migrate to and whether older binaries can still read that schema.
A new migration that forgets to register that fact must fail the test.
Evidence: go test ./internal/store/ ./pkg/identity/ -run 'TestMigrationCompat|TestCapabilities' passed.
Impact: version --json and identity capabilities include schema.target and
schema.compatFloor. Every migration version is listed in
migrationBreaksOldReaders. Current versions do not break old readers, so
the floor stays 0.
Refs: recovery plan r3.1 D2

Co-authored-by: Cursor <cursoragent@cursor.com>
weichen added 1 commit 2026-10-12 14:56:00 +00:00
Merge origin/main into feature/d1-identity-open
ci / vet-and-test (pull_request) Successful in 57s
0f192a4813
Why: main gained AGENT_SYSTEM_DSN fallback in #182 after this branch
was cut. Both changes touch identity DSN parsing.
Evidence: go test ./pkg/identity/ ./internal/store/ ./cmd/agent-system/ for the identity, schema, and unknown-subcommand cases passed after the resolution.
Impact: keeps open-existing identity mode and the 0600 dsn file. Environment
DSN still wins when --dsn is absent, via ResolveDSN.
Refs: Backend #182; recovery plan r3.1 D1

Co-authored-by: Cursor <cursoragent@cursor.com>
weichen merged commit c6fb13016a into main 2026-10-12 15:05:05 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Backend#184