Skip to content

Tag by repeat: override a listed unit from the row's tags, confirmed by the user - #376

Draft
guijacquemet wants to merge 6 commits into
mainfrom
claude/per-unit-override
Draft

guijacquemet wants to merge 6 commits into
mainfrom
claude/per-unit-override

Conversation

@guijacquemet

@guijacquemet guijacquemet commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Owner requirement

A unit (condition / biological repeat / technical repeat) whose image headers disagree with its repeat's row is listed. From the listed unit the user can override that unit, starting from the row's tags (prefilled), with header disagreements highlighted, so that only what is different is changed. The unit counts as tagged only after the user confirms. Channels are never guessed and no unit is counted without confirmation.

Owner decision (22 Nov): a refused unit is never counted until the user confirms THAT unit; a listed unit with the same header names as a confirmed one offers one-click confirmation.

Design

  • repeat_tags.py (pure): Override(tags, names) and override_holds(override, layout, tags): the confirmation holds while the unit's tags and its own header names are unchanged (the names are read before the save). Later aliases neither void nor replace it. repeat_fill(..., frozen=) reads an already refused unit against the aliases of its refusal.
  • notebook_channels_repeat.py: Refusal.channels is the labels/aliases snapshot at the first refusal. contradictions() (one rule, differences, on that snapshot) is used by reconcile(), so a refusal keeps its text and is never dropped because another unit's aliases were saved. standing() returns the refused units whose refusal still stands. apply() keeps the first snapshot, so re-clicking the row does not fill a refused unit either. _row_error / _commit_user are shared.
  • Alias guard: notebook_channels_matrix.trust_headers (the only caller of trusted() with the grid) leaves out RepeatRows.standing(). Fast mode's trust of headers for every other unit, and hand-tagging, are unchanged. A refusal clears only by the unit's removal, by a change of the images' headers that resolves it (as before), or by confirming that unit.
  • notebook_channels_override.py: highlights and refusal text come from Refusal.channels (the editor keeps its orange boxes). _confirm() is the one path (validate all, one _commit_user, record Override from the unit's header names) for Confirm these tags, Confirm the same tags and Confirm all N like it (offered when several listed units share the headers; all or none). The one-click sentence is "same headers as , which you confirmed as "; it is offered only when every header name is present, the confirmation still holds, and the confirmed units with those names agree on the tags.
  • A click on a strict-mode grid block still tags every unit shown in that block (existing behaviour); split a unit out of its block to tag it alone.

Tests

tests/test_notebook_tag_by_repeat_oneclick.py (9 tests, new) and the override tests: fast mode GONE confirmed (editor or by hand) then re-check: OTHER stays listed, untagged, grid incomplete, save refused, row re-click does not fill it; one-click counts OTHER with the confirmed tags and saves; confirm all with three units; confirm-all refused with none confirmed (validation and failed save); strict mode OTHER keeps its header-detail text and highlights; a refused unit whose own header changes to match its row still clears through the row; non-refused behaviour unchanged. 8 of the 9 new tests fail on 2bffeb5 (the 9th, the header-change regression guard, passes on both). Focused run (test_notebook_tag_by_repeat*.py, matrix, shadow, untick, dataset, test_notebook_channels*.py): 139 passed, none skipped. tools/check.py --rules and ruff pass. The full tools/check.py was not run.

Review fixes (893264d)

  • Renamed or removed label (notebook_channels_override.py): the editor opens a cell whose label is gone blank (_known), also when the label changes while the editor is open; the one-click offer already skipped tags that are no longer labels. Before, the dropdown raised and every later redraw raised too.
  • Kept across sessions: refusals (unit, the row's tags, reference unit, aliases at the first refusal) and confirmations (tags, own header names) are in the draft file as the optional tag_review (repeat_review.py, pure; read and written in draft_format.py; docs/contract.md section 18). Draft version stays 4, a draft without it opens as before, an empty review writes nothing, and a malformed section is refused with the file, never dropped. RepeatRows.restore runs on the first opening, before trust_headers; reconcile then runs as usual. RepeatRows.persist saves it after a row click, a confirmation and a reconcile, only when it changed.
  • standing() reads the row's current reference unit, as reconcile does (shared _placed).
  • Confirm all N buttons keep the order of the listed units.
  • Docs: a unit tagged by hand counts but is not a source of "Confirm the same tags" (user guide, changelog).

Tests: tests/test_notebook_tag_by_repeat_review.py and tests/test_draft_tag_review.py (new). All but the one-click label guard and the draft-format cases that need the new module fail on 4bdb64e. Focused run (tag-by-repeat, matrix, shadow, untick, channels, dataset, all draft tests and the notebook draft readers): 510 passed. tools/check.py --rules and ruff pass; the full tools/check.py was not run.

Review fixes (76ea216)

  • The review belongs to its draft: TagGrid/RepeatRows live for the whole notebook, so refusals and confirmations from folder A blocked B's saved tag_review, let trust_headers tag B's refused unit from aliases, and were written over B's file. RepeatRows now remembers the draft it holds (_NotebookStore.draft_id(): resolved experiment folder and draft file path). TagGrid.open sees another draft (other_draft()), restore drops refused/confirmed/editor/row state and reads the new draft's own review (empty without one), before trust_headers. persist never writes while memory is another draft's; listed/standing ignore it until the grid reopens.
  • Failed review save: docstring corrected (not silent, retried at the next persist); persist() returns False and the tagging grid shows "Not saved" until a later persist succeeds.
  • Stale entries test: refused unit and reference folder removed, no crash, removed unit dropped, survivor re-referenced, listed, untagged.

Tests: tests/test_notebook_tag_by_repeat_drafts.py (5 new; 4 fail on 893264d). Focused run (tag-by-repeat, channels, dataset, draft tests, matrix/shadow/untick, masks screen): 500 passed. tools/check.py --rules and ruff pass; the full tools/check.py was not run here.

Review fix (3ac71c8): output-only switch

Pointing only the output folder at another draft of the same experiment kept the grid open with the first draft's memory (the channel screen's reopening key had no draft), so the statement toggle tagged the second draft's refused unit and the save gate read an empty list. Fixes: the draft is part of the reopening key (the grid reopens and restores); MatrixView.trust_headers restores first when other_draft(); the save is refused while the memory is another draft's.

Tests: 4 new in tests/test_notebook_tag_by_repeat_drafts.py, all fail on 76ea216. Focused run (tag-by-repeat, draft tag review, channels, check-save): 138 passed. tools/check.py --rules and ruff pass; the full tools/check.py was not run.


Generated by Claude Code

…by the user

A unit whose header disagrees with its repeat's row can be overridden from the list: the
editor starts from the row's tags, highlights the header disagreements, and the unit counts
as tagged only after Confirm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scma6W3LC11s3qjXHZuGDm
Base automatically changed from claude/repeat-refusal-reconcile to main November 22, 2026 12:49
…; one-click confirm

Aliases saved by confirming or tagging another refused unit no longer clear its
refusal, tag it in fast mode, or change its highlights and refusal text: the
refusal keeps the aliases of its time (Refusal.channels), fast mode skips units
whose refusal stands (RepeatRows.standing), and a row re-click reads them
against that snapshot (repeat_fill frozen).

The confirmation record is the unit's tags and own header names, read before
the save (Override.names). A listed unit with the same header names as a
confirmed unit offers "Confirm the same tags" and, for several, "Confirm all N
like it", through the editor's own validation and save (all or none).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scma6W3LC11s3qjXHZuGDm
…ad the current reference

A refused unit counts only when that unit is confirmed, in every session:

- refusals and confirmations are kept in the draft file (optional tag_review, version still 4,
  read strictly) and restored on opening before headers are trusted, so a kernel restart no
  longer lets aliases saved for one confirmed unit tag another refused one;
- a label renamed or removed after a refusal opens the override cell blank instead of raising
  (and wedging every later redraw); one-click never offers a label that is gone;
- standing() reads the row's current reference unit, as reconcile does;
- "Confirm all N" buttons keep the order of the listed units;
- docs: a unit tagged by hand is not a source of "Confirm the same tags".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scma6W3LC11s3qjXHZuGDm
The refusals and confirmations in memory outlived the draft they came from: a notebook
pointed at another folder or output kept them, so they blocked the new draft's saved review,
tagged its refused unit from aliases and were written over its file. The review now remembers
the draft (experiment folder and draft file); another draft drops it and restores its own,
before headers are trusted, and nothing is persisted into a draft it did not come from.
A failed save of the review shows a line on the grid and is retried at the next change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scma6W3LC11s3qjXHZuGDm
…raft before

Pointing only the output folder at another draft of the same experiment kept the
channel grid open with the first draft's tag review in memory, so the statement
toggle tagged the second draft's refused unit and the save gate read an empty list.

- The channel screen's reopening key includes the draft, so the grid reopens and
  restores that draft's own record.
- trust_headers restores first when the memory is another draft's.
- The save stays refused while the memory belongs to another draft.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scma6W3LC11s3qjXHZuGDm
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.

2 participants