A library write that fails after a partial change is recorded as refused before any change #23

Closed
opened 2026-10-13 21:39:40 -04:00 by vinny · 0 comments
Owner

Found while syncing the flight plan editor (#5).

What happens. The tester's tool convention is that a write error()s before it changes anything. But several multi-step tools also error() when CMO refuses a later step after earlier steps took:

  • areas.create_reference_points: "CMO refused point N" after points 1..N-1 were made;
  • the reference-point tools' altitude/depth steps;
  • missions.edit_flight_plan: "CMO refused edit N … the edits before it were made".

RuntimePort._library_write maps every unanswered Lua (an error()) to {'ok': False, 'submitted': False}. The coordinator then records the action as rejected / game_precondition_rejected, with the text "CMO-side preconditions rejected the operation before a setter was invoked". It releases the reservations and runs no read-back.

Effect. A partial game effect is reported as no effect. The ledger, the General and the evidence importer all believe nothing changed, and the units are free for new orders while the half-applied change stands.

Reproduce (synthetic). In the made-up game, make ScenEdit_AddReferencePoint fail on the second point of a three-point areas.create_reference_points. The action is rejected with the "before a setter was invoked" text, but point 1 exists.

Possible fixes.

  1. Tester side: after the first change, a tool returns a result with the refusal (for example refused_at, a note and expect for what was asked) instead of error(), so the read-back decides. This needs changes in the tester's tools.
  2. CMOnet side: for library writes, an error() whose text says earlier steps were made (or any error() from a multi-step tool) becomes outcome_unknown, keeping the reservations and asking for reconciliation (a read-back) instead of rejected.

Option 1 keeps the read-back as the judge; option 2 is a safe stopgap.

Found while syncing the flight plan editor (#5). **What happens.** The tester's tool convention is that a write `error()`s before it changes anything. But several multi-step tools also `error()` when CMO refuses a later step after earlier steps took: - `areas.create_reference_points`: "CMO refused point N" after points 1..N-1 were made; - the reference-point tools' altitude/depth steps; - `missions.edit_flight_plan`: "CMO refused edit N … the edits before it were made". `RuntimePort._library_write` maps every unanswered Lua (an `error()`) to `{'ok': False, 'submitted': False}`. The coordinator then records the action as `rejected` / `game_precondition_rejected`, with the text "CMO-side preconditions rejected the operation before a setter was invoked". It releases the reservations and runs no read-back. **Effect.** A partial game effect is reported as no effect. The ledger, the General and the evidence importer all believe nothing changed, and the units are free for new orders while the half-applied change stands. **Reproduce (synthetic).** In the made-up game, make `ScenEdit_AddReferencePoint` fail on the second point of a three-point `areas.create_reference_points`. The action is `rejected` with the "before a setter was invoked" text, but point 1 exists. **Possible fixes.** 1. Tester side: after the first change, a tool returns a result with the refusal (for example `refused_at`, a note and `expect` for what was asked) instead of `error()`, so the read-back decides. This needs changes in the tester's tools. 2. CMOnet side: for library writes, an `error()` whose text says earlier steps were made (or any `error()` from a multi-step tool) becomes `outcome_unknown`, keeping the reservations and asking for reconciliation (a read-back) instead of `rejected`. Option 1 keeps the read-back as the judge; option 2 is a safe stopgap.
vinny closed this issue 2026-10-16 12:39:54 -04:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
vinny/CMOnet#23
No description provided.