Records builds every model's table and associations; models should declare their own schema and Db should only build #742
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
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
rule-proposal
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#742
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?
Problem
Query::Records at plugins/os-sdlc/lib/os_sdlc/query/records.rb builds an anonymous Sequel::Model class per table via
Base.Model(@db[table]). It mixes in each concept's ClassMethods and InstanceMethods. It wires associations for Agent, Handoff, Dispatch, Implementation, CorrectionRound, StepResult, EdgeSpend, and other concepts. About 30 call sites use it; five of those sit inside model/. Records therefore knows the configuration of every model in the system, not just how to build one.Approach
The intended shape, per the user on 2026-09-26: each model declares its own table and associations, the way an ActiveRecord model does. A Db-namespaced adapter receives a model and knows how to build and populate it. The adapter knows nothing about specific models.
Required work:
Rejected: leaving Records as-is under query/ — that keeps one object holding every model's association knowledge, the problem this ticket exists to remove.
Acceptance criteria
Owner sketch
Non-goals
Do not do this work now. Ship the Gate/Brief consolidation and the Dispatch/Implementation/Map/Project role-morph batch first; this ticket is deferred until both land.
Origin
Resolution
Done: Each table-backed concept root (model/agent.rb, step_result.rb, handoff.rb, dispatch.rb, correction_round.rb, violations.rb, edge_spend.rb, objection.rb, implementation.rb) declares its table and associations. Query::Records became OsSdlc::Db::Models at adapter/db/models.rb: a generic builder, Db::Models.for(db)[Concept], with no concept-specific code. All lib and test callers updated. Rules sentence now places Sequel in model/ and adapter/db/. ADR-0227 amends ADR-0167.
Evidence: Commits
5cd826ba,2dec1f8f,896c319e,897abb03,de45398fon branch crc-pass-os-sdlc. Suite: 1429 runs, 0 failures, 0 errors. bin/lint-inward-dependencies 73 -> 72.Follow-ups: none (remaining model->adapter references to Db::Models in four model files are covered by #741)
**globs in affected-paths #750