fix: dispatch guard and Defect-safe rollback (#32)
A readable intent that fails in handling now always gets exactly one ack: the new static internal code, unless the handler's own ack was already enqueued. Both transaction helpers roll back on every unwind path, Defect included, so the shared SQLite connection never keeps an open transaction. Test-only dispfault build covers catchable/defect/after-ack; DESIGN 6.5 records internal as an owner decision and 6.2 names refusal codes as additive.
This commit is contained in:
@@ -75,6 +75,9 @@ same numbering.
|
||||
playtest, minimum zoom 0.5, walls statuses accepted, slow-client close superseded by stop-feed +
|
||||
resync, and the DESIGN split note) in 1, 4.3, 5.10, 6.1, 7.4, 13, 14
|
||||
|
||||
- v0.31 records #32 (the dispatch guard: the `internal` refusal code and unconditional rollback on
|
||||
every unwind path) in 4.2, 6.2, 6.5, 14
|
||||
|
||||
All of Q1-Q24 are RESOLVED or DEFERRED; none OPEN.
|
||||
|
||||
## B. HANDOFF traceability (old DESIGN §12)
|
||||
@@ -844,6 +847,14 @@ recovery**; only nginx proxy timeouts close a dead peer (4.3). See 1, 4.3, 5.5,
|
||||
|
||||
<!-- END old section 14 -->
|
||||
|
||||
## E. Owner decisions after the split
|
||||
|
||||
Owner also decided 2026-11-20 [FIXED (owner-delegated, 2026-11-20, #32)]: a readable intent that
|
||||
fails in handling is answered `ack {ok:false, code:"internal"}`, with no detail, and the transaction
|
||||
helpers roll back on every unwind path (`Defect` included) so the shared connection stays usable. If
|
||||
the handler's own ack was already enqueued, it stands and no second ack is appended. `internal` is
|
||||
additive in proto 2. A `Defect` is bounded damage, not a restart policy. See current 4.2, 6.2, 6.5.
|
||||
|
||||
## D. Superseded statements removed from the current spec
|
||||
|
||||
Each entry quotes the superseded statement (excerpt) and names the surviving rule.
|
||||
|
||||
+12
-2
@@ -402,7 +402,9 @@ Invariants (carry from prototype):
|
||||
relative to other messages is flush order, not mutation order.
|
||||
- Ack after COMMIT (a client never sees a state that a crash can undo, except under
|
||||
`synchronous=NORMAL` power loss, 4.4).
|
||||
- A failed validation mutates nothing, bumps nothing, persists nothing.
|
||||
- A failed validation mutates nothing, bumps nothing, persists nothing. A mutation that raises
|
||||
after its transaction began rolls back on every unwind path, `Defect` included, so the shared
|
||||
connection never keeps an open transaction (6.5 step 10, #32).
|
||||
- Refusals never echo state: only a refused move of a controlled token acks with its old position
|
||||
(uniform nack, 5.5); every other refusal is an `ack` with a static `code` and no position (6.5).
|
||||
Each intent gets exactly one `ack` (6).
|
||||
@@ -1710,7 +1712,8 @@ view), so deletion and moving away look identical to the player.
|
||||
- Within one proto version: additive only (new optional fields, new message types). The client
|
||||
ignores unknown server message types and unknown fields; the server ignores unknown fields in
|
||||
intents and answers an unknown `t` with `ack {ok:false, code:"unknown-type"}` (or `error
|
||||
{code:"malformed"}` if there is no `reqId`).
|
||||
{code:"malformed"}` if there is no `reqId`). A new static refusal code is additive too: a client
|
||||
that does not know it treats it as a generic refusal (`internal`, 6.5, is the first, #32).
|
||||
- Breaking change -> bump `proto`, document in `docs/` changelog.
|
||||
- **Proto history.** `1` (M3, 2026-11-15): 29 intents, 15 server messages, `wall` records as `kind`
|
||||
+ `open` + `flags`. `2` (#49, 2026-11-17): the wall record's typed fields (`thickness`,
|
||||
@@ -1788,6 +1791,12 @@ on any failure.
|
||||
8. Target lookup. Player senders: a target that is not theirs or does not exist is one and the same
|
||||
`not-allowed` (no existence oracle, T9). GM senders: missing target -> `not-found`.
|
||||
9. Semantic validation (GM: `invalid`; player move: the uniform nack, 5.5).
|
||||
10. Handling raises after step 4 (any unwind path, `Defect` included): `ack internal`, unless the
|
||||
handler's own ack for that `reqId` was already enqueued, in which case that ack stands and no
|
||||
second one is appended [FIXED (owner-delegated), 2026-11-20, #32]. The failure is logged once with
|
||||
the intent, `reqId` and error class; no payload, name, key, session or SQL text. A `Defect` does
|
||||
not require a restart in v1: the transaction helpers roll back on every unwind path, so the shared
|
||||
connection stays usable.
|
||||
|
||||
**Ack codes (static strings, never carry state).**
|
||||
|
||||
@@ -1802,6 +1811,7 @@ on any failure.
|
||||
| `cap-reached` | `key.create` would exceed 6 players (3.2) |
|
||||
| `in-use` | `character.remove` while a token links the character |
|
||||
| `no-rules` | `act.do` (reserved, 9) |
|
||||
| `internal` | the server failed while handling a readable intent; nothing was applied [FIXED (owner-delegated), 2026-11-20, #32] |
|
||||
|
||||
Player name text: trimmed, NFC, 1 to 32 code points, no control characters. Deviation [FIXED
|
||||
(owner-delegated), #23]: Nim 2.2.12's stdlib has no Unicode normalisation (it lives in a package the
|
||||
|
||||
Reference in New Issue
Block a user