Skip to content

feat(index): a full rebuild interrupted part-way resumes, against its own tree (PRJ-06 T12a) - #441

Merged
sshlg merged 1 commit into
mainfrom
feat/t12a-resumable-full-rebuild
Sep 26, 2026
Merged

sshlg merged 1 commit into
mainfrom
feat/t12a-resumable-full-rebuild

Conversation

@sshlg

@sshlg sshlg commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

First slice of PRJ-06 — the part with the production value: a full rebuild interrupted by a restart continues instead of starting over.

Before: the route created a fresh checkpoint whenever force_full was set, and CheckpointService.create deletes the old one. A restart at 63% of a ~12 000 s rebuild paid for all of it again (2026-09-09: three consecutive runs orphaned at 63%, 33%, 33%).

Change:

  • repos.resume_checkpoint: like continues like — full↔full, incremental↔incremental; never across (KNOW-08); an unknown pre-column checkpoint is never resumed.
  • pipeline_runner.pin_to_tree (S-11): a resume is checked out at the checkpoint's head_sha — clone_or_pull just moved the clone to the current head, while the restored changed files/profile/cross-file analysis describe the checkpoint's, and ast_parse re-runs on every resume. A commit that is gone → CheckpointService.reset_progress and a restart from the top, WARNING logged. The next clone_or_pull checks the branch out again, so the detached head does not outlive the run.
  • The rebuild stays clean: ast_parse/graph_build are ungated, so a resumed full run re-parses the whole tree and saves the whole graph.

Tests (test_a_full_rebuild_resumes.py, 10): the resume matrix (red on the old rule); pin on a real two-commit repo; pin to current head is a no-op; an unknown commit refuses and leaves the clone untouched; reset_progress clears steps, docs and the legacy JSON while keeping the checkpoint.

Not in this slice (PRJ-06 remainder): Step objects replacing _run_steps, per-step sessions, the run-keyed save() for stale-row deletion, the per-run doc/token cap, to_thread for the four inline loops. Production acceptance (a deliberately interrupted rebuild of esim-php completing in < 0.5× cold time) is read when the next restart lands on a rebuild.

Checks: backend unit 9 176 passed; ruff/mypy clean; tests/unit/docs 133 passed.

🤖 Generated with Claude Code

… own tree (PRJ-06 T12a)

Every full rebuild used to start over: the route created a fresh checkpoint
whenever force_full was set, and CheckpointService.create deletes the old
one. A restart at 63% of a ~12 000 s rebuild paid for all of it again —
observed 2026-09-09 as three consecutive runs orphaned at 63%, 33%, 33%.

- repos.resume_checkpoint: like continues like. Full continues full, an
  incremental checkpoint an incremental run; neither crosses (KNOW-08); an
  unknown (pre-column) checkpoint is never resumed. Tested as a matrix.
- pipeline_runner.pin_to_tree (S-11): a resume is checked out at its
  checkpoint's head_sha, because clone_or_pull moved the clone to the
  branch's current head while the restored changed files, profile and
  cross-file analysis describe the checkpoint's; ast_parse re-runs on every
  resume and would otherwise parse a newer tree. A commit that is gone
  (force-push) resets the progress (CheckpointService.reset_progress) and
  the run starts from the top, logged at WARNING. Tested on a real repo.
- The rebuild stays clean: ast_parse and graph_build are ungated, so a
  resumed full run re-parses the whole tree and saves the whole graph.
- CLAUDE.md: the paragraph that said a full rebuild "has no checkpoint to
  resume from" now says what happens.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sshlg
sshlg merged commit 7711c42 into main Sep 26, 2026
3 checks passed
sshlg pushed a commit that referenced this pull request Sep 26, 2026
B-21's changelog line said the harness cancels leftover work; the merged fix
waits and never cancels (the cancelling version broke CI). T12a (#441) in
CHANGELOG and loop-queue; retro S-14 (never cancel background work on a
shared connection; a local pass of a timing-sensitive change is not
evidence).

Co-Authored-By: Claude Opus 5.5 (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