Skip to content

An operation remembers the slot it was about, even when it changed nothing - #156

Closed
AliceLafox wants to merge 7 commits into
fix/history-row-badgesfrom
feat/operation-subject
Closed

AliceLafox wants to merge 7 commits into
fix/history-row-badgesfrom
feat/operation-subject

Conversation

@AliceLafox

Copy link
Copy Markdown
Member

Closes #144. Stacked on #151 (fix/history-row-badges); the base moves to main once #151 is merged.

A normalize that found the slot already at target wrote nothing, so the history had no slot for it: no badge, invisible to the slot filter and to the slot's own tab. The operation knew its slot; there was just no place to say so other than "changed this slot".

  • Schema v8: op_subjects (op, slot), apart from slot_changes, so a subject can never look restorable or become an Undo target with something to put back. Old stores migrate with every row intact.
  • Recording: recorded() names the job's slot when the operation opens (a swap names both, a clear its slot, a window restore every restored slot); maintenance operations and the first-sighting snapshot record none, and the store refuses a subject on them or on an operation that is not pending.
  • Reading: the History window's badges are the union of touched and subject slots; what a restore acts on stays the touched slots. The slot's tab lists the operations that were about it: a done one that recorded nothing says "nothing changed"; a failed or interrupted one carries its state and its reason, and a switch with no recorded after-body no longer claims a position.
  • Forgetting a slot: a subject alone moves no Undo boundary and holds nothing; an operation that loses its last state on the cleared slot is dropped whole, subjects included; the dialog counts "cuts Undo" and "pinned" only for what the slot actually held.

Noted for a follow-up issue, pre-existing: an operation that changed nothing is still the Undo cursor's target (refused with "nothing to put back"), so the operations before it cannot be reached with Cmd-Z until it is skipped.

Tests: history_schema_tests 95, history_store_tests 128, history_recorder_tests 140, card_rows_tests 98, slot_rows_tests 99, forget_slot_tests 194, undo_tests 123, undo_run_tests 151 (the swap/rename/restore/clear scenario, with and without subjects, same Undo and floor), clear_confirmation_tests 262. Non-GUI ctest 58/58; the six GUI harnesses 6/6 locally.

A normalize that finds its slot already at target writes nothing, so it
had no slot_changes row and the history had no slot for it: no badge, no
place in the slot filter, nothing in the slot's own tab (#144). The
operation knew its slot all along.

Store version 8 adds op_subjects: the slots an operation was about,
written down when it begins. Kept apart from slot_changes on purpose: a
body-less row there would look like a state to restore. A subject names
no state, so it is never offered by Restore and never makes an Undo plan
possible; it is a badge, and a line in the slot's timeline, flagged
subjectOnly there so it is never read as the state the slot is in.

Forgetting a slot takes its subjects with it: an operation nothing is
left of goes whole; one still about another slot keeps its row for that
slot's badge without moving the Undo boundary, since no state survives
in it to be offered half-forgotten; and the plan's entry count is what
the slot's tab listed. Maintenance records no subject: clearing a slot's
history must not write the slot back into it.
A card row's badges are the union of the slots an operation touched and
the slots it was about, ascending, each once: a swap about the two slots
it changed wears two, not four. A subject brings no take, so Play, Export
and Restore are what they were.

In the slot's own tab the newest state is the last row that recorded
one. A row that only names the slot, the normalize that found nothing to
do, reads its own line, offers nothing, never says "in the slot now",
and leaves the row before it as the state the slot is in. A row that
names the slot and still carries a state is refused as not the store's.

Undo is proven unchanged: the cursor reads kinds and outcomes, and the
plan refuses an operation with nothing to put back by name, subject or
not.
recorded() writes the job's slot down as the operation's subject right
after begin, before the card is touched, so an operation that then
changes nothing keeps its slot in the history. The swap job names one
slot for its busy row and is about both, so its call site adds the
other. Maintenance and the first-seen snapshot do not go through
recorded() and record no subject.
… holds nothing

Clearing the history of a slot whose one entry was a no-op normalize, the
newest operation, warned that Undo would no longer reach past this point
and asked for the protected-entries confirmation - and then moved no
boundary and changed nothing about Undo. The plan counted every operation
the slot named as a boundary and every cursor target as a hold.

Both now follow what forgetting really takes out of an operation. The
boundary moves for an operation that loses a state here and still stands
afterwards - a state elsewhere, a setting, or another slot's badge -
since what is left of it must never be offered as the whole. An
operation forgotten whole moves nothing, and one that was only about this
slot keeps its row and its undo exactly as they were: its name comes off
the slot, nothing else. An Undo target is a hold only when it loses a
state here. forgetSlot decides by the same three facts, read before the
rows go.

The store also refuses a subject on a first sighting, on maintenance and
on any operation that is not pending: the recorder refused these already,
and the store is where the line holds. And the card's timeline reads
every operation's subjects through one prepared statement, like its other
columns.
…ver recorded

The slot's tab read a failed or interrupted operation as something that
happened: a tempo refused as out of range showed "Tempo", a push that
could not read its source "Pushed", and a One Shot ON attempt that
failed "One Shot off" - the switch position of a body that was never
written. The window beside it said "failed". Only the window carried a
state, and the words for a switch invented a position without a body.

A slot's row now carries the same state words the card's rows wear -
failed, interrupted, still running, recorded on the pedal - from one
function both views read, and the pane paints the state in the window's
place and colour. A row that did not finish carries its reason where its
numbers would be: what it recorded on the way is not what the slot came
to hold. One Shot and Play Count-In say on or off only from the body the
operation left; without one they name the switch. And a finished
operation that was about the slot with no word for what it did there
says "nothing changed" rather than reading like a rename or a tempo
change.
…art from what a restore acts on

Two recorded jobs with a slot wrote no subject: Clear opens its operation
by hand, and a window restore of several slots names none on the job. The
clear now names its slot, and the restore every slot it puts back - the
same slots the job's description counts.

The window's rows were fed one slot list for two jobs: the badges, which
are every slot the row is about, and what "Restore this state" acts on,
which is only the slots the row recorded. A row touching two slots and
about three would have said "Restore 4 slots". The badges read the union
and the restore the touched slots.

recorded() names each slot once: a job naming its own slot again must
reach the core's refusal, not the store's "already a subject".
…bjects and all

An operation that lost its last state on the cleared slot and was still
about another slot stayed as a half-forgotten boundary. Reachable with
real commands: swap 12 and 43, rename 12 away and back, rename 43,
"Restore this state" of the swap from the window - it changes only 43,
being about both - then clear slot 43. The restore survived on its subject
alone, the boundary moved to it, and Undo of slot 12's rename was gone,
where without subjects it was on offer.

By the branch's own principle a subject is not a surviving state. Such an
operation now goes whole, the slots it was still about included: the row
the other slot loses said "nothing changed", which is not what a boundary
guards. The boundary moves only for an operation that loses a state here
and keeps one elsewhere, in a slot or in the settings. An operation that
never had a state and is still about another slot keeps standing for
that slot's badge, as before.

A pinned operation that loses only its badge on the cleared slot is no
longer listed as protected: its row, its state and its pin all stay. It
is listed when the slot held a state of it, or when it goes whole.

The scenario above runs twice in undo_run_tests, with the subjects the
app records and with them deleted, and must end with the same Undo on
offer and the same boundary.
@AliceLafox

Copy link
Copy Markdown
Member Author

Landed in main through #160 (merge commit d7cccff), which carries this PR's own merge commit; GitHub refuses to retarget a head that main already contains, so closing by hand.

@AliceLafox AliceLafox closed this Oct 18, 2026
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