fix(ci): address PR #139 review — 5 issues + source list sync
1. decisions_sync.py: fix refs_created inflation (check rowcount), remove dead IntegrityError except block 2. Extract SCHEMA_VERSION to shared tooling/schema_version.py — both generators import from single source of truth 3. generate_atlas.py: narrow bare except to OperationalError + "duplicate column" check 4. check-systems-db-stamp: add cross-generator schema_version agreement assertion (defense-in-depth) 5. decision wrapper: add show + orphan-tickets to usage text 6. Add schema_version.py to all three source watch lists (GENERATOR_SOURCES, IMPORT_ECONOMICS_SOURCES, generate_atlas _write_stamp) — prevents silent staleness on version bump Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+6
-4
@@ -1,8 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# Decision ID management — claim, query, and validate decision IDs.
|
||||
# Usage:
|
||||
# decision next [D|Q|R] Show next available ID
|
||||
# decision claim <D|Q|R> <domain> [title] Claim next ID (reserves in DB)
|
||||
# decision check-dupes Check for duplicate IDs in markdown
|
||||
# decision sync Sync markdown -> DB
|
||||
# decision sync Sync decisions/*.md into SQLite
|
||||
# decision show <D-NNN> Show a decision with linked tickets + refs
|
||||
# decision next [D|Q|R] Show next available ID
|
||||
# decision claim <D|Q|R> <domain> [title] Claim next ID (reserves in DB)
|
||||
# decision check-dupes Check for duplicate IDs in markdown
|
||||
# decision orphan-tickets List tickets with invalid/missing decision_ref
|
||||
exec python3 "$(dirname "$0")/decisions_sync.py" "$@"
|
||||
|
||||
@@ -310,16 +310,14 @@ def sync(cfg):
|
||||
)
|
||||
continue
|
||||
|
||||
try:
|
||||
conn.execute(
|
||||
"""INSERT OR IGNORE INTO decision_refs
|
||||
(source_id, target_id, ref_type, note)
|
||||
VALUES (?, ?, ?, ?)""",
|
||||
(d["id"], target_id, ref_type, note),
|
||||
)
|
||||
cur = conn.execute(
|
||||
"""INSERT OR IGNORE INTO decision_refs
|
||||
(source_id, target_id, ref_type, note)
|
||||
VALUES (?, ?, ?, ?)""",
|
||||
(d["id"], target_id, ref_type, note),
|
||||
)
|
||||
if cur.rowcount > 0:
|
||||
refs_created += 1
|
||||
except sqlite3.IntegrityError:
|
||||
pass # duplicate ref, skip
|
||||
|
||||
conn.commit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user