Skip to content

Key the Postgres tenant on an id minted at Project.init (#109) - #111

Merged
thorwhalen merged 1 commit into
mainfrom
fix/109-minted-tenant-id
Oct 14, 2026
Merged

thorwhalen merged 1 commit into
mainfrom
fix/109-minted-tenant-id

Conversation

@thorwhalen

Copy link
Copy Markdown
Collaborator

Fixes #109.

Under the Postgres backend a project's tenant was a hash of root + title (or the song's hash), so a folder removed and recreated with the same path and title inherited the old graph, project-meta row and stable id.

  • Project.init mints tenant_id (uuid4 hex) into project.json. write_spec and the legacy-graph migration preserve it.
  • nw.storage.tenant_id_of / FolderStorage.tenant_id / migrate.project_tenant_id: the minted id when present, else the historical asset_id_of value.
  • open_graph_store / iter_scope_stores take an optional tenant (string or lazy callable, default asset_id); the project graph and the storyboard pass the tenant id. asset_id is untouched and still anchors media references.
  • tests/test_tenant_id.py uses a stand-in PostgresStore with one in-memory store per project_id (no Postgres binary here; the real-Postgres suite skips): remove the folder, Project.init again at the same path and title, graph is empty (fails without the mint).

Compatibility: public API only widened. Existing stored data stays readable: a project without tenant_id keeps its historical tenant (so an old project recreated by hand is still exposed; only projects created through Project.init from this version on are protected). SQLite is unaffected (the graph lives in the folder). project.json gains one key; ProjectSpec ignores it. reelee needs no floor bump to keep working; it needs one to get the fix (the next nw release, which this merge publishes).

Judged low-stakes (inactive backend, additive), so no adversarial review; full suite 791 passed, 3 skipped.

🤖 Generated with Claude Code

project.json gets a tenant_id at init, preserved by write_spec and the
graph migration. Postgres keys the graph on it, so a recreated project at the
same path and title starts empty. Projects without one keep their historical
tenant, so existing graphs stay readable. open_graph_store / iter_scope_stores
gain an optional tenant argument.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@thorwhalen
thorwhalen merged commit d5c4846 into main Oct 14, 2026
12 checks passed
@thorwhalen
thorwhalen deleted the fix/109-minted-tenant-id branch October 14, 2026 02:32
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.

Postgres tenant is keyed on root + title, so a recreated project inherits the old graph

1 participant