Skip to content

ADR-056: reindex reports freshness against the index's target (B-070) - #99

Merged
ethanblauw-hub merged 2 commits into
masterfrom
feature/adr-056-reindex-freshness
Nov 2, 2026
Merged

ethanblauw-hub merged 2 commits into
masterfrom
feature/adr-056-reindex-freshness

Conversation

@ethanblauw-hub

Copy link
Copy Markdown
Collaborator

Builds B-070 as ADR-056.

The bug

In git mode, reindex() checked freshness against the folder's checked-out HEAD, not the ref the index follows. Both live repos have their folder on a feature branch, so every reindex printed INDEX STALENESS DETECTED, listed hundreds of files and advised reindex(changed_files_only=False), a full re-embed for nothing. The same output then said the index was up to date.

The change

  • _freshness_target(): one definition of "the revision the index is current against" (ref or "HEAD"), now shared by index_status and reindex. index_status output is unchanged.
  • reindex(): the pre-run warning and the rebuild advice are gone. One freshness line is printed after the run (current, or STALE against the ref).
  • Server instructions: no longer quote a commit, which a client reads once at connect and which went stale mid-session (Gantt saw 86d34d5). They name the ref, use git diff --name-only <ref>...HEAD, and point to index_status. They no longer open the database.

Verified

  • CPU, offline: flake8 (CI's flags) clean; 995 passed, 2 skipped; conformance, resolution and L5X checks hold.
  • New tests: git-mode reindex from a folder on another branch gives no staleness and no rebuild advice; a moved ref shows STALE; folder mode reports HEAD; instructions quote no commit and stay under 1,000 characters.
  • MCP Inspector from an empty scratch folder: tools/list --strict exit 0, 17 tools, 16 readOnlyHint (all but reindex); index_status returns isError: false.
  • Ref resolution checked read-only against both live setups (Gantt alias → origin/integration/staging-2026-10-01, V2 → origin/main).

After merge, live servers pick this up on pull + /mcp reconnect.

🤖 Generated with Claude Code

…0), proposed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

[ADR-056]
…ructions quote no commit (B-070)

The pre-run staleness block compared the folder's HEAD even in git mode, so a
folder on any other branch got INDEX STALENESS DETECTED and full-rebuild advice.
reindex() and index_status now share _freshness_target(), and reindex reports one
freshness line after the run. The server instructions name the ref, not a commit
read at connect, and point to index_status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

[ADR-056 src/MCPServer.py]
@ethanblauw-hub
ethanblauw-hub merged commit 1a95b1b into master Nov 2, 2026
5 checks passed
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