Skip to content

Both languages honour the same spellings of TS_STORAGE_BACKEND - #1348

Merged
bjmeetsfo merged 1 commit into
mainfrom
both-languages-honour-the-same-backend-spellings
Sep 8, 2026
Merged

Both languages honour the same spellings of TS_STORAGE_BACKEND#1348
bjmeetsfo merged 1 commit into
mainfrom
both-languages-honour-the-same-backend-spellings

Conversation

@bjmeetsfo

Copy link
Copy Markdown
Collaborator

resolve_backend says of itself:

Mirrors StorageBackendConfig::resolve_decision: raft is forced; matrixobject is forced when
compiled; shared is forced only when a directory is configured …

Nothing checked that it does. The engine accepts ten spellings across three backends, and the
plan carries its own copy of all ten:

matrixobject | matrix_object | object
shared | shared_path | shared_store | path
raft | raft_replication | replication

A spelling one side honours and the other does not is invisible from the outside. An unrecognised
request does not fail — it falls through to auto-detection, which resolve_backend's own
docstring calls out as "from the outside … indistinguishable from having been honoured". The
plan is what tells an operator which backend a deployment will get; the engine is what they
actually get.

The same shape already cost a production incident on the neighbouring rule: TS_META_ADDR=local
was a sentinel to one implementation and a literal socket address to another, and every write on
a one-box failed. That pair is now guarded by #1343.

The comparison is an equality, in both directions

Driving the plan with every rust spelling only shows that python honours everything rust does. It
can never show a spelling python still advertises after rust dropped it — and that is the
direction where the plan promises a forced backend the engine quietly sends to auto-detection. So
both sets are parsed and compared for equality, with the driven check kept alongside, so the
parse cannot agree while the behaviour differs.

Also pinned: normalisation on both sides (rust value.trim().to_ascii_lowercase(), python
_clean(...).lower(), so " MatrixObject " is honoured by both), and the fall-through — an
unknown value must land where no request lands.

It discriminates

perturbation result
object removed from the rust list FAILED
path removed from the python list FAILED
.trim().to_ascii_lowercase() removed FAILED
restored OK

One correspondence is hand-written and cannot be derived: the rust variant names
(MatrixObject, SharedPath, Raft) and the strings the plan reports are spelled differently.
Exhaustiveness is asserted, so a new variant fails this file rather than being skipped by it.

A note on getting there — my first version asserted that an unknown request comes back
honoured=False. That was wrong about the code, not a finding: honoured answers "did you get
the backend you asked for"
, so an absent request is trivially honoured. The check now compares
against what no request at all produces.

No production code changes.

🤖 Generated with Claude Code

resolve_backend says of itself that it "Mirrors StorageBackendConfig::resolve_decision", and
nothing checked that it does. The engine accepts ten spellings across three backends and the plan
carries its own copy of all ten.

A spelling one side honours and the other does not is invisible from the outside: an unrecognised
request does not fail, it falls through to auto-detection, which the docstring itself calls
indistinguishable from having been honoured. The plan is what tells an operator which backend a
deployment will get; the engine is what they actually get.

The comparison is an EQUALITY, in both directions. Driving the plan with every rust spelling only
shows that python honours everything rust does - it can never show a spelling python still
advertises after rust dropped it, which is the direction that leaves the plan promising a forced
backend the engine sends to auto. Both sets are parsed and compared, and the driven check is kept
alongside so the parse cannot pass while the behaviour differs.

Also pins the normalisation on both sides and the fall-through to Auto. Verified to fail on a
spelling removed from the rust list, on a spelling removed from the python list, and on the
trim-and-lowercase being dropped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@bjmeetsfo
bjmeetsfo merged commit 796535d into main Sep 8, 2026
7 checks passed
@bjmeetsfo
bjmeetsfo deleted the both-languages-honour-the-same-backend-spellings branch September 8, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants