Repository navigation
store: one PostgreSQL connection on this computer; machines attach - #786
Merged
Merged
Conversation
Owner direction 2026-11-24: this computer is the one place a PostgreSQL
Store's URL and login are saved; machines attach to the Store and dial
with both; no machine has an address or a login of its own.
Calls:
- store.connect(store, url, { user, password, synchronous_commit });
shell `--user U --password-stdin`. A first connect needs both and
checks them before saving; the record keeps url, user,
synchronous_commit and binding, the password goes to the home secret
`secret/login/<store>.json` (never answered, logged or recorded) and
into the URL only when dialled. On a connected Store it changes the
address, user, password or setting (omitted ones keep the saved ones)
after reaching the same binding; outcome `connected` or `updated`.
A sqlite Store of the name is `Exists`.
- store.disconnect(store): no --machine; also forgets the saved
password and every attachment.
- New store.attach(store, { machine }) and store.detach(store,
{ machine }): attach checks from the machine (it must exist and run
PostgreSQL Sandboxes) before recording it in the record's `attached`
list and its reach (`attached`, or `checked` again); detach is InUse
while a Sandbox of the Store's projects is on the machine, NotFound
when not attached. sqlite and `native` are InvalidInput.
- sandbox.create on a machine not attached is refused InvalidInput
with `layerfs store attach <store> --machine <machine>` as its fix.
- store.doctor checks this computer, then every attached machine (or
--machine alone, which must be attached); a host failure checks no
machine.
- store.get/list: url, user, password_saved, password_changed_at,
binding, reach, machines ({machine, reached, reach}; names in list
and the home tree); auth and connections removed.
- Removed with no alias: store.save_auth, store.auths,
store.remove_auth, store.update, --auth, --machine on connect and
disconnect, OwnConnection.
No migration or backward compatibility (owner override): the old-format
handling is deleted, not replaced. Removed: record.rs outdated fields,
refused URLs, without_old_fields, legacy() and OwnConnection;
login.rs's save-auth fix machinery (no_auth_fix, missing_fix,
login_fix, fix_of, update_fix); state.rs's PostgreSQL `outdated` and
`missing` derivation; store_target.rs own_state; connect.rs readdress,
refuse_settings and legacy checks; postgresql/update.rs. A record
without the new fields fails through the normal dial path.
Docs: api/sdk/store.md, control sqlite-and-postgresql.md, versioned
2.0.0 calls.md, machines-and-stores.md and migration.md, the doctor,
home, platform, worker, sdk and front-end guides, the JS SDK skill,
the call spec (calls.json, families/store.json, families/home.json,
81 calls); regenerated index.d.ts, the Python stubs, coverage.md and
mcp.md's profile table.
Deleted tests (they drove removed calls or the retired saved-login and
own-address model):
- api/crates/layerfs-api/tests/postgres_connections.rs (whole file):
an_old_record_reads_outdated_until_its_fix_connects_it_again,
an_update_racing_a_login_removal_never_names_a_removed_login,
every_side_that_connects_is_listed_with_what_was_seen
- api/crates/layerfs-api/tests/postgres_update.rs (whole file):
addresses_and_logins_are_proven_before_they_are_saved
- control/crates/layerfs-store/tests/postgresql_no_auth.rs (whole
file): a_key_value_address_is_refused_before_anything_dials_it,
a_record_with_no_saved_login_is_refused_with_the_save_auth_fix,
a_saved_login_goes_into_the_dialled_url,
its_state_is_broken_outdated_with_the_same_fix,
the_login_replaces_the_user_part_its_client_reads
- postgres_refusals.rs:
a_login_is_saved_privately_listed_without_its_password_and_removed_when_unused
(rewritten: connect_refuses_a_login_in_the_url_and_a_missing_login,
disconnect_refuses_a_held_store_then_forgets_it_and_its_password,
attach_and_detach_refuse_what_is_not_theirs, an_old_url_login_is_never_shown)
- observed_reach.rs: a_login_file_that_cannot_be_read_is_a_broken_row,
a_missing_login_reads_missing_and_wins_over_old_fields,
old_fields_read_outdated_and_an_update_drops_them_but_never_a_url,
connections_list_every_side_that_connects (replaced by
machines_list_the_attached_machines_with_their_reach,
a_missing_password_is_refused_and_a_saved_one_is_dialled)
- postgresql_url_corpus.rs:
a_machine_address_is_connected_again_and_an_update_names_its_login,
an_update_fix_dials_only_with_the_login_it_names,
an_update_never_rewrites_a_url_to_another_host (replaced by
a_connect_never_rewrites_an_older_url_to_another_host)
New: api/crates/layerfs-api/tests/postgres_login.rs.
Production LOC: 211762 -> 211291 (delta -471)
core 42163 -> 42163 (0), engine 97424 -> 97424 (0),
control 61844 -> 61437 (-407), api 10331 -> 10267 (-64);
reference absent (retired R9c; last counted 65,417 at tree 498dd19).
Method: python3 tools/production_loc.py --root <tree> on `git archive`
of the parent fe9b4d1 and `git checkout-index -a` of the staged
tree; nonblank, non-comment product source, tests, docs, tools and
generated stubs excluded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner correction 2026-11-24: "this computer" (the host) is the control process: the home, records, secrets, the Store's saved connection and the check made from this computer. It is never a machine and never named `native`. Machine native is the built-in machine with Platform::Native; what it allows (shared loopback, local executor) comes from its platform, not its name. - store.attach / store.detach accept native like any machine: the platform support check, the reach check from that machine (its Loopback decides whether a loopback URL is allowed) and the record. The "machine native is this computer, which every PostgreSQL Store is attached to" refusal is gone. - sandbox.create needs the machine attached, native included, with the same refusal and fix. With no --machine, a PostgreSQL Store's Sandbox no longer defaults to native: exactly one attached machine is used; none is refused InvalidInput with `layerfs store attach <store> --machine <machine>` as its fix; several are refused InvalidInput, listed in next.machines, asking for --machine. - store.doctor checks this computer, then every attached machine, native only when attached; --machine native follows the same rule (refused with the attach fix when not attached). - Reaches: this computer's check stays `here`, machine native's is `reach.native`; observed.rs no longer folds native into `here`, and the doctor no longer drops native from the attached machines. - store.connect attaches nothing (unchanged, now documented). Tests updated: observed_reach (native's reach is its own), postgres_refusals (native attach dials and fails Unavailable against a dead address; detach NotFound), postgres_login (doctor --machine native refused until attached; native attached against a real server, checked again, in the doctor's rows and store.get, detached), postgres_sandbox_reach (native attached first), sandbox_machines (no default machine: none and several refused; one attached used; live test attaches native). No test deleted. Docs: api/sdk/store.md, sandbox.md, README.md, control sqlite-and-postgresql.md, versioned calls.md and machines-and-stores.md, the JS SDK skill's store and sandbox pages, the call spec notes and sandbox.create's machine help (also in the guide). Production LOC: 211291 -> 211308 (delta +17) core 42163 -> 42163 (0), engine 97424 -> 97424 (0), control 61437 -> 61455 (+18), api 10267 -> 10266 (-1); reference absent (retired R9c; last counted 65,417 at tree 498dd19). Method: python3 tools/production_loc.py --root <tree> on `git archive` of the parent 2dd49a2 and `git checkout-index -a` of the staged tree; nonblank, non-comment product source, tests, docs, tools and generated stubs excluded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- store.connect (a first connect and an update) records its own check as this computer's reach (`here` in the Store's observation file, the record store.doctor writes): ok, with how long the check took. It is written only after the connect is saved; a refused connect records nothing. store.get's `reach` is no longer "not checked" right after a connect. - machine.list items and machine.get answer a read-only `loopback`: `shared` or `apart`, from the platform adapter's `Loopback` (layerfs_platform::shares_loopback); null for a removed platform or a record that describes no machine. Long form, after `supports`. Clients read it instead of testing platform names. Tests: postgres_login (reach after a first connect and an update; a refused connect leaves observed.json unchanged), machine_calls (native shared; docker apart off Linux), machine_removed_platforms (null). No test deleted. Docs: api/sdk/machine.md, api/sdk/store.md, control sqlite-and-postgresql.md, versioned calls.md; call spec machine.get and machine.list long keys. Production LOC: 211308 -> 211342 (delta +34) core 42163 -> 42163 (0), engine 97424 -> 97424 (0), control 61455 -> 61487 (+32), api 10266 -> 10268 (+2); reference absent (retired R9c; last counted 65,417 at tree 498dd19). Method: python3 tools/production_loc.py --root <tree> on `git archive` of the parent ebf6697 and `git checkout-index -a` of the staged tree; nonblank, non-comment product source, tests, docs, tools and generated stubs excluded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The doc comment said a sqlite Store's file sits in the home "while it is on native". The file is in the home while the Store is on the machine whose calls run in this process; native is only today's such machine. Comment only. Production LOC: 211342 -> 211342 (delta 0) Scope and method: tools/production_loc.py --root on the worktree before and after the edit (core/engine/control/api; reference absent, retired R9c; last counted 65,417 at tree 498dd19). Comment-only change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nect-attach Conflicts, resolved keeping both sides: - api store/mod.rs: upstream's new `repair_mount_holders` call is kept; this branch's removal of save_auth, remove_auth and update stands. - layerfs-platform lib.rs and setup/mod.rs: the re-export lists keep both upstream's `provider_state` and this branch's `shares_loopback`. Adapted to this branch's API: control/crates/layerfs-store/tests/repair_postgresql.rs (added upstream) saves the password under the Store's name and records the user in `StoreRecord::connected`, instead of a named saved login. Production LOC: 211342 -> 213839 (delta +2497) Scope and method: first-parent comparison (this branch's 2f81c3d vs the merged tree) with tools/production_loc.py --root on `git archive` of the parent and `git checkout-index -a` of the staged tree. The delta is upstream's work merged in (#781 native boundary, #783, #784 and the other layerfs_v2_0_0 commits since fe9b4d1), not new code on this branch. Reference absent (retired R9c; last counted 65,417 at tree 498dd19). 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.
PostgreSQL Stores get one connection, saved on this computer, and machines attach to it (owner decisions 2026-11-24).
Calls
store connect <store> <url> --user U --password-stdin [--synchronous-commit X]: a new Store needs user and password and is checked from this computer before anything is saved. Run again, it changes the address, user, password or setting; an omitted user or password keeps the saved one, and the new values must reach the same Store (binding).store disconnect <store>: forgets the Store, its saved password and its attachments; data stays.store attach <store> --machine M/store detach <store> --machine M(new): attach checks from M with the saved URL and login; detach is refusedInUsewhile a Sandbox of the Store is on M. Machinenativeis an ordinary machine here: it attaches like any other, and its platform's loopback decides whether a loopback URL is allowed.sandbox.createfor a PostgreSQL Store's project runs only on an attached machine. With no machine named it uses the only attached one, and refuses otherwise (attach fix, ornext.machines).store doctor: from this computer, then every attached machine (--machine M: that machine only).store get/store list:url,user,password_saved,password_changed_at,reach(this computer),machineswith their reach.store.connectrecords this computer's reach.machine.get/machine.list: new read-onlyloopback: shared | apart, from the platform adapter.Removed, with no compatibility or fallback
store save-auth,store auths,store remove-auth,store update,--auth,--machineon connect/disconnect, per-machine own addresses (OwnConnection) and all old-record handling. An old record fails through the normal path.Commits
2dd49a22deone saved PostgreSQL login on this computer; machines attach. Production LOC 211762 -> 211291 (delta -471)ebf6697a79machine native is an ordinary machine for PostgreSQL Stores. 211291 -> 211308 (+17)e9f9774f61store.connect records this computer's reach; machines answer loopback. 211308 -> 211342 (+34)2f81c3d1f7store_file names the machine whose calls run in this process (comment). 211342 -> 211342 (0)ae2f60c312merge of layerfs_v2_0_0 (control: ask the platform, not the name native; this computer is no machine #781, 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, ...). 211342 -> 213839 (+2497, upstream's work merged in); conflicts and the adapted upstream testrepair_postgresql.rsare listed in its message.Counted with
tools/production_loc.py --rooton each parent and staged tree; reference absent (retired R9c; last counted 65,417 at tree 498dd1917812).Checks (merged tree, real postgres:17, each test command <= 120 s)
-D warnings: workspace, all targets, with--features layerfs-api/machine: clean.layerfs-store108/0,layerfs-platform107/0,layerfs-machine19/0,layerfs-control172/1.layerfs-api --features machine: postgres_login 2, postgres_refusals 6, postgres_connect 2, postgres_sandbox_reach 1, sandbox_machines 7, store_routes 6, doctor_targets 7, machine_calls 1, gc_calls 14, all passing; calls_table 25/1, contract 11/1.store.repair_mount_holdersand the doctor checksstore.mount_holders/store.gc_audit(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) are in the code but not incore/docs/issues/call-surface-2-0/calls.json, sodoctor_frame,calls_tableandcontractfail onlayerfs_v2_0_0without this branch too. Not fixed here.layerfs-sandbox172/7, the same 7 pre-existing macOS failures (lp176_image_recovery,workspace_isolation); generator checks, Python stubs and Nodecalls/coveragepass.@modelcontextprotocol/sdknot installed).The dsh-layerfs UI for this (Store tab rows, Connect / Edit connection, attach picker) is on dsh-layerfs branch
claude/store-rows.🤖 Generated with Claude Code