Skip to content

fix(cli/runtime): key dependency-staleness on corePath, not only the pyproject hash#104

Open
gadievron wants to merge 1 commit into
masterfrom
fix/cli-runtime-key-dependency-staleness-on-corepath-not
Open

fix(cli/runtime): key dependency-staleness on corePath, not only the pyproject hash#104
gadievron wants to merge 1 commit into
masterfrom
fix/cli-runtime-key-dependency-staleness-on-corepath-not

Conversation

@gadievron
Copy link
Copy Markdown
Collaborator

The managed Python venv is a single global path (~/.openant/venv) shared by every worktree. The
staleness check (depsStalenessAt) keyed only on pyproject.toml content, so two worktrees with
identical pyproject.toml were considered "up to date" even though the venv's editable install
(pip install -e <corePath>) pointed at whichever worktree installed last -- a binary built in
worktree B would silently import worktree A's Python source.

Introduce depsHash(corePath) = sha256(corePath + "\0" + pyproject.toml contents) and use it for both
the install baseline stamp and the staleness comparison. A change of corePath (switching worktrees)
now reads as stale and triggers a reinstall that re-points the editable install at the active source.
(hashFile remains a tested file-hash utility, no longer on the staleness path.)

Tests: internal/python/runtime_corepath_test.go (two worktrees with byte-identical pyproject but
different corePath -> the second is detected as stale; same corePath -> not stale). RED 1 failed ->
GREEN; go test ./internal/python/ ok (existing staleness + hashFile tests unaffected); gofmt + vet clean.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

…pyproject hash

The managed Python venv is a single global path (~/.openant/venv) shared by every worktree. The
staleness check (depsStalenessAt) keyed only on pyproject.toml content, so two worktrees with
identical pyproject.toml were considered "up to date" even though the venv's editable install
(`pip install -e <corePath>`) pointed at whichever worktree installed last -- a binary built in
worktree B would silently import worktree A's Python source.

Introduce depsHash(corePath) = sha256(corePath + "\0" + pyproject.toml contents) and use it for both
the install baseline stamp and the staleness comparison. A change of corePath (switching worktrees)
now reads as stale and triggers a reinstall that re-points the editable install at the active source.
(hashFile remains a tested file-hash utility, no longer on the staleness path.)

Tests: internal/python/runtime_corepath_test.go (two worktrees with byte-identical pyproject but
different corePath -> the second is detected as stale; same corePath -> not stale). RED 1 failed ->
GREEN; go test ./internal/python/ ok (existing staleness + hashFile tests unaffected); gofmt + vet clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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