"failed"
store.ErrIncompatible now maps to the code "incompatible", and the test that
proves it sends a real establish frame over a real connection and reads the code off the
Failure frame that comes back. A table test that only reads the table would have agreed
with itself.
Measured while closing it, and worth recording because it is the same shape as the mistake this backlog keeps finding: the table had 22 entries, not 21. This page said 21, the brief that commissioned the fix said 21, and the report that delivered it said 22 in one paragraph and 21 in another. The number was counted directly at the end: 22 before, 23 after. A figure that has been copied is a figure that is no longer being measured.
establish (frame 14) calls store.Declare, which is the only place
ErrIncompatible is raised — on a changed primary key, a changed partition, a rollup
re-sent with a different shape, or an index that keeps its name and changes its fields.
Declare (frame 13) calls store.DeclareOperation instead, whose validation
raises ErrDeclaration and never this. Redeclaring an operation under an existing name
writes a new version rather than conflicting, so there is no incompatible-redeclaration
concept for an operation at all. That is asserted by a test that redeclares and checks the version
incremented, rather than left as a sentence in a comment.
codeFor maps errors to the code a client receives. store.ErrIncompatible was
not one of them, so the refusal
this does not match what was declared before: the primary key of "notes" was declared …
reached the caller as "failed", indistinguishable from a disk error, a closed database, or
any other mishap. Of all the refusals this server makes it is the one most purely about a
declaration, and it was the one that arrived with no name.
SAPE-14 put it within reach. Before that, ErrIncompatible could
only be raised offline, inside sapedb apply, where a human reads the
sentence and understands it. SAPE-14 sent it down the establish frame, where a
program has to switch on a code. The error did not change; the audience
did.
Not because the bug was heavy. Because codeFor is a public surface and 1.0.0
freezes it. Ship with this reading as "failed" and clients write handling branches keyed
on "failed" — at which point giving the error its real code breaks
them. Adding it before the tag is an addition. Adding it after is a change.
The desktop workbench had a test asserting this refusal's code was "failed", with a
comment saying it would go red the day the server gave the error a name. It did, printing exactly
that:
the refusal's code is "incompatible", want "failed"
That is a tripwire working, not a regression. Pinning a value you expect to change is how you get told
when it changes; the alternative is a comment that quietly stops being true. The assertion has been
flipped — "failed" coming back now fails the test, because it would mean the entry had
been lost again.
Only the primary-key branch of ErrIncompatible is measured reaching the wire. The
partition, rollup and index branches wrap the same sentinel, so codeFor treats them
identically, but nothing measures that the frame carries those specifically.