fix(gstack-slug): resolve slug from git remote, not a stale cache#2010
Open
steven1370 wants to merge 1 commit into
Open
fix(gstack-slug): resolve slug from git remote, not a stale cache#2010steven1370 wants to merge 1 commit into
steven1370 wants to merge 1 commit into
Conversation
gstack-slug cached a project's slug permanently and never re-validated it against the git remote. A slug cached while a repo's remote was temporarily wrong — e.g. a project scaffolded by copying another before its remote was repointed — stuck forever, so that project filed its gstack/retro artifacts under the wrong slug indefinitely (observed: a repo resolving to an unrelated sibling project's slug). Flip resolution to remote-first: derive the slug from `git remote get-url origin` on every run and overwrite the cache. Fall back to the cache (then basename) only when there is no remote. A stale or poisoned cache now self-heals on the next run instead of being pinned forever. The [a-zA-Z0-9._-] sanitization and atomic cache write are preserved; the cache-read path is still sanitized (now reachable only on no-remote dirs). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
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.
Problem
bin/gstack-slugresolves a project's slug cache-first (~/.gstack/slug-cache/<encoded-path>) and never re-validates it against the git remote once cached. If the slug is first computed while a repo'soriginis temporarily wrong — most commonly a project scaffolded by copying another repo before its remote is repointed — the wrong slug gets cached and then shadows the corrected remote forever. Every consumer (ship metrics,/retro, artifacts, project state) then files under the wrong project slug indefinitely.Root cause
Lines 16-19 trust a present cache file verbatim, and the remote is only consulted on a cache miss (line 23). There is no invalidation path, so a stale entry is permanent.
Fix
Flip resolution to remote-first:
git remote get-url originon every run.A stale or poisoned cache now self-heals on the next run. For a remote-less repo or a non-repo dir, behavior is unchanged: the cache still provides cross-session stability and is still sanitized on read.
Invariants preserved:
[a-zA-Z0-9._-]sanitization on every path, atomic cache write viamktemp+mv, andpipefail-safe remote read.Verification
bash -nclean.[a-zA-Z0-9._-], not executed.🤖 Generated with Claude Code