fix(installer): failed index build no longer reports install success (#351)#365
Merged
Conversation
…351) run_install discarded run_init_if_needed's return value and unconditionally returned 0, so a cocoindex/graph non-zero exit reported a successful install while the most important step failed silently. Distinguish failure from skip: run_init_if_needed now returns None when the index already exists (skip) and False only when indexing ran and failed; run_install returns 1 on that failure, mirroring run_update's `if not index_ok: return 1` check. Co-Authored-By: Claude <noreply@anthropic.com>
- Add test_install_over_existing_index_skips_init_and_exits_zero: a re-run of install over an existing index skips init and exits 0. Guards the None branch of run_init_if_needed (the PR's central design: `if init_outcome is False`), so a future `if not init_outcome` simplification that collapses None into the failure branch would fail this test instead of silently breaking idempotent re-runs. Verified red->green. - Document at the partial-failure classifier that issue #351's "treat skill/agent deploy failures as critical" is intentionally deferred: only MCP config failures are critical (a broken MCP config is fatal; missing skill/agent hints are recoverable), so the deferred scope reads as a deliberate product decision rather than an oversight. Co-Authored-By: Claude <noreply@anthropic.com>
Owner
Author
|
Addressed 2 review findings:
|
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.
What
java-codebase-rag installreturned exit 0 and reported success even when the indexing step (cocoindex / graph build) failed. The cocoindex failure was swallowed and install looked healthy to CI/automation.Note on the issue's repro
Issue #351 cited two red tests (
test_install_emits_indexing_progress_on_stderr,test_install_indexing_exception_renders_failed_footer). Both already pass on currentmaster— the progress/footer machinery they exercise was added after the issue was filed. But the core bug remains in the code:run_installstill discardsrun_init_if_needed(...)and unconditionallyreturn 0(installer.py). The untested path is a non-exception failure — cocoindex returnsreturncode != 0(no raise) →run_init_if_neededreturnsFalse→ discarded → exit 0.Fix
run_init_if_needed'sFalseconflated two outcomes: "ran and failed" and "skipped because the index already exists". A naivereturn 0 if init_ok else 1(the issue's literal suggestion) would make idempotent re-runs (existing index) wrongly exit 1. So:run_init_if_needednow returnsTrue(ran OK),False(ran and failed), orNone(skipped — index exists). It has exactly one caller (run_install).run_installcaptures the outcome and returns1only when it isFalse; a skip (None) or success (True) stays0— mirroringrun_update'sif not index_ok: return 1.Test
New
test_install_indexing_failure_returns_nonzeropatchesrun_cocoindex_updateto returnreturncode=1(non-exception failure) and assertsrun_installexits1withCocoIndex update failedon stderr. TDD: red first (exit 0 despite cocoindex failure), then green.Notes
ontology_versionchange — installer lifecycle only.installnow exits non-zero (1) when indexing fails. Idempotent re-runs over an existing index still exit 0.Closes #351.
🤖 Generated with Claude Code