Repository navigation
fix(transducer): resume from the WAL without losing or duplicating a save - #2871
Conversation
…save After a crash, wrap could neither confirm the saves made before the restart (the values it would look for were in memory) nor stop the fresh session from saving them again: the WAL skips a repeated commit only once it is VERIFIED, and pre-crash commits are still pending. A live control on a web EMR (save, kill, redo the item) ended with two records and a VERIFIED receipt (#2869). Each commit now stores the field-bound values it saved in its WAL summary. On resume they are rebuilt; once they reappear on a saved screen of the pinned record, the commit is marked verified and the agent is told the record already exists. A commit whose form carries exactly the values of an earlier commit (including an unconfirmed one from before the restart) is refused with a hint to check first, and a second attempt hands the item to a person. The done gate never verifies when two commits carry identical values. A navigation click ends the form a commit saves, so a search query on the way is not part of it. Fixes #2869.
Independent adversarial review: REQUEST CHANGESFrom: Grok I reviewed this exact head. I am not approving, and I will not merge or push. This PR is stacked on #2867. I reviewed this PR's own WAL-resume and duplicate-save delta. Blocker
What holds
Generality gate
Tests I ran
CI at this headThe review-verdict check is red because there was no Grok or Codex review on protected paths; the package jobs were skipped as a result. A few independent checks (gitleaks, dependency-review, smoke, install weight, launcher run-ci) were green on later stack heads. I am not merging. Limitations, not blockersRestore only runs when |
…repeats the task names The same values on another record, or a second identical entry the task asks for, are not duplicates. A commit now records whether its screen showed the pinned record. The refusal and the done rule compare only commits on the pinned record, and allow as many identical commits as the instruction names that content (its longest value). Without a pinned identity nothing is refused. The in-session form latch follows the same rule for repeats the task names.
…, not the fields typed since the last click Review (Grok) found that any non-commit click cleared the set of fields a save submits, so a click inside the form (a date picker, the next field) dropped earlier fields from the save. A resumed duplicate then went through, and the typed-values gate could miss a dropped value. A draft field now belongs to a save when it is still on screen when the save is clicked and, when the read-back provider reports a container (frame or form), sits in the save control's container. Clicks no longer matter. A search box in another container is still left out. Tests cover a click inside the form before a crash and redo, typing A, clicking B and typing B, and a search box in another container.
|
Response to the Grok review at 8bce1e3. Fixed at 75f97fa. Blocker: any non-commit click cleared
Clicks inside the form (a date picker, the next field) no longer matter. A search box in another container is still left out. New tests:
Also since your review (d44cb10):
Live controls (real OpenEMR 8.0.0.3, scripted agent, integration build The limitations you listed stand. Re-review requested at 75f97fa. |
… a pre-crash commit goes to a person With no pinned identity the duplicate refusal could not be scoped to a record and refused nothing, so a crash-then-redo duplicate could get through. When a session resumed from the WAL is about to save exactly the values of a commit from before the restart and no record identity is pinned, wrap now abstains (RESUME_DUPLICATE_UNCERTAIN) and hands the item to a person instead of saving.
|
Added 1cc4cbf: with no pinned record identity, a session resumed from the WAL that is about to save exactly the values of a commit from before the restart now abstains ( |
Independent adversarial review: APPROVEFrom: Grok I re-reviewed this exact head. The blocker I raised at Behavior
The cases that failed on the old head now have tests and pass on this one:
Happy-path WAL resume, I ran Limitation, not a blocker for this head
CI at this head: packages scope, packages-gate, install weight, launcher run-ci, smoke, dependency-review, validate-platform-manifest and gitleaks passed. |
…sume-no-duplicate # Conflicts: # tests/test_transducer_v3_runtime.py
Independent adversarial review: APPROVEFrom: Grok I re-reviewed this exact head (R2 after my APPROVE at What changed since
|
Fixes #2869. Stacked on #2867, because it reuses its field-bound saved writes.
Problem
After a crash,
openadapt.wrapcould not confirm saves made before the restart: the values it looks for were held in memory. It also did not stop the fresh session from saving them again. The WAL skips a repeated commit only once that commit isVERIFIED, and pre-crash commits are stillPENDING_EFFECT.A live control on a web EMR (synthetic data) shows the effect: save, kill the process, then a fresh session redoes the item. It ended with two records and a
VERIFIEDreceipt, a false VERIFIED.Change
field_writes) in its WAL summary.COMMIT_ALREADY_SAVED.DUPLICATE_SAVEhint to check first. This includes an unconfirmed commit from before the restart. A second attempt hands the item to a person.Within one process, the existing in-memory form latch already blocked an identical re-save. This PR covers the restart.
Integration note
After a restart, the read-back provider should treat the new session's start as the time of the last save, which happened in the dead process. A form loaded in the new session, after a screen without it, then counts as reopened.
Evidence (live controls, real OpenEMR 8.0.0.3, scripted agent, arm B's exact read-back path)
Tests
test_commit_persists_the_values_it_savedtest_restart_confirms_the_pre_crash_save_on_screentest_restart_refuses_to_save_the_same_values_againtest_identical_re_save_in_one_session_is_not_releasedtest_same_values_on_two_records_both_verifytest_task_that_names_two_identical_entries_verifiesNo app names in engine code.