Skip to content

Path resolution that survives a workspace relocation - #6

Open
tabenius wants to merge 1 commit into
mainfrom
fix/path-relocation-and-version
Open

tabenius wants to merge 1 commit into
mainfrom
fix/path-relocation-and-version

Conversation

@tabenius

@tabenius tabenius commented Oct 9, 2026

Copy link
Copy Markdown
Owner

frog records paths in SQLite -- a repo's location, each target's working directory, each lock's files. Those are derived state, and this workspace has already moved: from /home/xyzzy/src/ragbaz to /srv/ragbaz/src/vendors/ragbaz/head. An absolute path recorded yesterday is a fact about yesterday.

Why this is not a one-time repair

Repairing the rows once is not resistance; the next move repeats the damage. The rule this implements is:

Store repo-relative where you can. Resolve against the repo's current root at the moment of use. Never trust a stored absolute path.

paths.py resolves three shapes in order:

  1. already-relative → joined to the current root
  2. absolute and still exists → used as-is
  3. absolute under a previous root → recovered by taking the longest trailing run of components that still exists under the current root

Case 3 is what lets an existing database heal without a migration. A stored /old/root/BAZ.AI-Governance/src/governance-node is, relative to its repo, src/governance-node -- and that suffix re-joins to wherever the repo lives now.

Resolution is deliberately conservative: a recovered path is reported as relocated rather than silently substituted, and nothing outside the repo root is ever returned, so .. in a stored path cannot escape.

Also in this branch

  • version.py -- frog --version answers "what am I running" honestly. The installed frog is a launcher that puts a live working tree on sys.path, so the executing code may correspond to no commit at all. matches_a_commit is False whenever the tree is dirty, because quoting a bare hex would be a lie of omission.
  • Discovery exclusions applied below the explicit root, consistently across VFSes -- an explicitly requested repo named build stays discoverable, but paths outside the requested root no longer enter a cached result.
  • Backup destination rooted at / so an absolute CLI destination is treated as a host path rather than a workspace shadow path.

Verification

  • 389 passed, 3 subtests (21 of those are new relocation tests, test_relocation.py)
  • Ruff clean on all new files. The one remaining PLW1510 in version.py matches store.py's existing subprocess.run pattern, so it is left consistent rather than diverging.

Note on branches

This is independent of tui-ragbaz-renderer-adaptation (also pushed, 454 passed), which adapts frog's TUI onto the design tokens. The two touch different files and can merge in either order.

…report

frog records paths in SQLite: a repo's location, each target's working
directory, each lock's files. Those are derived state, and this workspace has
already moved from /home/xyzzy/src/ragbaz to
/srv/ragbaz/src/vendors/ragbaz/head. An absolute path recorded yesterday is a
fact about yesterday.

paths.py resolves three shapes in order: already-relative paths join to the
current root; absolute paths that still exist are used as-is; an absolute path
under a previous root is recovered by taking the longest trailing run of
components that still exists now. That third case is what lets an existing
database heal without a migration. Resolution is conservative -- a recovered
path is reported as relocated rather than silently substituted, and nothing
outside the repo root is ever returned, so '..' in a stored path cannot escape.

version.py answers 'what am I running' honestly. The installed frog is a
launcher that puts a live working tree on sys.path, so the executing code may
correspond to no commit at all; matches_a_commit is False whenever the tree is
dirty, because quoting a bare hex would be a lie of omission.

store.py additionally applies discovery exclusions below the explicit root
consistently across VFSes, and roots the local backup adapter at / so an
absolute CLI destination is treated as a host path rather than a workspace
shadow path.

389 passed, 11570 subtests. Ruff clean on the new files (the remaining
PLW1510 in version.py matches store.py's existing subprocess.run pattern).
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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