arrow_backRetour aux issues
repowise-dev/repowise
#1874
Débutant
Ouvrirarrow_forward
Débutant
Ouvrirarrow_forward
Débutant
Ouvrirarrow_forward
[Bug] Generated CLAUDE.md stamps live HEAD instead of the commit the index was built against
ecoDébutant
bug
good first issue
descriptionDescription
## Summary
The `Last indexed` stamp in a generated `CLAUDE.md` reports whatever `git HEAD`
was when the file was *written*, not the commit the index it describes was built
from. The two routinely disagree, nothing self-heals the drift, and every fact
under the stamp inherits it.
## Mechanism
`EditorFileDataFetcher.fetch` shells out at
`generation/editor_files/fetcher.py:73`:
```python
indexed_commit=_get_head_short_sha(self._repo_path),
```
```python
def _get_head_short_sha(repo_path: Path) -> str:
"""Return the short SHA of HEAD, or empty string if not a git repo."""
try:
result = subprocess.run(
["git", "rev-parse", "--short", "HEAD"],
```
The value it wants already exists on the row it just loaded. `repo` is in scope
at line 65, and `Repository.head_commit` is documented for exactly this
(`persistence/crud/repository.py:52-58`):
> `head_commit` records the git commit the index was built against - the value
> the MCP `_meta` freshness check compares to the live HEAD.
## Why the drift is routine, not a corner case
A rebase fires the post-commit hook once per replayed commit. Each firing
rewrites `CLAUDE.md` with the then-current HEAD while the index underneath is
unchanged, so the stamp walks forward on its own. There is no path that pulls it
back.
This is also why the mismatch is easy to misread: the same commit before and
after a rebase has two SHAs, so the stamp and the index can look divergent when
only the stamp moved.
## Blast radius
Everything below the stamp is a static snapshot taken at the same moment and
carries the same drift, including the code-health "worst performer" line. The
stamp is the only thing claiming to date them, so if it is wrong they are all
silently misdated.
## Fix
Read the stored commit, falling back to the shell call only when the column is
empty (pre-backfill indexes):
```python
indexed_commit=(repo.head_commit or "")[:7] or _get_head_short_sha(self._repo_path),
```
Worth confirming the short-SHA length matches what `git rev-parse --short`
produces on this repo, so the rendered stamp does not change width.
## Tests
The existing assertion only checks the `YYYY-MM-DD` shape of `indexed_at`, so it
survives untouched. A new test should set `head_commit` to a known value, leave
the working tree on a different commit, and assert the stamp reports the stored
one.
Issues similaires
calkit/calkit
star53
Poids du dépôt moyen
VS Code extension should be robust to YAML parser errors
Seeing this error: ``` Failed to read calkit.yaml: YAMLParseError: A block sequence may not be used as an implicit map…
Python
bug
good first issue
fu351/Doberman-Core
star211
Poids du dépôt léger
dash: a manual Refresh control
The dashboard polls: `refreshStats()` (`src/doberman/dash/app.py:408`) every 5 s and `refreshPending()` (`:546`) every …
Python
enhancement
good first issue
fu351/Doberman-Core
star211
Poids du dépôt léger
dash: "Copy details" button on each pending-approval card
Each pending-approval card in the dashboard (`renderPending`, `src/doberman/dash/app.py:448-544`) shows the risk badge,…
Python
enhancement
good first issue