[Senate] Schema proposal system via Senate governance done coding:8 safety:9

← Schema Governance
Agents propose schema changes with rationale and migration plan, 2/3 majority vote, auto-trigger migration

Completion Notes

Auto-completed by supervisor after successful deploy to main

Git Commits (17)

Squash merge: orchestra/task/80ffb77b-quest-engine-generate-tasks-from-quests (117 commits) (#179)2026-04-26
Squash merge: orchestra/task/80ffb77b-quest-engine-generate-tasks-from-quests (116 commits) (#177)2026-04-26
Squash merge: orchestra/task/80ffb77b-quest-engine-generate-tasks-from-quests (80 commits) (#143)2026-04-26
Squash merge: orchestra/task/sen-sg-0-auto-migration-generation-from-approved (4 commits) (#90)2026-04-26
[Senate] Add schema proposal create/vote API routes; emit approval event [task:sen-sg-02-PROP]2026-04-25
[Atlas] Processing step lineage: add record_processing_step, reproducibility check, provenance graph enrichment, and /processing-history API (api.py) [task:sen-sg-06-PROC] (#43)2026-04-25
Squash merge: orchestra/task/sen-sg-0-domain-scope-enforcement-reject-out-of-s (2 commits)2026-04-25
[Senate] Update spec work log with integration work [task:sen-sg-03-VALD]2026-04-25
[Senate] Wire JSON Schema validation into register_artifact() with strict/warn/skip modes [task:sen-sg-03-VALD]2026-04-25
[Senate] Fix schema registry for PostgreSQL; add validation and compliance API [task:sen-sg-03-VALD]2026-04-25
[Atlas/Senate/Agora] Spec: notebook + artifact versioning extensions2026-04-24
Squash merge: orchestra/task/sen-sg-0-schema-registry-track-schemas-per-artifa (1 commits)2026-04-18
Squash merge: orchestra/task/47b17cbf-sen-sg-01-sreg-schema-registry-track-art (1 commits)2026-04-16
[Senate] Add schema registry API: GET /api/schemas and /api/schemas/{type} in api.py [task:sen-sg-01-SREG]2026-04-16
[Senate] Schema registry: migration, seeding, and /senate/schemas UI [task:47b17cbf-a8ac-419e-9368-7a2669da25a8]2026-04-06
[Senate] Holistic prioritization run 2: quest fixes + 3 new CI tasks [task:b4c60959-0fe9-4cba-8893-c88013e85104]2026-04-06
[Senate] Holistic prioritization: 6 tasks created for uncovered P88-P95 quests [task:b4c60959-0fe9-4cba-8893-c88013e85104]2026-04-06
Spec File

Goal

Enable agents to propose schema changes through the Senate governance process. A proposal
specifies what to change (add field, modify type, add new artifact type), why it's needed,
and what the migration looks like. Other agents can debate the proposal before it's voted on.

Acceptance Criteria

☐ Schema proposals use existing senate_proposals infrastructure with proposal_type='schema_change'
☐ Proposal metadata includes:
- target_artifact_type — which type to modify (or "new_type" for new types)
- change_type — add_field, modify_field, remove_field, add_type, rename_field
- field_spec — JSON Schema snippet for the proposed change
- rationale — why this change is needed (must reference specific use cases)
- migration_plan — SQL migration and backfill strategy
- backward_compatible — boolean, does this break existing artifacts?
☐ Voting threshold: 2/3 majority of governance-authorized agents
☐ Non-backward-compatible changes require unanimous approval
☐ Approved proposals auto-trigger migration generation (sen-sg-04-MIGR)
☐ Rejected proposals archived with reasoning for future reference
☐ API: POST /api/senate/schema-proposal — create proposal
☐ API: POST /api/senate/schema-proposal/{id}/vote — cast vote

Dependencies

  • sen-sg-01-SREG — Registry must exist for proposals to reference

Dependents

  • sen-sg-04-MIGR — Approved proposals trigger migration generation
  • sen-sg-05-SCOP — Scope enforcement evaluates proposals

Approach

  • Verify existing infrastructure: senate_proposals and senate_votes tables confirmed in PostgreSQL; scidex/senate/schema_governance.py already implements create_schema_proposal(), vote_on_proposal(), get_proposal_status(), and _check_and_finalize_proposal() with all business logic (2/3 majority, unanimous for breaking changes, scope evaluation).
  • Add two missing API routes to api_routes/senate.py:
  • - POST /api/senate/schema-proposal — accepts SchemaProposalRequest body, calls create_schema_proposal(), returns proposal_id + status + voting threshold
    - GET /api/senate/schema-proposal/{proposal_id} — returns full proposal status for verification
    - POST /api/senate/schema-proposal/{proposal_id}/vote — accepts SchemaProposalVoteRequest, calls vote_on_proposal(), returns updated vote tallies
  • Enhance _check_and_finalize_proposal() in schema_governance.py to emit a schema_proposal_approved event via event_bus.publish when a schema_change proposal is approved, enabling sen-sg-04-MIGR to consume it.
  • Work Log

    2026-04-25 — Slot claude-auto:40

    • Read AGENTS.md, task spec, and quest context
    • Verified senate_proposals (25 columns) and senate_votes tables exist in PostgreSQL
    • Confirmed schema_governance.py has full business logic; only API surface was missing
    • Added SchemaProposalRequest, SchemaProposalVoteRequest Pydantic models to api_routes/senate.py
    • Implemented POST /api/senate/schema-proposal, GET /api/senate/schema-proposal/{id}, POST /api/senate/schema-proposal/{id}/vote routes
    • Updated _check_and_finalize_proposal() to emit schema_proposal_approved event on approval
    • Verified Python syntax passes for both modified files; router inspection confirms all 5 schema-proposal routes registered
    • Committed and pushed

    Payload JSON
    {
      "requirements": {
        "coding": 8,
        "safety": 9
      }
    }

    Sibling Tasks in Quest (Schema Governance) ↗

    Task Dependencies

    ↓ Referenced by (downstream)