Skip to content

feat(store): PostgreSQL Stores run on any machine; store.update replaces attach/detach - #733

Merged
yifanxuaaa merged 1 commit into
layerfs_v2_0_0from
claude/pg-implicit-attach
Nov 17, 2026
Merged

yifanxuaaa merged 1 commit into
layerfs_v2_0_0from
claude/pg-implicit-attach

Conversation

@yifanxuaaa

Copy link
Copy Markdown
Contributor

What changes

A PostgreSQL Store's Sandboxes run on any machine the support table allows. sandbox.create already checks that the machine reaches the server, that the server holds this Store and that it has the project; store.attach repeated that check and kept a second record of it. This returns to #536 C4 (every machine, automatically) and keeps H9 (a machine's own URL) as an optional override.

Before After
store.attach <store> <machine> before any Sandbox there nothing: sandbox.create checks reach itself
store.detach removed
machines.<m>.checked in the Store record removed; machines.<m> holds only {url?, password?}
no way to change a Store's URL or password store.update <store> [--url] [--password] [--synchronous-commit]
a machine's own URL through attach store.update <store> --machine <m> --url …, --clear removes it
reach is known only from the last attach store.status <store> --machine <m> checks now, records nothing
machine.remove refused for an attached Store allowed; that machine's own connections are dropped

The call table goes from 85 to 84 calls. An existing record's checked entries read as no own connection, so no migration is needed.

Checks

  • cargo +1.85.1 fmt --check, Clippy -D warnings on layerfs-store, layerfs-machine, layerfs-sandbox, layerfs-control and layerfs-api (with and without machine).
  • Tests: postgres_update (including the live case against a PostgreSQL 17 server and a limited role), calls_table, sandbox_machines, inventory, typed_records; tools/check_product_boundary.py passes.
  • Live, on a build of this change over c5751130a3: a Sandbox for a PostgreSQL project started on a docker machine that was never attached; the check passed from native and from the docker worker (store.reach); a machine's own connection was refused for a wrong port and for another Store's database with nothing saved, then saved for the right address and cleared.

Not verified

  • A live check from a lima or apple-container machine.
  • gen-coverage was not run; the Python stubs were generated from the Node table.

Tests removed

api/crates/layerfs-api/tests/postgres_attach.rs goes with the calls it drove. postgres_update.rs covers what survives.

Production LOC

187394 -> 187546 (delta +152): control 51073 -> 51230, api 6527 -> 6522, core and engine unchanged. tools/production_loc.py, first parent 6bca86167f against the committed tree.

The dsh-layerfs side is Ephemeral-AI-Lab/dsh-layerfs branch pg-implicit-attach.

🤖 Generated with Claude Code

…ces attach/detach

A PostgreSQL Store's Sandboxes now run on any machine the support table
allows. sandbox.create's own reach check (the server answers, holds this
Store, has the project) is the proof; the separate attach step repeated it
and added a second record of the same fact. This returns to #536 C4 and
keeps H9 (a machine's own URL) as an optional override.

- store.attach and store.detach are removed (85 -> 84 calls).
- store.update changes a PostgreSQL Store's URL, password reference or
  synchronous_commit; with --machine it gives that machine its own
  connection, checked from that machine before it is saved, and --clear
  removes it. A failed check saves nothing.
- store.status --machine runs the check from a machine on demand and
  records nothing; the answer gains `check`.
- The Store record's `machines` holds only own connections (url,
  password). An old `checked` entry reads as no own connection.
- machine.remove no longer refuses for a PostgreSQL Store; it drops that
  machine's own connections. machine list/get lose `postgresql`.
- A stopped machine's check answers its worker's own refusal, which names
  `machine start`.

Tests: api/crates/layerfs-api/tests/postgres_attach.rs is deleted with the
calls it drove; postgres_update.rs covers what survives (refusals before
any connection, the own connection checked before it is saved, another
Store and a limited role refused, live against LAYERFS_TEST_PG_URL). The
inventory test that a PostgreSQL Store holds its attached machine is
replaced by a_postgresql_store_holds_no_machine. calls_table,
sandbox_machines, typed_records and the Node, Python and MCP call lists
follow the table.

Docs: SDK store and machine pages, control and engine PostgreSQL pages,
2.0.0 versioned guides, the JS SDK skill, generated Node and Python stubs.

Production LOC: 187394 -> 187546 (delta +152)
Scope and method: tools/production_loc.py at this commit, first parent
6bca861 against the committed tree; core 40408 -> 40408, engine
89386 -> 89386, control 51073 -> 51230, api 6527 -> 6522; reference absent
(retired R9c; last counted 65,417 at tree 498dd19).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@yifanxuaaa
yifanxuaaa merged commit 3fc66bc into layerfs_v2_0_0 Nov 17, 2026
2 checks passed
@yifanxuaaa
yifanxuaaa deleted the claude/pg-implicit-attach branch November 18, 2026 08:04
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.

1 participant