Skip to content

fix: four self-audit defects — release-profile test gate, obsolete overlay verdict, skill-store ownership, dead resume duplicate - #67

Merged
2233admin merged 5 commits into
mainfrom
fix/pipeline-audit-2026-07-29
Jul 29, 2026
Merged

fix: four self-audit defects — release-profile test gate, obsolete overlay verdict, skill-store ownership, dead resume duplicate#67
2233admin merged 5 commits into
mainfrom
fix/pipeline-audit-2026-07-29

Conversation

@2233admin

Copy link
Copy Markdown
Owner

Four defects found by auditing the pipeline against itself at v0.7.0-beta.1, plus the machine-state repairs they exposed. No product behavior changes beyond the defects named below.

What was wrong

cargo test --release failed on a clean tree.
inventory_rejects_simulated_rg_extra_path_without_publication expected exit 65 and got 0. The CODE_INTEL_TEST_RG_EXTRA_PATH hook it drives is #[cfg(debug_assertions)] in capability_inventory.rs, deliberately, so the shipped binary carries no inventory fault injection — but the test itself was unconditional. CI only runs cargo test (debug) and then cargo build --release, so this never surfaced there.

Gated the test on the same cfg as the hook it exercises. The contract it guards (verify_inventory_path_sets refusing to publish on a set mismatch) is compiled into every profile; only the simulation is debug-only.

Every install run reported repowise-thinking-patch: install_failed.
Repair-RepowiseThinkingBlockPatch knew two shapes of the installed repowise anthropic provider: our patched form, and the pre-fix content=response.content[0].text. Anything else was a failure.

Upstream repowise 0.32.0 fixed the ThinkingBlock crash itself — it iterates response.content and takes the first block with .text, skipping a ThinkingBlock (which carries .thinking). So a healthy machine reported install_failed on every run, which turns a real failure signal into noise. Added a not_needed verdict for the upstream-fixed shape; install_failed still fires for a layout matching neither. The overlay stays until every supported machine runs repowise >= 0.32.0, since it is the only thing between an older pinned install and a silent total_pages=0.

skill:claude verified that a SKILL.md existed, not whose it was.
Agent hosts share those directories with other skill managers. On the machine this was found on, ~/.claude/skills/code-intel-pipeline was a junction into an unrelated ~/.skillz store holding a 2026-06-21 SKILL.md whose canonical paths all pointed at a legacy clone. Every -RepairSkillLinks run refreshed .agents and .codex, reported OK skill:claude, and left the skill Claude Code actually loads five weeks stale.

Now only two shapes pass: a link that resolves to the bundled-skill source, or a plain copy whose SKILL.md bytes match it (link-less macOS/Linux installs). On repair the previous occupant is moved aside, never deleted — a reparse point is unlinked, since the store it pointed at keeps every byte, and a real directory is renamed so a foreign skill stays recoverable.

Connected bug found while fixing it: installing the bundled skill copied __pycache__ / *.pyc into the agent host's skill directory. One bootstrap.cpython-313.pyc left by a local bootstrap.py run made the byte-parity check report skill:source outdated permanently — which is how a genuinely stale install stayed camouflaged.

main.rs carried a dead duplicate of the resume contract.
ResumeSummary, four JSON helpers, next_read, a #[cfg(test)] build_resume_summary, and a verbatim copy of two resume contract tests — all superseded by artifacts.rs / artifacts_tests.rs. cmd_resume delegates to artifacts::resume, so nothing was serving the copy, and artifacts_tests.rs already defines the same two tests under the same names. 274 lines removed, coverage unchanged.

What this deliberately does not do

The crate reports ~100 dead-code warnings on a clean tree and this PR does not chase them, nor add a -D warnings gate.

There is no lib.rs; modules are shared by #[path = "..."] mod x; re-inclusion, so one source file compiles once per including module and each instantiation warns about the slice it happens not to use. hardened_git.rs already keys a test temp directory on module_path!() for exactly this reason. Deleting an item one instantiation ignores breaks the instantiation that does not. A -D warnings gate would fail on a clean tree, and the count is not a debt metric. AGENTS.md now says so, next to a note on re-syncing the orchestration/**/*.json digest pins that source edits invalidate — those must be re-synced by literal replacement, never by reserializing the JSON, because several of those files are historical attestations whose formatting and unrelated digests must not move.

Three findings that did not hold up

Recorded because the reasoning is worth not repeating:

  • "repowise crashes but exits 0, so the pipeline reports it passed." It exits 1. The earlier EXIT=0 reading was $LASTEXITCODE sampled after a Select-String pipeline, which does not reflect the native command. The pipeline reports repowise status failed exit=1 correctly. Hardening was written and reverted.
  • "deleted capabilities are unflagged orphans." deleted is a first-class terminal state carrying a reviewedDeletion record with evidence, and the helper scripts are retained on purpose with tests and CI parser coverage.
  • "113 warnings are removable debt." See above.

Verification

  • cargo test -p code-intel --locked — exit 0
  • cargo test -p code-intel --release — exit 0 (this is the one that was failing)
  • cargo fmt -p code-intel -- --check — exit 0
  • cargo build -p code-intel --release --locked — exit 0
  • scripts/tests/test-regression-fixes.ps1 — 49 passed, 0 failed (was 42; +7 cases covering the four-state overlay verdict, skill-occupancy detection, non-destructive repair, and __pycache__ exclusion)
  • run-code-intel.ps1 -Mode lite against a real repo — all steps as expected
  • code-intel run execute full DAG — 7 nodes succeeded, published

Digest pins in orchestration/ re-synced once, after every other edit, by literal replacement.

`cargo test --release` failed on
`inventory_rejects_simulated_rg_extra_path_without_publication`: it expected
exit 65 but got 0. The `CODE_INTEL_TEST_RG_EXTRA_PATH` hook it drives is
`#[cfg(debug_assertions)]` in `capability_inventory.rs` so the shipped binary
carries no inventory fault injection, but the test itself was unconditional.
CI only runs `cargo test` (debug), so the failure never surfaced there.

Gate the test on the same cfg as the hook it exercises, and document why. The
contract under test — `verify_inventory_path_sets` refusing to publish on a set
mismatch — is compiled into every profile; only the simulation is debug-only.

Also silence the resulting release-profile `unused_mut` on `actual_baseline`
with a targeted `cfg_attr` rather than dropping `mut`, which debug builds need.
… one

`Repair-RepowiseThinkingBlockPatch` recognised two shapes of the installed
repowise anthropic provider: our patched form, and the pre-fix
`content=response.content[0].text`. Anything else was reported
`install_failed: expected pattern not found`.

Upstream repowise 0.32.0 fixed the ThinkingBlock crash on its own — it now
iterates `response.content` and takes the first block with `.text`, which
skips a ThinkingBlock (it carries `.thinking`). So every healthy machine has
been reporting `install_failed` on every install run, which turns a real
failure signal into noise we learn to scroll past.

Add a `not_needed` verdict for the upstream-fixed shape, keep `install_failed`
for a layout matching neither, and leave upstream source untouched in both
read-only cases. The overlay stays until every supported machine runs
repowise >= 0.32.0, since it is the only thing standing between an older
pinned install and a silent `total_pages=0`.

Covered by three regression cases (not_needed / installed / install_failed)
that point the APPDATA-derived lookup at a scratch tree.
`Ensure-SkillLink` accepted any path with a `SKILL.md` in it. Agent hosts share
those directories with other skill managers, so a manager we do not control can
own the path and the installer will still report `OK skill:claude`.

That is not hypothetical. On the machine this was found on,
`~/.claude/skills/code-intel-pipeline` was a junction into an unrelated
`~/.skillz` store holding a 2026-06-21 SKILL.md whose canonical paths all
pointed at a legacy clone. Every `-RepairSkillLinks` run refreshed `.agents` and
`.codex`, reported `OK skill:claude`, and left the skill Claude Code actually
loads five weeks stale.

Accept only a link that resolves to the bundled-skill source, or a plain copy
whose SKILL.md bytes match it (link-less macOS/Linux installs). Report anything
else as occupied. On repair, move the previous occupant aside rather than
deleting it: unlink a reparse point, since the store it pointed at keeps every
byte, and rename a real directory so a foreign skill stays recoverable.

Also stop copying `__pycache__` / `*.pyc` into the installed skill. A single
`bootstrap.cpython-313.pyc` left by a local `bootstrap.py` run made the
byte-parity check report `skill:source` outdated forever, which is how a
genuinely stale install stayed camouflaged.
…s extraction

`main.rs` still carried `ResumeSummary`, `bool_at`, `existing_path`,
`string_path`, `string_first`, `next_read`, a `#[cfg(test)]`
`build_resume_summary`, and a verbatim copy of two resume contract tests. All of
it duplicates `artifacts.rs` / `artifacts_tests.rs`, which took over the job:
`cmd_resume` delegates to `artifacts::resume`, so nothing has been serving the
copy in `main.rs`. Coverage is unchanged — `artifacts_tests.rs` already defines
the same two contract tests under the same names.

Also drop three unused imports, and move `MAX_JSON_DEPTH` into the single test
that uses it rather than re-exporting it crate-wide from `capability.rs`.

This does NOT chase the remaining ~100 dead-code warnings, and deliberately adds
no `-D warnings` gate. The crate has no `lib.rs`; modules are shared by
`#[path]` re-inclusion, so each instantiation warns about the slice of the file
it happens not to use. Those warnings are structural, the count is not a debt
metric, and deleting what one instantiation ignores breaks the one that does not.
AGENTS.md now says so, next to a note on re-syncing the orchestration digest
pins that source edits invalidate.
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@2233admin, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 19 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 07f6c767-22a2-43ce-80b7-d9dd2bf8fe46

📥 Commits

Reviewing files that changed from the base of the PR and between a57528f and 0ad213c.

📒 Files selected for processing (2)
  • AGENTS.md
  • scripts/tests/test-regression-fixes.ps1
📝 Walkthrough

Walkthrough

The PR removes stale Rust resume code, updates debug-only test behavior and digest pins, improves PowerShell skill and Repowise installer repairs, adds regression coverage, and documents verification and release changes.

Changes

Rust cleanup and contract updates

Layer / File(s) Summary
Rust cleanup and test behavior
crates/code-intel-cli/src/capability.rs, crates/code-intel-cli/src/capability_inventory.rs, crates/code-intel-cli/src/main.rs, crates/code-intel-cli/src/sentrux_gate.rs, crates/code-intel-cli/tests/capability_exec.rs
Removes stale resume code and unused imports, localizes MAX_JSON_DEPTH to tests, and gates inventory fault injection to debug builds.
Capability test digest alignment
crates/code-intel-cli/tests/artifact_ref.rs, crates/code-intel-cli/tests/capability_exec.rs
Updates implementation digests in capability request fixtures and workflow recommendation tests.

Installer repair behavior

Layer / File(s) Summary
Overlay and skill installation logic
install-code-intel-pipeline.ps1
Detects upstream Repowise fixes, validates skill targets, preserves displaced occupants, excludes cache files, and uses curated files for parity and atomic installation.
Installer regression coverage and documentation
scripts/tests/test-regression-fixes.ps1, overlays/repowise/README.md
Adds regression coverage for overlay verdicts and skill repairs, and documents installer states and overlay retirement.

Contract and evidence synchronization

Layer / File(s) Summary
Capability implementation pins
orchestration/integrations.json, run-code-intel.ps1
Synchronizes capability implementation digests with the updated sources.
Internalization evidence records
orchestration/internalization/*.json
Updates source, conformance, operation-trace, and owned-modification hashes.
Verification guidance and release notes
AGENTS.md, CHANGELOG.md
Documents warning-count interpretation, digest resynchronization, and the fixes included in the unreleased changelog.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TestHarness
  participant Installer
  participant RepowiseProvider
  participant SkillStore
  TestHarness->>Installer: run repair and skill-install scenarios
  Installer->>RepowiseProvider: inspect provider response.content
  RepowiseProvider-->>Installer: upstream layout
  Installer->>SkillStore: validate, displace, or copy skill files
  SkillStore-->>Installer: target and parity result
  Installer-->>TestHarness: not_needed, installed, install_failed, or repair result
Loading

Possibly related PRs

Poem

A bunny checked each skill-link path,
And cached crumbs were swept from math.
Rust shed stale code, pins aligned,
Repowise’s verdicts now are kind.
“Not needed!” sang the hare—
Clean repairs everywhere!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the four main fixes and matches the changeset.
Description check ✅ Passed The description is detailed and directly describes the implemented fixes and verification.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
overlays/repowise/README.md (1)

35-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Lead the verification instructions with code-intel.

This new command example starts with rg; document the compiled code-intel equivalent first and retain the direct file search only as a legacy PowerShell compatibility fallback. As per coding guidelines, “New documentation and command examples should lead with the compiled code-intel CLI and mention PowerShell only for existing compatibility paths.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@overlays/repowise/README.md` around lines 35 - 37, Update the verification
instructions in the README to lead with the compiled code-intel CLI equivalent
for the Anthropic source search. Retain the existing rg PowerShell command only
as a clearly labeled legacy compatibility fallback, preserving the same search
targets and intent.

Source: Coding guidelines

install-code-intel-pipeline.ps1 (1)

746-762: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Resolve relative link targets from the link location.

Path.GetFullPath($item.LinkTarget) resolves relative link targets from the current working directory, so an existing relative skill link is incorrectly treated as foreign under -RepairSkillLinks. Use ResolveLinkTarget($true) and compare ResolveLinkTarget(...).FullName to the normalized target path instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@install-code-intel-pipeline.ps1` around lines 746 - 762, Update the
link-detection logic in the surrounding skill-link validation function to
resolve relative targets from the link location by using the item’s
ResolveLinkTarget($true) result. Compare its FullName with the normalized target
path, while preserving the existing fallback hash comparison and false-on-error
behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@install-code-intel-pipeline.ps1`:
- Around line 894-902: The installation flow around
Get-BundledSkillRelativeFiles must preserve a foreign or outdated $InstalledPath
occupant after replacement instead of deleting its $backup; retain the moved
content under a recoverable .replaced-* name, matching Ensure-SkillLink
behavior, and add a regression fixture covering this replacement path.

In `@overlays/repowise/README.md`:
- Line 39: Update the “Status: superseded upstream” heading in the README to use
the actual verification date, July 28, 2026, or remove the verification date
entirely.

---

Nitpick comments:
In `@install-code-intel-pipeline.ps1`:
- Around line 746-762: Update the link-detection logic in the surrounding
skill-link validation function to resolve relative targets from the link
location by using the item’s ResolveLinkTarget($true) result. Compare its
FullName with the normalized target path, while preserving the existing fallback
hash comparison and false-on-error behavior.

In `@overlays/repowise/README.md`:
- Around line 35-37: Update the verification instructions in the README to lead
with the compiled code-intel CLI equivalent for the Anthropic source search.
Retain the existing rg PowerShell command only as a clearly labeled legacy
compatibility fallback, preserving the same search targets and intent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: aeeda794-a7a5-44ff-8b01-b076ccdb67e1

📥 Commits

Reviewing files that changed from the base of the PR and between 771870b and a57528f.

📒 Files selected for processing (16)
  • AGENTS.md
  • CHANGELOG.md
  • crates/code-intel-cli/src/capability.rs
  • crates/code-intel-cli/src/capability_inventory.rs
  • crates/code-intel-cli/src/main.rs
  • crates/code-intel-cli/src/sentrux_gate.rs
  • crates/code-intel-cli/tests/artifact_ref.rs
  • crates/code-intel-cli/tests/capability_exec.rs
  • install-code-intel-pipeline.ps1
  • orchestration/integrations.json
  • orchestration/internalization/ast-grep.json
  • orchestration/internalization/rg.json
  • orchestration/internalization/sentrux.json
  • overlays/repowise/README.md
  • run-code-intel.ps1
  • scripts/tests/test-regression-fixes.ps1
💤 Files with no reviewable changes (2)
  • crates/code-intel-cli/src/sentrux_gate.rs
  • crates/code-intel-cli/src/main.rs

Comment thread install-code-intel-pipeline.ps1
Comment thread overlays/repowise/README.md
`cross-platform-smoke (windows-latest)` failed on
`tools/check-hardcoded-paths.ps1`. The scanner strips `$env:VAR` references
before matching, so it flags a scanned Windows user-directory variable named
bare — and the new helper's comment named one in prose. Reworded to the
`$env:`-prefixed form, which is more precise anyway.

Documented the trap in AGENTS.md, since prose and comments are exactly where it
is easy to miss: the scan covers tracked `.md` too, and the first draft of that
very note tripped the scan for the same reason.
@2233admin
2233admin merged commit d7185a2 into main Jul 29, 2026
10 checks passed
@2233admin
2233admin deleted the fix/pipeline-audit-2026-07-29 branch July 29, 2026 16:37
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