Skip to content

#877 phase 3a: bulk-accept org kinds; accepted_source; v0.83.1 - #905

Merged
gregoryfoster merged 7 commits into
mainfrom
feat/877-phase-3a-bulk-accept
Nov 27, 2026
Merged

gregoryfoster merged 7 commits into
mainfrom
feat/877-phase-3a-bulk-accept

Conversation

@gregoryfoster

Copy link
Copy Markdown
Member

#877 phase 3a: bulk accept for org kinds. Plan: docs/plans/2026-11-27-877-phase-3-backlog.md (approved 2026-11-27); design D7 is amended in this PR.

What it adds

  • classification_suggestions.accepted_source (rules / jev): required on every accept row and on no other. The Kind panel's provenance reads it instead of the note. A backfill fills existing accept rows from record_decision's note before the CHECK goes on; production has one such row, and it matches.

  • TRUSTED_JEV_KINDS, keyed by model: jev-1.14.0 → association, business, government, legislature (the approved trust set). A model not listed is trusted for nothing.

  • bulk_outcome / plan_bulk_accept / run_bulk_accept:

    • accepts a rules kind by definition (decision C), unless Jev answers anything else;
    • accepts a Jev kind at or above the threshold on a trusted kind;
    • queues everything else with a reason: disagree, conflict, low, untrusted, none or unanswered.

    It plans and accepts under the drain lock. Every acceptance goes through record_decision, whose new untouched_only check (under the org's row lock) leaves alone any org an operator has acted on.

  • scripts/accept_classification_suggestions.py --field org_kind --operator EMAIL:

    • Dry run (default): counts by kind and source, queue reasons, the Jev backlog, and the skim list (rules acceptances outside legislature, with gold labels; names in the terminal only).
    • --execute: refuses while Jev's backlog is nonzero (unless --allow-unanswered) or while a drain holds the lock.
  • v0.83.1 (schema change); runbook, SCHEMA.md and design D7 updated.

Review

CR with --fix: six findings, one commit each:

  • CR 2: plan and accept under the drain lock;
  • CR 3: a backfill test, mutation-checked;
  • CR 4: QUEUE_REASONS comes from the type;
  • CR 5: a run quiets the per-decision INFO lines;
  • CR 6: --field reaches the run;
  • CR 1 (the client's uv.lock entry) was already in the feature commit.

Tests were written first, and each failed before its code existed: 11 for accepted_source, then collection errors for the bulk-accept core and the script, and 2 for the drain lock.

Verification

  • Unit tier: 4,161 passed, 59 skipped.
  • Targeted integration (classification, bulk accept, drain, drainer, schema, both scripts, gold, Kind panel, merge, dashboard): 130 passed.
  • apply-schema --test run twice, clean.

After deploy (operator-gated)

Once Jev's backlog reads 0: a dry run, with aggregates posted on #877; then --execute on the operator's word.

🤖 Generated with Claude Code

gregoryfoster and others added 7 commits November 27, 2026 18:36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…an accept's source; v0.83.1

- classification_suggestions.accepted_source (rules / jev), required on every
  accept and on no other row; backfilled from record_decision's note
- TRUSTED_JEV_KINDS keyed by model (the gold set's approved trust set)
- bulk_outcome / plan_bulk_accept / apply_bulk_accept; record_decision's
  untouched_only refuses an org an operator has acted on, under its row lock
- scripts/accept_classification_suggestions.py: dry run by default; skim list;
  --execute refuses while Jev's backlog is nonzero unless --allow-unanswered
- design D7 amended; runbook and SCHEMA.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A drain's rules or Jev write landing between the plan and an acceptance
could make a disagreement the plan never saw. run_bulk_accept takes
DRAIN_LOCK_KEY for both; the script refuses while a drain holds it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gregoryfoster
gregoryfoster merged commit 0289a87 into main Nov 27, 2026
1 check passed
@gregoryfoster
gregoryfoster deleted the feat/877-phase-3a-bulk-accept branch November 27, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant