Declare FKs on the remaining plain-Integer references (handoffs.created_by, dispatches.received_handoff_id/created_handoff_id) #471
Labels
No labels
P0
P1
P2
P3
bug
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#471
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Slice
Declare the three remaining plain-Integer references in
plugins/os-sdlc/lib/os_sdlc/runner/db.rbas foreign keys and bumpSCHEMA_VERSIONfrom 18 to 19.Acceptance criteria
handoffstable is created, thencreated_byis declared witht.foreign_key :created_by, :agents(replacingt.Integerat line 260).dispatchestable is created, thenreceived_handoff_idandcreated_handoff_idare declared witht.foreign_key ..., :handoffs(replacingt.Integerat lines 295–296).SCHEMA_VERSIONis 19.recreate, whenPRAGMA foreign_key_listis queried onhandoffsanddispatches, then all three FKs are present.Non-goals
Notes for implementer
t.foreign_key :implementation_id, :implementations).created_byFK is part of the decided contract), ADR-0129 (disposable DB, SCHEMA_VERSION bump), ADR-0155 (stale-schema wipe refuses while an implementation is in flight — the bump takes effect at the next idle load).Context
The #457 contract-auditor pass verified the D04 scope but noted three references still plain Integer while siblings gained FKs: handoffs.created_by → agents (joined in handoff.rb:17), dispatches.received_handoff_id / created_handoff_id → handoffs (db.rb:201-202; now 260 and 295–296 at current HEAD). Enforcement is globally on since #457, so this is a schema-only change plus SCHEMA_VERSION bump.
Skeptic verdict: CREATE — deliberate D04 scope boundary, real named gap with a stated fix path, root ticket itself.
Origin
Related: #457 (FK enforcement), #473 / ADR-0155 (wipe guard).
Body corrected 2026-08-23 from code-probe verification (agent a7c06ed2d895621b1, claude-sonnet-5).
Change log:
Reason: pure line-drift from later edits to db.rb; the described gap (both columns remain plain Integer with no foreign_key declaration) is confirmed unchanged.
Refined to ticket tier during triage: added Slice, Acceptance criteria, Non-goals, and implementer notes; verified the gap at current HEAD (db.rb lines 260, 295–296; SCHEMA_VERSION 18) and linked governing ADRs 0129, 0135, 0155. No open decisions, so no decision children.
Work started on branch worktree-ticket-471 via the os-sdlc pipeline.
Resolution
Done: Declared FKs on handoffs.created_by -> agents and dispatches.received_handoff_id/created_handoff_id -> handoffs; bumped SCHEMA_VERSION to 19.
Evidence: Branch worktree-ticket-471 commit
728e8d2via os-sdlc pipeline (implementation 1, all gates green). Suite: 1221 runs, 0 failures; 3 new orphan-rejection tests in db_foreign_key_test.rb. Conforms to ADR-0129/0135/0155.Follow-ups: none