fix: CI/CD robustness, search path resolution, and test self-sufficiency#18
fix: CI/CD robustness, search path resolution, and test self-sufficiency#18
Conversation
Comprehensive design for phased migration from shell-script-based architecture to native Claude Code Plugin. Covers 4 phases: - Phase 1: Bug fixes (manifest commit, search index CI/CD) - Phase 2: Plugin addition (dual installation path) - Phase 3: Migration nudges for existing users - Phase 4: Pure plugin (shell script removal) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 1 (fix/phase1-bug-fixes): Bug fixes for manifest commit bug, search index generation, issue #15, and hardcoded doc counts. Phase 2 (feat/plugin-modernization): Native Claude Code plugin with /docs command, auto-discoverable Skill, and SessionStart hook. Both plans follow TDD with bite-sized tasks and exact file paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The update-docs workflow regenerates paths_manifest.json every 3 hours but only staged docs/ for commit. The manifest at the repo root was never committed, causing it to be stale since Dec 2025. Fix: add paths_manifest.json to the git add command.
Add build_search_index.py step to update-docs workflow. The search index (.search_index.json) was never auto-generated, meaning content search only worked if someone manually ran the script. Now it rebuilds every 3 hours alongside the doc fetch.
load_search_index() used bare relative Path('docs/.search_index.json')
which fails when the helper script is called from a different working
directory. Now resolves relative to the script's repo root using __file__.
Python scripts used relative paths that broke when the helper was called from a different working directory. Fix: wrap all Python calls in subshells that cd to the repo root first. Also replace all hardcoded '573' doc count references with dynamic lookups from paths_manifest.json metadata.
The actual number of docs drifts between local (571), installed (586), and remote (574). Static references like '573 paths' and '571 files' were always slightly wrong and required manual maintenance. Replace with dynamic language or dynamic lookups from manifest metadata.
- Use python3 (not python) in CI workflow — ubuntu-latest has no bare python - Add set -e to build step so Python failures propagate as workflow failures - Replace fragile __wrapped__ access with inspect.getsource() directly - Make subshell cd test actually assert on the cd pattern - Remove unused import
- test_no_deprecated_paths: now validates manifest paths against actual files on disk (20% tolerance) instead of skipping when broken_paths_categorized.json is absent - test_internal_links_in_manifest: now scans real docs for internal links and validates against manifest (30% tolerance) instead of using a synthetic fixture that never contained /en/ links
update-docs.yml: pip install and fetch_claude_docs.py steps validate.yml: lookup_paths.py --validate-all step
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
PR Review: CI/CD robustness, search path resolution, and test self-sufficiencyOverall this is a well-scoped and well-motivated PR. The three problem areas identified (CI/CD pipeline gaps, cwd-dependent path resolution, silently-skipped tests) are all real bugs, and the fixes are generally correct. A few issues worth addressing before merging: Bugs / Correctness Issues1.
|
| Issue | Severity | Required? |
|---|---|---|
pip vs python3 -m pip inconsistency |
Medium | Yes |
| Hard-coded 100-link threshold undocumented | Low | Suggestion |
| Filename mapping logic duplicates fetcher logic | Low | Suggestion |
set -e redundancy |
Trivial | No |
| Search index build blocks full deploy | Low | Suggestion |
The core fixes (path resolution, manifest staging, subshell cwd, previously-skipped tests) are all correct and well-tested. Addressing the pip inconsistency is the main item before merging.
PR #18 review items: - Replace all bare pip with python3 -m pip across 4 CI workflows - Remove redundant set -e from search index build step - Add continue-on-error: true to search index build step - Document 100-link threshold and add pass-statistics print - Reuse url_to_safe_filename() instead of duplicating logic in test Documentation updates: - Update test counts from 294 to 302 across README, CLAUDE.md, CONTRIBUTING.md - Fix stale 629-test reference in CONTRIBUTING.md - Remove last hardcoded 571 doc count in helper script show_version() - Remove hardcoded 573/571 counts in CONTRIBUTING.md Version bump: - Bump version from 0.5.0 to 0.5.1 in install.sh and claude-docs-helper.sh
All Code Review Items Addressed — Ready to MergeAll 5 items from the code review have been resolved, along with additional documentation and versioning updates. Review Items ResolvedItem 1: Replace bare
Item 2: Document the 100-link threshold and log pass statistics
Item 3: Reuse
Item 4: Remove redundant
Item 5: Add
Additional ChangesDocumentation updates:
Version bump to v0.5.1:
Verification Evidence
Full Branch Summary (10 commits)All Phase 1 objectives complete. Ready to merge. |
PR Review: fix/phase1-bug-fixesOverall this is a solid set of targeted fixes addressing real bugs. The core changes are correct and well-motivated. A few issues worth addressing before merge. What's Working Well
Issues1. Plan documents expose local dev paths (should not be committed) The three new files under These are implementation planning artifacts intended for the development workflow, not public documentation. Committing them to the repo:
Recommendation: Move these to a private location, a 2. Three Python calls are correctly wrapped in # Still un-wrapped in the patched file:
if python3 "$SCRIPTS_PATH/main.py" --update-all 2>/dev/null; thenIf if (cd "$DOCS_PATH" && python3 "$SCRIPTS_PATH/main.py" --update-all) 2>/dev/null; then3. assert 'cd' in call, (...)This checks for the substring import re
assert re.search(r'\(cd\s+', call), (
f"Python call must use '(cd ...' subshell pattern: {call}"
)4. Behavioral test missing for the actual cwd bug
A more robust complement would be a behavioral test: def test_load_search_index_path_is_absolute(self, tmp_path, monkeypatch):
"""load_search_index should work regardless of current working directory."""
monkeypatch.chdir(tmp_path) # Change cwd to temp dir (no docs/ here)
from lookup.search import load_search_index
load_search_index.cache_clear()
# Should return None (no index at tmp_path/docs/.search_index.json)
# rather than raising FileNotFoundError or similar
result = load_search_index()
assert result is None # Gracefully returns None, does not crashThis tests the behavior (graceful handling regardless of cwd) rather than the implementation detail (string not present in source). 5. Minor: - name: Build search index
if: steps.validate-safeguard.outputs.safeguard_triggered != 'true'
continue-on-error: true
run: |
python3 scripts/build_search_index.pyIf python3 scripts/build_search_index.py || echo "Search index build failed — content search may be unavailable"Summary
The three real bugs being fixed are legitimate and the fixes are correct. The plan document concern is the most important thing to address before merge — the rest are polish items. Good work overall. |
…ests - Untrack docs/plans/ (add to .gitignore, keep locally) - Wrap remaining Python calls in update_all_docs() with cd subshells - Strengthen test_python_calls_use_subshell_cd with regex assertion - Add behavioral test for load_search_index cwd independence - Add echo fallback for search index build failure visibility in CI
Review Round 2 — All Items AddressedAll 5 items from the second review have been resolved in commit 2674520.
Verification
Branch StatusThis branch is complete. Both review rounds (10 items total) have been addressed. The PR is ready to merge — no further changes planned. |
PR Review: fix: CI/CD robustness, search path resolution, and test self-sufficiencyOverall this is a well-focused, coherent set of bug fixes. The changes are well-scoped and come with good test coverage. A few observations below. ✅ StrengthsSearch path fix ( repo_root = Path(__file__).resolve().parent.parent.parent
index_file = repo_root / "docs" / ".search_index.json"The depth is correct (
Staging Test improvements — Converting previously-skipped tests to self-sufficient ones is the right call. The new tests are meaningful rather than passing vacuously.
|
| Area | Assessment |
|---|---|
| Core bug fix (search path) | ✅ Correct and well-tested |
| CI python3 consistency | ✅ Good practice |
| Manifest staging in CI | ✅ Real bug fix |
| Search index in CI pipeline | ✅ Correct, minor monitoring gap |
| Test self-sufficiency | ✅ Meaningful improvement |
| Hardcoded count removal | ✅ Future-proofs the docs |
lru_cache None caching |
|
sys.path.insert in tests |
This is ready to merge with the minor caveats noted. The lru_cache None-caching issue is the only one with a real user-visible impact (content search silently not working on fresh installs until process restart) and would be worth a quick follow-up.
- Rewrite README.md: remove hardcoded counts, stale upgrade guide, redundant architecture section, verbose examples. 452 → ~120 lines. - Fix TARGET_DOCS in install.sh — now computed from actual doc count instead of printing blank in upgrade summary - Update test counts from 302 to 303 across CLAUDE.md and CONTRIBUTING.md
Final Update — Branch CompleteCommit dcb529b addresses the last item worth fixing and wraps up this branch. What changed
README.md rewrite: Cut from 452 lines to ~120. Removed hardcoded per-category counts (the drift problem noted in item 5), stale v0.4.x upgrade guide, redundant architecture tree (duplicates CLAUDE.md/CONTRIBUTING.md), verbose 30-line examples section, and over-detailed security internals. The README now focuses on what users need: install, use, update, troubleshoot. Test counts: Updated 302 → 303 across CLAUDE.md and CONTRIBUTING.md to reflect the new behavioral test. Remaining review items — not implementing
Verification
This is the last commit for this PR. Ready to merge. |
PR Review: CI/CD robustness, search path resolution, and test self-sufficiencyOverall this is a well-scoped, focused set of bug fixes. The changes are coherent and address real issues. Below are observations per area. CI/CD Workflows
Staging Build search index step — the sequence is correct: build index →
|
| Area | Assessment |
|---|---|
| CI/CD python3 consistency | Correct fix |
Staging paths_manifest.json |
Correct fix |
| Search index build in CI | Correct; sequencing is right |
search.py __file__-relative path |
Correct fix for #15 |
Helper script cd subshells |
Correct pattern |
test_no_deprecated_paths |
Self-sufficient now |
test_internal_links_in_manifest |
Substantial improvement |
inspect.getsource() |
More robust than __wrapped__ |
Test coverage gap (main.py/build_search_index.py) |
Minor, not a blocker |
| Hardcoded-count test specificity | Minor, not a blocker |
The fixes are correct and the test improvements address real validation gaps. The minor observations are worth noting for follow-up but don't block merging.
Summary
Phase 1 bug fixes addressing CI/CD pipeline issues, working-directory-dependent path resolution, and silently-skipped validation tests.
paths_manifest.json, auto-generate search index, usepython3consistently, addset -eto build step__file__, not cwd (fixes Content search fails when helper script is called with absolute path #15)(cd $DOCS_PATH && ...)subshells, replace hardcoded counts with dynamic valuestest_no_deprecated_pathsandtest_internal_links_in_manifestself-sufficient — they previously skipped silently due to missing fixture data, hiding real validation gapsinspect.getsource()instead of fragile__wrapped__attribute accessChanged files (11)
.github/workflows/update-docs.yml.github/workflows/validate.ymlscripts/lookup/search.py__file__-relative path for search indexscripts/claude-docs-helper.shCLAUDE.md,README.md,install.shtests/unit/test_manifest_validation.pytests/validation/test_link_integrity.pytests/unit/test_lookup_functions.pytests/integration/test_github_actions.pyTest plan