Skip to content

refactor(doctor): T3 — 工具/运行时体检面进 Rust doctor bootstrap (#48) - #70

Merged
2233admin merged 4 commits into
mainfrom
claudeMaster/ps1-rust-migration-60fe9a
Jul 30, 2026
Merged

refactor(doctor): T3 — 工具/运行时体检面进 Rust doctor bootstrap (#48)#70
2233admin merged 4 commits into
mainfrom
claudeMaster/ps1-rust-migration-60fe9a

Conversation

@2233admin

Copy link
Copy Markdown
Owner

T3: 工具/运行时体检面进 Rust

PS1 巨石退役战役的第三票,第一刀。archive/check-code-intel-tools.ps1409 行降到 35 行代码(59 行含注释),体检逻辑全部进 crates/code-intel-cli/src/doctor_bootstrap.rs,对外是新子命令 code-intel doctor bootstrap

code-intel doctor bootstrap --repo-path . --no-require-repowise --json

契约不变

输出仍是 code-intel-doctor-bootstrap-observation.v1authority: observation_onlyok / missing 这对字段连措辞和顺序都保留。checks.* 形状不动,所以 installer 和 CI 消费方不用改。

搬过来的行为:config 解析与 parseError、repo alias 查找与 -RepoPath 反向查找、sentruxPath scope 解析、六个工具探测(python→python3 回退)、sentrux check --helpsentrux pro status 的输出匹配、understand skill/plugin 候选路径、graphProvider 的 release→debug 优先级、CODE_INTEL_HOME 与默认推导的比对。

tier 匹配是手写的——这个 crate 不带 regex 依赖——并保持大小写不敏感,与 PowerShell -match 语义一致。

顺手修掉一个真 bug

doctor_adapter 原本 spawn pwsh 跑 PS1 探针;当 pwsh 或脚本起不来时,回退到一个进程内近似实现,而那个实现把 graphProvidersourceFound / cargoFound / binaryFound 硬编码成 true。doctor 存在的全部意义就是暴露这类漂移,它却对自己撒谎。

现在只有一份原生实现:没有回退路径,kernel 路径不再依赖 pwsh,跨平台答案一致。

E09 兼容工具的路径 bug

PR #68 把 PowerShell 搬进 archive/ 后,New-DoctorWrapperRetirementPacket.ps1Test-DoctorWrapperRetirementPacket.ps1$RepoRoot 落在 archive/,但它们的 frozen 输入表混了两种相对基准——crates/*orchestration/* 是仓根相对的,却也被 join 到 archive/ 下面,于是在跑到任何真实检查之前就抛 Get-FileHash: Could not find a part of the path

两个脚本现在都把 crates/* / orchestration/* 解析到 $PipelineRepoRoot,其余解析到 $RepoRoot。验证器因此能跑到它设计好的裁决了。

这两个脚本不在任何 workflow 里(grep Test-DoctorWrapperRetirementPacket 只命中一篇 doc 和一份 evidence 记录),这就是它坏了没人发现的原因。

验证

结果
cargo test -p code-intel 45 套,0 failed
cargo fmt -p code-intel -- --check 干净
orchestrate --action Validate ok: true,0 errors
test-doctor-repo-config-resolution.ps1 PASS(走 forwarder)
test-regression-fixes.ps1 49 passed, 0 failed
test-code-intel-pipeline.ps1 -RepoPath . -SkipRepowise ok: true

新增 crates/code-intel-cli/tests/doctor_bootstrap_cli.rs(6 个契约测试)钉住 schema、observation_only、adapter 实际读的三个 pointer、CI 依赖的退出码,以及一条「forwarder 必须 ≤50 行代码」的守门断言——防止逻辑长回 PowerShell。probe 本身另有 10 个单元测试。

test-regression-fixes.ps1 里两个 doctor graph-provider 用例改成直调二进制并传 --pipeline-root <scratch>:断言一字未改,但 scratch 树里那个假二进制不能被当成真 CLI 执行。

toolchainDigests 在所有源码编辑完成后一次性重算,现在是三条(新增 doctor_bootstrap.rs)。

出口对照(issue #48

  • doctor envelope 覆盖 check-code-intel-tools.ps1 的全部检查项
  • 该 ps1 ≤50 行 shim
  • ci.yml / release.yml 相应步骤直调二进制(3 处)
  • Invoke-ProviderRuntimeInventory.ps1 —— 本 PR 不含

不在范围内

Invoke-ProviderRuntimeInventory.ps1(21.5K)是 issue #48 点名的第二个文件,留给下一刀。

E09 retirement packet 还有一个更深的问题,与本 PR 无关且早于本分支:它守护的 invoke-code-intel.doctor.direct-production 分支已被 804e2f0 feat: make compiled CLI the primary entry 删除——今天的 archive/invoke-code-intel.ps1doctor 零命中。所以 packet 无法用它自己的生成器重新生成(生成器强制要求 live 文件里存在那三个 route marker),而且 git diff --stat 42de063 e4e76d6 显示它六个 frozen 输入在本分支存在之前就全部变过了。本 PR 只修它的路径 bug,不动那份冻结记录——把 packet 与已删除的分支对账需要 retirement gate 要求的审批证据,那是另一张票。

Refs #48

T3 of the PS1 retirement campaign. `archive/check-code-intel-tools.ps1`
drops from 409 lines to a 35-line forwarder; the tool/runtime health
inventory it implemented now lives in
`crates/code-intel-cli/src/doctor_bootstrap.rs`, surfaced as
`code-intel doctor bootstrap`.

The observation contract is unchanged: same
`code-intel-doctor-bootstrap-observation.v1` schema, same
`observation_only` authority, same `ok`/`missing` pair and wording, same
`checks.*` shape. Installer and CI consumers need no adaptation. Ported
behaviors include config parsing, repo-alias and reverse-path lookup,
`sentruxPath` scope resolution, the python/python3 fallback, the
`sentrux check --help` and `sentrux pro status` output matching (the
tier pattern is hand-rolled — the crate carries no regex dependency —
and stays case-insensitive to match PowerShell `-match`), the understand
skill/plugin candidate paths, release-before-debug graph binary
discovery, and the `CODE_INTEL_HOME` default-derivation comparison.

Fixes a real defect in passing. `doctor_adapter` used to shell out to the
PowerShell probe and, when `pwsh` or the script could not be launched,
fall back to an in-process approximation that reported `graphProvider`
presence as hardcoded `true` — masking exactly the drift doctor exists to
surface. With one native probe there is no fallback path and no `pwsh`
dependency on the kernel path.

Also repairs a path-resolution bug in the E09 compatibility tooling,
introduced when PR #68 moved PowerShell under `archive/`:
`New-DoctorWrapperRetirementPacket.ps1` and
`Test-DoctorWrapperRetirementPacket.ps1` resolved their repo-root-relative
frozen inputs (`crates/*`, `orchestration/*`) against `archive/` and threw
`Get-FileHash: Could not find a part of the path` before reaching any
real check. Neither script is wired into CI, which is why it went
unnoticed. The verifier now reports its designed verdict.

Verification:
- cargo test -p code-intel: 45 suites, 0 failed
- cargo fmt -p code-intel -- --check: clean
- new tests/doctor_bootstrap_cli.rs pins the schema, exit code, and a
  <=50-line cap on the forwarder; 10 unit tests cover the probe
- test-doctor-repo-config-resolution.ps1 passes through the forwarder
- test-regression-fixes.ps1: 49 passed (its two doctor graph-provider
  cases now drive the binary with --pipeline-root, since a scratch tree's
  fake binary must never be executed as the real CLI)
- test-code-intel-pipeline.ps1 -RepoPath . -SkipRepowise: ok

Not in scope: `Invoke-ProviderRuntimeInventory.ps1`, the second PowerShell
file named by the ticket.

Refs #48
@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 30, 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: 38 seconds

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: e60d2ef6-38ba-4ad8-a5ee-a91afc501c53

📥 Commits

Reviewing files that changed from the base of the PR and between 4be1926 and 52a4647.

📒 Files selected for processing (9)
  • .sentrux/baseline.json
  • .sentrux/rules.toml
  • crates/code-intel-cli/src/doctor_adapter.rs
  • crates/code-intel-cli/src/doctor_bootstrap/config.rs
  • crates/code-intel-cli/src/doctor_bootstrap/mod.rs
  • crates/code-intel-cli/src/doctor_bootstrap/paths.rs
  • crates/code-intel-cli/src/doctor_bootstrap/probe.rs
  • crates/code-intel-cli/tests/doctor_bootstrap_cli.rs
  • orchestration/integrations.json
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added the code-intel doctor bootstrap command for cross-platform health and environment checks.
    • Provides human-readable or JSON results with consistent status, missing-item reporting, and exit codes.
  • Bug Fixes

    • Doctor checks no longer depend on PowerShell or return inaccurate fallback results when PowerShell is unavailable.
    • Missing binaries and invalid configuration are reported cleanly instead of causing crashes.
  • Compatibility

    • Existing installer and rollback entry points continue to work through a compatibility forwarder.
    • The established observation format remains compatible with CI and installer integrations.

Walkthrough

The doctor bootstrap health probe is implemented in Rust, exposed through code-intel doctor bootstrap, and used by adapters, CI, release workflows, and orchestration metadata. The PowerShell script now forwards to the binary, while tests and documentation preserve the observation contract.

Changes

Doctor bootstrap migration

Layer / File(s) Summary
Native bootstrap probe
crates/code-intel-cli/src/doctor_bootstrap.rs
Adds native observation, tool and repository checks, configuration resolution, human/JSON rendering, exit handling, and unit tests.
CLI and adapter integration
crates/code-intel-cli/src/doctor_adapter.rs, crates/code-intel-cli/src/main.rs
Routes doctor bootstrap to the Rust probe and makes the adapter invoke it in-process with schema validation.
CLI contract validation
crates/code-intel-cli/tests/doctor_bootstrap_cli.rs
Tests observation shape, missing repositories, configuration errors, argument failures, repository resolution, and the thin PowerShell shim.
Forwarder and operational wiring
archive/check-code-intel-tools.ps1, archive/scripts/tests/*, .github/workflows/*, orchestration/*
Converts the PowerShell implementation into a binary forwarder and updates regression tests, CI, release, and integration metadata to use the native command.
Compatibility documentation and snapshots
CHANGELOG.md, docs/doctor-envelope.md, archive/tools/compatibility/*
Documents native observation behavior and updates retirement-packet hashing for relocated source paths.

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

Sequence Diagram(s)

sequenceDiagram
  participant CI as CI or release workflow
  participant CLI as code-intel doctor bootstrap
  participant Probe as Native Rust probe
  participant Repo as Repository and config
  participant Tools as Toolchain
  CI->>CLI: Invoke with repository and requirement flags
  CLI->>Probe: Parse options and run observation
  Probe->>Repo: Resolve paths and inspect repository state
  Probe->>Tools: Probe required tools and provider artifacts
  Probe-->>CLI: Emit observation JSON or human output
  CLI-->>CI: Return success or diagnostic exit code
Loading

Possibly related issues

Possibly related PRs

Poem

A rabbit hops where PowerShell ran,
Rust now checks the doctor plan.
Tools and paths are neatly known,
The shim forwards, light as bone.
CI sings with flags in flight—
Bootstrap bounds the build just right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly highlights the main change: moving doctor bootstrap health checks into native Rust.
Description check ✅ Passed The description matches the changeset and explains the Rust migration, contract stability, tests, and related fixes.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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: 1

🧹 Nitpick comments (7)
crates/code-intel-cli/src/doctor_bootstrap.rs (4)

535-539: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Collapse the nested if (Clippy collapsible_if).

-        if trimmed.len() < after.len() {
-            if trimmed.starts_with("pro") || (!require_pro && trimmed.starts_with("free")) {
-                return true;
-            }
-        }
+        if trimmed.len() < after.len()
+            && (trimmed.starts_with("pro") || (!require_pro && trimmed.starts_with("free")))
+        {
+            return true;
+        }
🤖 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 `@crates/code-intel-cli/src/doctor_bootstrap.rs` around lines 535 - 539,
Collapse the nested conditions in the relevant doctor bootstrap logic into a
single if statement, preserving the existing trimmed-length check and the
`pro`/optional `free` prefix behavior that returns true.

Source: Linters/SAST tools


150-162: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

SENTRUX_AUTO_PRO truthiness matches an ad-hoc subset of casings.

"1" | "true" | "True" | "TRUE" accepts three of the eight casings of true; TRue/tRue silently mean "not opted in". A case-insensitive compare removes the guesswork.

-    let require_pro_tier = matches!(
-        env::var("SENTRUX_AUTO_PRO").unwrap_or_default().as_str(),
-        "1" | "true" | "True" | "TRUE"
-    );
+    let raw_pro_tier = env::var("SENTRUX_AUTO_PRO").unwrap_or_default();
+    let raw_pro_tier = raw_pro_tier.trim();
+    let require_pro_tier = raw_pro_tier == "1" || raw_pro_tier.eq_ignore_ascii_case("true");
🤖 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 `@crates/code-intel-cli/src/doctor_bootstrap.rs` around lines 150 - 162,
Simplify the SENTRUX_AUTO_PRO parsing used to initialize require_pro_tier so the
value "true" is accepted case-insensitively, while preserving support for "1".
Update the matches expression immediately before the sentrux_pro probe rather
than changing matches_tier or probe_command_output.

495-517: 🩺 Stability & Availability | 🔵 Trivial

No timeout around the external sentrux invocations.

command.output() blocks until the child exits. sentrux pro status in particular can reach out to a licensing backend; if it stalls, code-intel doctor bootstrap stalls with it, and CI has no bounded failure. The retired PowerShell path had the same shape, so this is not a regression — but now that the probe sits on the adapter's kernel path it is worth bounding (spawn + a wait-with-deadline, treating expiry as found: false with an output note).

🤖 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 `@crates/code-intel-cli/src/doctor_bootstrap.rs` around lines 495 - 517, Bound
the external probe execution in the command-handling flow around
Command::output, especially for sentrux status checks, by spawning the child and
waiting with a deadline instead of blocking indefinitely. On timeout, terminate
or reap the child and return JSON with found: false and an output note
indicating the timeout; preserve the existing stdout/stderr matching behavior
for completed processes and the existing spawn-error handling.

433-440: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Option<&&Value> forces callers into double references.

The extra indirection is why the unit test has to write Some(&&entry.clone()) (line 1027). Option<&Value> reads better and both call sites simplify.

♻️ Proposed signature change
-fn resolve_sentrux_scope(repo_path: &Path, repo_config: Option<&&Value>) -> PathBuf {
+fn resolve_sentrux_scope(repo_path: &Path, repo_config: Option<&Value>) -> PathBuf {

Then at line 89 pass repo_config (it is already Option<&Value>, so .copied() on the as_ref() is unnecessary — just drop the .as_ref()), and in the test pass Some(entry).

🤖 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 `@crates/code-intel-cli/src/doctor_bootstrap.rs` around lines 433 - 440, Change
resolve_sentrux_scope to accept Option<&Value> instead of Option<&&Value>.
Update the call site to pass repo_config directly without as_ref().copied(), and
simplify the unit test argument from Some(&&entry.clone()) to Some(entry).
crates/code-intel-cli/src/main.rs (1)

1605-1605: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

--pipeline-root is accepted but undocumented.

run_raw parses --pipeline-root (and the CLI contract tests depend on it), yet the help line omits it. Either document it or note in the module docs that it is a test-only escape hatch, so the next reader does not treat the omission as a parser bug.

🤖 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 `@crates/code-intel-cli/src/main.rs` at line 1605, Update the bootstrap help
text near run_raw to document the accepted --pipeline-root option, including its
purpose and expected value; alternatively, explicitly identify it in the
surrounding module documentation as a test-only escape hatch while preserving
the existing parser and contract-test behavior.
crates/code-intel-cli/tests/doctor_bootstrap_cli.rs (1)

203-219: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The forwarder assertions pass on comments alone.

code_lines already strips # comments, but text.contains("doctor") / contains("bootstrap") are checked against the whole file — a shim that merely mentions the command in its header comment satisfies both. Matching against the filtered code lines makes the test say what its message claims.

♻️ Tighten the forwarder assertions
-    let code_lines = text
+    let code: Vec<&str> = text
         .lines()
         .filter(|line| {
             let trimmed = line.trim();
             !trimmed.is_empty() && !trimmed.starts_with('#')
         })
-        .count();
+        .collect();
+    let code_lines = code.len();
     assert!(
         code_lines <= 50,
         "{} has {code_lines} code lines; T3 caps the shim at 50",
         script.display()
     );
-    assert!(text.contains("doctor"), "forwarder must invoke the binary");
-    assert!(
-        text.contains("bootstrap"),
-        "forwarder must invoke the binary"
-    );
+    let body = code.join("\n");
+    assert!(
+        body.contains("doctor") && body.contains("bootstrap"),
+        "forwarder must invoke `code-intel doctor bootstrap`"
+    );
🤖 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 `@crates/code-intel-cli/tests/doctor_bootstrap_cli.rs` around lines 203 - 219,
Update the forwarder assertions in the test around code_lines so command checks
inspect only non-empty, non-comment code lines rather than the raw text. Reuse
the filtered code-line content for the “doctor” and “bootstrap” assertions,
preserving the existing line-count limit and failure messages.
archive/tools/compatibility/New-DoctorWrapperRetirementPacket.ps1 (1)

15-15: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Frozen source set still omits the new authoritative probe implementation. The doctor behavior now lives in crates/code-intel-cli/src/doctor_bootstrap.rs, but neither the generator's $frozen list nor the verifier's $snapshotInputs includes it, so the packet's snapshotIdentity will not invalidate when the probe changes.

  • archive/tools/compatibility/New-DoctorWrapperRetirementPacket.ps1#L15-L15: add crates/code-intel-cli/src/doctor_bootstrap.rs to $frozen (keep the order deliberate).
  • archive/tools/compatibility/Test-DoctorWrapperRetirementPacket.ps1#L29-L33: add the same entry in the identical position to $snapshotInputs.
🤖 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 `@archive/tools/compatibility/New-DoctorWrapperRetirementPacket.ps1` at line
15, The frozen source set must include the authoritative doctor probe
implementation so snapshotIdentity changes when it is modified. In
archive/tools/compatibility/New-DoctorWrapperRetirementPacket.ps1:15, add
crates/code-intel-cli/src/doctor_bootstrap.rs to $frozen in the deliberate
matching order; make the identical addition to $snapshotInputs in
archive/tools/compatibility/Test-DoctorWrapperRetirementPacket.ps1:29-33.
🤖 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 `@crates/code-intel-cli/src/doctor_bootstrap.rs`:
- Around line 21-26: Gate or explicitly allow dead-code warnings for the
CLI-only surface in doctor_bootstrap.rs. Apply the same treatment used for the
existing CLI-only item to run_raw, fail, pipeline_root, and check_names, while
keeping Options, observe, and BOOTSTRAP_SCHEMA available to the embedded
doctor_adapter module.

---

Nitpick comments:
In `@archive/tools/compatibility/New-DoctorWrapperRetirementPacket.ps1`:
- Line 15: The frozen source set must include the authoritative doctor probe
implementation so snapshotIdentity changes when it is modified. In
archive/tools/compatibility/New-DoctorWrapperRetirementPacket.ps1:15, add
crates/code-intel-cli/src/doctor_bootstrap.rs to $frozen in the deliberate
matching order; make the identical addition to $snapshotInputs in
archive/tools/compatibility/Test-DoctorWrapperRetirementPacket.ps1:29-33.

In `@crates/code-intel-cli/src/doctor_bootstrap.rs`:
- Around line 535-539: Collapse the nested conditions in the relevant doctor
bootstrap logic into a single if statement, preserving the existing
trimmed-length check and the `pro`/optional `free` prefix behavior that returns
true.
- Around line 150-162: Simplify the SENTRUX_AUTO_PRO parsing used to initialize
require_pro_tier so the value "true" is accepted case-insensitively, while
preserving support for "1". Update the matches expression immediately before the
sentrux_pro probe rather than changing matches_tier or probe_command_output.
- Around line 495-517: Bound the external probe execution in the
command-handling flow around Command::output, especially for sentrux status
checks, by spawning the child and waiting with a deadline instead of blocking
indefinitely. On timeout, terminate or reap the child and return JSON with
found: false and an output note indicating the timeout; preserve the existing
stdout/stderr matching behavior for completed processes and the existing
spawn-error handling.
- Around line 433-440: Change resolve_sentrux_scope to accept Option<&Value>
instead of Option<&&Value>. Update the call site to pass repo_config directly
without as_ref().copied(), and simplify the unit test argument from
Some(&&entry.clone()) to Some(entry).

In `@crates/code-intel-cli/src/main.rs`:
- Line 1605: Update the bootstrap help text near run_raw to document the
accepted --pipeline-root option, including its purpose and expected value;
alternatively, explicitly identify it in the surrounding module documentation as
a test-only escape hatch while preserving the existing parser and contract-test
behavior.

In `@crates/code-intel-cli/tests/doctor_bootstrap_cli.rs`:
- Around line 203-219: Update the forwarder assertions in the test around
code_lines so command checks inspect only non-empty, non-comment code lines
rather than the raw text. Reuse the filtered code-line content for the “doctor”
and “bootstrap” assertions, preserving the existing line-count limit and failure
messages.
🪄 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: bc5238c2-89dd-4615-b17d-f99f25cf54de

📥 Commits

Reviewing files that changed from the base of the PR and between e4e76d6 and 4be1926.

📒 Files selected for processing (14)
  • .github/workflows/ci.yml
  • .github/workflows/release.yml
  • CHANGELOG.md
  • archive/check-code-intel-tools.ps1
  • archive/scripts/tests/test-regression-fixes.ps1
  • archive/tools/compatibility/New-DoctorWrapperRetirementPacket.ps1
  • archive/tools/compatibility/Test-DoctorWrapperRetirementPacket.ps1
  • crates/code-intel-cli/src/doctor_adapter.rs
  • crates/code-intel-cli/src/doctor_bootstrap.rs
  • crates/code-intel-cli/src/main.rs
  • crates/code-intel-cli/tests/doctor_bootstrap_cli.rs
  • docs/doctor-envelope.md
  • orchestration/facade-finalize-policy.v1.json
  • orchestration/integrations.json

Comment thread crates/code-intel-cli/src/doctor_bootstrap.rs Outdated
CI's self-scan caught a real regression in the previous commit: landing the
native probe as one 1124-line file tripped the repo's own structural gate,
`god_file_count 32 -> 33` (`god_file: loc > 800 || (functions > 25 && loc >
400)`), which cost 120 quality points and failed `run execute` with exit 10
on all three platforms.

The probe is now four cohesive modules instead of one file:

  doctor_bootstrap/mod.rs     envelope assembly, missing list, CLI surface
  doctor_bootstrap/config.rs  pipeline.config.json and repo resolution
  doctor_bootstrap/paths.rs   platform derivation and path resolution
  doctor_bootstrap/probe.rs   tool presence and command-output probing

No file is a god file and behavior is unchanged; the split also let several
helpers grow real unit tests of their own (repo-alias fallback, rooted vs
relative sentruxPath, reverse-lookup edge cases, trailing-separator trimming),
so coverage went up rather than moving around.

Two follow-on corrections the split required:
- the registry entrypoint and toolchainDigestEvidence now name the four module
  files; `orchestrate --action Validate` rejected the stale single-file path,
  which is the manifest reconciliation check doing its job
- `--config`/`--platform`/`--pipeline-root` argument parsing was rewritten as a
  flat match over (token, value) instead of nested closures

Residual metric movement, recorded in .sentrux/rules.toml with evidence and
baselined: coupling_score 45.26 -> 45.79, quality_signal 3607 -> 3603. The
`[constraints]` thresholds are untouched. coupling_score is import_lines /
file_count * 10, and this tree's average is held down by large PowerShell
files carrying almost no import lines, so any idiomatic Rust module sits above
it. Closing the gap would have meant dropping ~13 `use` lines for inline fully
qualified paths — worse code in service of a line-counting metric. The real
regression, the god file, was fixed rather than baselined; god_file_count and
cycle_count are unchanged at 32 and 0.

Verification:
- code-intel run execute --repo . (the exact CI self-scan command): exit 0,
  outcome completed, every node verdict pass
- code-intel sentrux gate .: No degradation detected
- cargo test -p code-intel: 45 suites, 0 failed
- cargo fmt -p code-intel -- --check: clean
- orchestrate --action Validate: ok, 0 errors, registryAudit ok
- test-regression-fixes.ps1: 49 passed; test-doctor-repo-config-resolution.ps1: PASS

Refs #48
…creates

Addresses CodeRabbit review feedback on PR #70.

`doctor_bootstrap` compiles twice: once as the binary's own module and once
through the `#[path]` include inside `doctor_adapter`, which several
integration tests pull into their own crate roots. The adapter copy needs only
`Options`, `observe` and `BOOTSTRAP_SCHEMA`, so the CLI surface has no caller
there and every one of those items warned.

The allowance goes on the `#[path]` module declaration rather than on the
individual items: that declaration is what makes them unreachable, it is one
place instead of seven, and `main.rs` declares the same module without it, so
genuinely dead code still warns where the module is actually the binary's.

`check_names` was deleted outright rather than allowed — it had no caller
outside its own test, so the lint was right about that one. The assertion it
served is now inline in the test that needed it.

The reviewer's other note, a collapsible `if` in `matches_tier`, was already
resolved by the module split in the previous commit; the predicate is a single
`&&` chain in doctor_bootstrap/probe.rs now.

Verification: zero warnings remain from the four doctor_bootstrap modules;
cargo test 45 suites 0 failed; sentrux gate reports no degradation;
run execute --repo . exits 0; cargo fmt --check clean.

Refs #48
…cutable

CI's Doctor step failed on all four runners with `missing: ["pipeline
script", "pipeline config"]`. Root cause: `run_raw` defaulted the pipeline
root to `pipeline_root()`, which walks up from `std::env::current_exe()` in
search of `orchestration/integrations.json` — and
`install-code-intel-pipeline.ps1` copies that manifest into the bin directory
next to the installed binary. An installed `code-intel` therefore resolved its
own bin directory as the pipeline checkout and reported every repository-side
check absent:

    "path": "/home/runner/.local/share/code-intel/bin/archive/run-code-intel.ps1"

That is correct behavior for capability manifest discovery — an installed
binary should use its installed manifest — but wrong for "which pipeline
checkout am I inspecting". The retired script never had the ambiguity: it
derived the root from `$PSCommandPath`, its own location inside the checkout.

The CLI now walks up from the working directory for the same marker and only
falls back to manifest discovery, so standing in a checkout resolves that
checkout. `--pipeline-root` still overrides, and the PowerShell forwarder
keeps passing it explicitly from its own location. `doctor_adapter` is
untouched and still uses manifest discovery, which is right for the kernel
path where the binary runs from the repository's own target directory.

CI keeps calling the subcommand without `--pipeline-root` on purpose, so the
default stays exercised rather than papered over by a flag.

Verified against the actual failure mode, not just unit tests: reinstalled the
pipeline so `code-intel` on PATH is the installed copy, then ran CI's exact
command from the checkout — `code-intel doctor bootstrap --repo-path .
--no-require-repowise --json` — which now exits 0 with `ok: true` and resolves
pipelineScript/config into the repository rather than the bin directory.

Also adds a regression test that plants a decoy `orchestration/integrations.json`
beside a fake install location, runs from a nested directory of the real
checkout with no `--pipeline-root`, and asserts the checkout wins.

Full pass: cargo test 45 suites 0 failed; sentrux gate no degradation;
run execute --repo . exit 0; cargo fmt --check clean;
test-doctor-repo-config-resolution.ps1 PASS; test-regression-fixes.ps1 49 passed.

Refs #48
@2233admin
2233admin merged commit 02f0444 into main Jul 30, 2026
7 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