Repository navigation
Test a PostgreSQL Store's reach from each machine before attaching - #790
Merged
Merged
Conversation
…reach checks A PostgreSQL connection that was not made is classed once, by `ConnectionStep::of_refused_connection` (SQLSTATE class 28 is `authentication`, 3D000 `database`, anything else, no answer included, `transport`): the Store doctor's connection check emits its `store.connection.<step>` id from it, and every status or reach check's connect (`connect_status`) carries the same step in `PostgresStatusError` (`step()`; a URL the connector cannot read is `configuration`, a query after the connection the `schema`'s). No text classifier. An error the server sent is now said in the server's words (`database "x" does not exist`) instead of the driver's bare `db error`. Tests: tests/connection_step.rs (new); observed_reach's "a server that answered" check reads the server's words instead of `db error`. No test deleted. Production LOC: 213,951 -> 214,016 (delta +65) core 42,486 -> 42,486 (0) engine 98,276 -> 98,341 (+65) layerfs-persistence +65 control 62,877 -> 62,877 (0) api 10,312 -> 10,312 (0) reference absent (retired R9c; last counted 65,417 at tree 498dd19) Method: tools/production_loc.py --detail on parent a84bc2a and the staged tree Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uns; address changes check attached machines
Owner decisions 2026-11-24: the Store may be anywhere, so the UI tests
reach per machine instead of predicting it, shows the step a failure
stopped at, and a connected Store's address never changes so as to cut
off an attached machine unseen.
- Every reach refusal names its connection `step` (flat, as a `next`
field): this computer's check (`check::check`, `same_store`, the new
`first`) and a machine's (`check_from`, the worker's `store.reach`),
classified by the persistence `ConnectionStep` the doctor uses: no
schema `schema`, another Store's id `identity`, a missing privilege
`schema`, a login, database or transport refusal as the connect said
it. A refusal checked from a machine also names `machine`; the
loopback refusal (an address the machine does not share), a missing
saved login and an unreadable address are `configuration`, before any
dial. A machine whose worker was not reached names no step.
- `store.attach --dry-run`: the same checks, no lock, nothing recorded
(neither `attached` nor the reach); answers `outcome: tested`.
- `store.connect` of a connected Store is split into `prepare` (input
checks and this computer's dial) and `Update::save`. A new address,
user or password is then checked from every attached machine before
anything is saved; one that fails refuses `Conflict` with `machines`
`[{machine, ok: false, step, message}]` and the detach of the first as
its fix. A change of `synchronous_commit` alone checks no machine.
- `store.connect --dry-run` makes the same checks and saves and records
nothing: `{ok, outcome: tested, store, url, here, machines}`; a first
connect's dry run checks from this computer only and makes no schema
(`here.empty` for an empty database). A first connect now dials once
through the access check before it makes the schema, so its answer's
reach carries the server version.
- calls.json and families/store.json rows, the CLI guide words, the Node
typings and the SDK/control/2.0 docs follow.
Tests: postgres_login gains connect_refusals_and_dry_runs_name_the_step
and dry_runs_record_nothing_and_an_address_change_checks_attached_machines,
and its long-form expectation gains `here: null`; postgres_connect's
missing-database test reads step `database` and the server's words;
postgresql_url_corpus drives `prepare` + `save`. No test deleted.
Production LOC: 214,016 -> 214,323 (delta +307)
core 42,486 -> 42,486 (0)
engine 98,341 -> 98,341 (0)
control 62,877 -> 63,135 (+258) layerfs-control +134, layerfs-sandbox +1, layerfs-store +123
api 10,312 -> 10,361 (+49) layerfs-api +49
reference absent (retired R9c; last counted 65,417 at tree 498dd19)
Method: tools/production_loc.py --detail on parent 7344dbb and the staged tree
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A PostgreSQL Store's server may be on this computer or anywhere else, so reach is tested from each machine, never predicted from the address.
What changes
layerfs-persistencediagnostic/step.rs), shared by the doctor's connection check and every reach/status check.error/message:configuration,transport,tls,authentication,database,schemaoridentity. A refusal checked from a machine also namesmachine. The loopback refusal staysUnsupported, with stepconfiguration. An unreached worker gets no step.store attach <s> --machine M --dry-runruns attach's own check from that machine, takes no lock and records nothing. It answers{ ok, outcome: "tested", store, machine, latency_ms, server_version }.store connecton a connected Store with a changed address, user or password checks from this computer, then from every attached machine, before saving. If a machine fails it refusesConflictwithmachines: [{ machine, ok: false, step, message }]and fixlayerfs store detach <s> --machine <m>, and saves nothing. Asynchronous_commit-only change checks no machine.store connect --dry-runanswers{ outcome: "tested", here, machines }and saves nothing.ok: null("not checked").empty: true.calls.json,families/store.json, CLI guide words and the Node typings are updated.Commits
7344dbbc49feat(persistence): one connection-step classifier.Production LOC: 213,951 -> 214,016 (delta +65)5b9226f223feat(store): reach refusals name their step; attach and connect dry runs; address changes check attached machines.Production LOC: 214,016 -> 214,323 (delta +307)(control +258, api +49; reference absent, retired R9c)Checks
Each test binary ran separately under a 120 s limit. The PostgreSQL tests used a private trust-auth postgres:17 server.
connection_step, plus two inpostgres_login(step names, dry runs record nothing,Conflicton an address change).postgres_connect,postgres_refusals,postgres_sandbox_reach,calls_table,doctor_targets,sandbox_machines,usage_lines,rendering, all layerfs-store binaries, and layerfs-control apart fromdoctor_frame. Clippy-D warningsis clean on the touched crates.contract, CLIhelpanddoctor_frame:calls.jsonlacksstore.repair_mount_holders,store.mount_holdersandstore.gc_auditfrom fix(gc): make the merged lean GC authority (#770) never worse than the base #783/fix(gc): close the lean place-authority gaps left after #783 #784.contractfailed the same way at base.nameless_machine(fix(gc): #784 review fixes: tombstones only on confirmed stop, PostgreSQL release once, keyset audit #787 wording),progress_options(call order),store_stats(state left by other tests in a shared database) andlp176_image_recovery(Linux images, on a macOS host).postgres_connect's missing-database test is NOT_RUN withoutLAYERFS_TEST_PG_URLandLAYERFS_TEST_PG_PASSWORD.configuration, a wrong port attransport, native reachable).🤖 Generated with Claude Code