Skip to content

shell: an offer's gesture waits for that offer's own number - #683

Closed
napkinstack-agent[bot] wants to merge 2 commits into
mainfrom
shell/e2e-gesture-waits-for-its-notification
Closed

napkinstack-agent[bot] wants to merge 2 commits into
mainfrom
shell/e2e-gesture-waits-for-its-notification

Conversation

@napkinstack-agent

@napkinstack-agent napkinstack-agent Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

shell: an offer's gesture waits for that offer's own number

Module

modules/shell, exactly one: scripts/e2e.sh, the test harness alone. No product code changes.

  • This pull request touches a single module

Deliverable

Out of cycle: a flaky e2e check, seen by #682's verifier (session wh-verify-d83e, round 2): in one run of six, the trial's record gesture reached nothing — FAIL test 0 -ge 1 (no window) and FAIL grep -q shell.recording_refused —, the log holding no refusal at all. A flaky check teaches to ignore a red e2e (tests.md).

What it changes

sequenceDiagram
    participant K as Kitokey
    participant D as The desktop's notifications
    participant E as e2e.sh
    K->>D: Notify « pw-cat utilise votre micro » (serial N)
    Note over E: offered: the call is counted
    D-->>K: method return, reply_serial N: number 41
    Note over E: gesture: waits for the return to serial N, then presses 41
    E->>K: ActionInvoked(41, "record")
Loading

Legend — the D-Bus messages of an offer; notified and answered are the two dbus-monitor the e2e already runs.

The cause. offered counts the offer when Kitokey asks for it (notified); gesture pressed the last number in answered, the desktop's answers, written a moment later. Pressed between the two, the gesture went to the previous offer's number — or, in the trial's scenario, where answered starts empty, to no number at all.

The fix. gesture finds the last offer's call in notified (its sender and serial), waits up to 5 s for the desktop's return to that very call (destination = the sender, reply_serial = the serial), and presses its number. Synchronised on the event, never on a duration (tests.md, flaky).

Oracle

  • Seen failing: the verifier's run (e2e-unread_as_nfs.out, D83 — shell: the licence read at each start is said in the log #682's remarks).
  • The matching tried on a sample of dbus-monitor's lines: no return yet → waits, then presses nothing; a return to another client with the same serial → ignored; the right return → its number.
  • It passes now: bash scripts/e2e.sh at 4286813, e2e: passed, the four gestures (record, later, never, the trial's record) ok.

Kind of oracle: the e2e itself. A race is not reproduced on demand: the fix removes the window in which it happened.

Review budget

  • Within budget: 1 file, 21 lines.

Test sheet

Verifier: session wh-verify-683

# Given · when · then Kind Result Evidence Commit Confirmed
T1 Given the e2e's offer scenario (S) and the trial's refusal, when it runs, then each gesture — record, later, never, the trial's record — reaches the offer it is meant for: a recording given, nothing more, offer = false kept, the refusal logged and the window opened automated passed bash scripts/e2e.sh from the verifier's own worktree and build cache, at 4286813: e2e: passed, exit 0, 1253 ok and 0 FAIL; in S: offered 1, test -s sessions/given, offered 3, test ! -e sessions/given, offered 4, grep -q ^offer = false, the four shell.offer_* logged, trial: offered 5, test ! -e sessions/given, test 1 -ge 1 (window), shell.recording_refused — all ok; log audit: 0 warning or error not provoked. Mutant run once in the e2e (the gesture presses the previous offer's number, the old race made certain): e2e: FAILED, 13 FAIL, all in S, the trial's among them FAIL test 0 -ge 1 and FAIL grep -q shell.recording_refused — killed 4286813
T2 Given dbus-monitor lines where the offer's answer is not yet written, or written for another client with the same serial, when a gesture is pressed, then it waits for the offer's own answer and presses its number, never an older one automated passed gesture() taken verbatim from e2e.sh, gdbus emit replaced by an echo, run on hand-made dbus-monitor lines (format checked against a real dbus-monitor on a private bus): 17/17 — own return pressed; previous offer's answer only → nothing pressed after ~5 s; answer appended 1.5 s late → pressed; header and number written apart → pressed; same serial for another client → skipped; destination :1.5 vs :1.50, dots taken literally; reply_serial 7 vs 70 and 17, 70 vs 7; two offers with answers out of order → the last offer's; a reminder after the offer, the desktop's relayed call, no offer at all → nothing pressed. Mutants on it: 6 killed, 0 survived (old tail -1, no destination match, no $ anchor, no wait, no ours filter, first offer instead of last) 4286813
T3 Given the change, when it is read, then it touches scripts/e2e.sh alone, and nothing of what the e2e checks is loosened automated passed git diff --name-only origin/main...4286813: modules/shell/scripts/e2e.sh alone, one commit; check lines 134 before and after, failed=1 4 before and after; no check, is or failure line in the diff — only gesture()'s body 4286813

Verifier's remarks: a gesture that finds no number (no offer, or no answer within 5 s) still emits ActionInvoked with the string "uint32 " (seen on a private bus: gdbus exits 0, sends a mis-typed signal) — harmless, the next checks fail, but the gesture itself says nothing of why; the trial's failure in the verifier's mutant run is a cascade from the first gesture, so the old race's exact window (answer not yet written at the trial) is pinned by T2's isolated test, not reproduced in the e2e.

Summary

DONE

  • scripts/e2e.sh: a gesture waits for the desktop's answer to its offer's own call.

VERIFIED

ASSUMED

  • The desktop answers each Notify with one uint32 (the specification's).

NOT VERIFIED

  • That the race is gone for good: only runs over time say it.

RISKS

  • A desktop that never answers an offer now waits 5 s before failing, as before it failed at once.

🤖 Generated with Claude Code

The e2e pressed the last notification number the desktop had answered. The
offer is counted when Kitokey asks for it, its number answered a moment
later: once, the record gesture went to no number and the trial's refusal
was never asked (seen by the verifier of #682). A gesture now waits for the
desktop's answer to the offer's own call, matched by its serial.

Agent-Session: wh-gesture
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@napkinstack-agent napkinstack-agent Bot added the out-of-cycle Work outside the current cycle: an incident, a production defect; justified in the PR label Nov 6, 2026
@napkinstack-agent

Copy link
Copy Markdown
Contributor Author

Closed as superseded by #785, which carries this change (an offer's gesture waits for that offer's own number) on current main. Thank you; the work continues there.

@napkinstack-agent

Copy link
Copy Markdown
Contributor Author

Superseded by #785, merged in d94338f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

out-of-cycle Work outside the current cycle: an incident, a production defect; justified in the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants