Self-dogfood release gates: built-in structural engine, cycle removal, actionable Hospital - #15
Conversation
…ural engine Closes the "release green != product healthy" gap from #14: - Break both Rust module import cycles: dag_run <-> execution_kernel (run CLI front-end extracted to run_cli.rs, RunError to run_error.rs) and the previously undetectable artifact_ref <-> capability (shared content-contract primitives extracted to content_contract.rs). - Add the sentrux-native gate engine inside the binary (scan/health/check/ gate/save_baseline) with real resolved-import cycle detection; sentrux-lite hardcoded cycle_count = 0 and the installed PATH forwarder executed whichever checkout it was installed from. evidence.sentrux runs in-process by default; options.toolPathPrefix still injects an external Sentrux. - Baseline v2 (code-intel-sentrux-baseline.v2) records engine identity and source commit; the gate fail-closes on engine mismatch instead of comparing numbers produced by different engines and scales. - Carry structured rule violations (message + target files) through the adapter/admission chain into the Hospital report and surgery plan; plan a bounded surgery whenever an actionable target exists; report process vs domain failures side by side so a tooling hiccup can no longer mask a gate verdict. - Make kernel runs self-sufficient: native doctor bootstrap fallback, built-in engine satisfies the Sentrux requirement (a present-but-nonconforming external overlay still fails conformance on purpose), and linked-worktree .git pointer files no longer break the rg inventory. - Ratchet .sentrux/rules.toml to measured reality under the new engine (max_cycles stays absolute at 0) and refresh pinned toolchain digests. Verified: cargo fmt --check; 973 tests pass (1 pre-existing local-environment failure in advisory_workflow_recommend, reproduced identically on the unmodified tree); hospital trust contract 16/16; `run execute` self-scan exits 0 on this tree; a seeded cycle fixture exits 10 with the failing rule, target files, and rerun command in hospital.md plus a planned surgery target. Refs #14
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR adds a built-in Sentrux structural gate, introduces Baseline v2 identity checks, restructures CLI execution and content validation, propagates structured failures into Hospital diagnosis, supports native doctor fallback, and updates repository inventory and implementation evidence. ChangesNative Sentrux execution
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related issues
Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant CLI
participant SentruxGate
participant ProviderEvidence
participant SentruxAdapter
participant Hospital
CLI->>SentruxGate: Run check or gate
SentruxGate-->>ProviderEvidence: Return metrics and violations
ProviderEvidence->>SentruxAdapter: Emit authoritative rules
SentruxAdapter-->>Hospital: Provide validated failing-rule details
Hospital->>Hospital: Derive targets and treatment plan
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 12
🧹 Nitpick comments (6)
.sentrux/rules.toml (1)
3-19: 📐 Maintainability & Code Quality | 🔵 TrivialRatchet significantly loosens gates — confirm it's tracked.
max_couplingB→D,max_cc70→162, andno_god_filesdisabled entirely are large relaxations. The comments frame this as tracked "modernization debt" enforced against further regression only via the baseline no-degradation gate — worth confirming there's a linked issue/ticket to actually tighten these back, since absolute-threshold ratchets have a tendency to become permanent once the baseline is refreshed.🤖 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 @.sentrux/rules.toml around lines 3 - 19, The relaxed thresholds in the [constraints] block need an explicit tracked modernization reference. Add a linked issue or ticket identifier to the existing comments documenting the max_coupling, max_cc, and no_god_files relaxations, and ensure it describes the planned tightening back toward the intended quality gates.crates/code-intel-cli/src/builtin_provider_evidence.rs (1)
22-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winImport cycles are broken by re-including files as private modules, which duplicates them. Both sites use
#[path = "…"] mod …;for a file that is also (or could be) a crate-root module, so the file is compiled once per parent. Consequences: duplicated code in the binary, per-copy dead-code analysis (thesentrux_gate.rscopy is why Clippy reportsscan_json,metrics_json,Violation::rule,Violation::to_json, andEngineRun::violationsas never used), and nominally distinct types if any of these helpers ever exposes a struct across the seam. Declaring each of these as a single leaf module inmain.rsand importing viacrate::…breaks the same cycles without duplication, because a leaf module with no crate-internal imports cannot participate in a cycle.
crates/code-intel-cli/src/builtin_provider_evidence.rs#L22-L25: drop the#[path]declaration and usecrate::sentrux_gate::{self, Violation}, sincesentrux.rsalready reaches the engine that way.crates/code-intel-cli/src/artifact_ref.rs#L6-L10: drop the#[path]declaration, declaremod content_contract;once at the crate root, and import the three helpers viacrate::content_contract.🤖 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/builtin_provider_evidence.rs` around lines 22 - 25, Eliminate duplicated private module inclusion at both affected sites: in crates/code-intel-cli/src/builtin_provider_evidence.rs:22-25, remove the #[path] declaration and import sentrux_gate and Violation through crate::sentrux_gate; in crates/code-intel-cli/src/artifact_ref.rs:6-10, remove the #[path] declaration, declare content_contract once in the crate root, and import its three helpers through crate::content_contract.Source: Linters/SAST tools
crates/code-intel-cli/src/hospital_diagnosis.rs (1)
416-453: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winViolation rendering is implemented twice.
treatmentandrender_hospitalboth walkdetails.violations, readmessage, jointargets, and branch on whether the target list is empty — differing only in the bullet prefix and thetake(3)caps. Extract one helper (e.g.fn violation_lines(rule: &Value, limit: Option<usize>) -> Vec<String>) so the two views cannot drift, and so the target/violation caps are stated once.Also applies to: 477-505
🤖 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/hospital_diagnosis.rs` around lines 416 - 453, Extract the duplicated details.violations traversal from treatment and render_hospital into a shared violation_lines helper that accepts the rule and an optional limit, centralizing message extraction, target joining, empty-target formatting, and violation/target caps. Update both callers to use the helper while preserving their existing bullet prefixes and output behavior.crates/code-intel-cli/src/sentrux_gate.rs (2)
485-497: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winEvery
.rsfile is read twice per engine run.
measure_projectreads all collected files, thenrust_import_cyclesre-reads each.rsfile from disk.sentrux_admissioncallsrun_gateandrun_check, so a single provider run performs four full repository reads. Passing the already-decoded contents intorust_import_cyclesremoves half of the I/O with no behavior change.♻️ Sketch
- let mut files = Vec::new(); - for relative in &paths { - let content = fs::read(repo.join(relative)).unwrap_or_default(); - let content = String::from_utf8_lossy(&content); - files.push(measure_file(relative, &content)); - } + let mut files = Vec::new(); + let mut contents: BTreeMap<String, String> = BTreeMap::new(); + for relative in &paths { + let bytes = fs::read(repo.join(relative)).unwrap_or_default(); + let content = String::from_utf8_lossy(&bytes).into_owned(); + files.push(measure_file(relative, &content)); + if relative.ends_with(".rs") { + contents.insert(relative.clone(), content); + } + }Then change
rust_import_cycles(repo, &paths)torust_import_cycles(&contents)and read the text from the map instead of the filesystem.Also applies to: 731-760
🤖 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/sentrux_gate.rs` around lines 485 - 497, Update measure_project and rust_import_cycles so collected file contents are reused instead of rereading .rs files from the repository. Store the decoded text alongside each relative path while building files, then change rust_import_cycles to accept that contents collection and consume it directly; update all callers, including run_gate/run_check flows, while preserving existing cycle-detection behavior.
997-1018: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueFixture directories leak when an assertion fails.
fs::remove_dir_allonly runs on the success path, so any failing assertion leaves asentrux-native-*tree in the system temp directory. A drop guard (or a smallstruct TempFixture(PathBuf)withimpl Drop) keeps cleanup unconditional and also removes the duplicated fixture-path construction between both tests.Also applies to: 1020-1062
🤖 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/sentrux_gate.rs` around lines 997 - 1018, The temporary fixture directories created by the affected tests leak when assertions fail. Refactor the shared fixture-path setup around gate_rejects_legacy_baseline_without_engine_identity and the test at the referenced neighboring range to use a drop-based cleanup guard, such as a TempFixture wrapper implementing Drop, and remove the explicit success-path cleanup while preserving each test’s existing assertions and fixture contents.crates/code-intel-cli/src/sentrux_adapter.rs (1)
372-392: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
exactis now a special case ofexact_with_optional.Both functions build the same key set; the only difference is the empty optional list. Delegating keeps one definition of "unexpected field".
♻️ Proposed refactor
fn exact(value: &Value, fields: &[&str], label: &str) -> Result<(), String> { - let actual = value - .as_object() - .ok_or_else(|| format!("{label} must be an object"))? - .keys() - .map(String::as_str) - .collect::<BTreeSet<_>>(); - let expected = fields.iter().copied().collect::<BTreeSet<_>>(); - if actual == expected { - Ok(()) - } else { - Err(format!("{label} fields are invalid")) - } + exact_with_optional(value, fields, &[], label) }🤖 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/sentrux_adapter.rs` around lines 372 - 392, Refactor the existing exact validation function to delegate to exact_with_optional, passing an empty optional-field list while preserving its current required fields and label arguments. Keep exact_with_optional as the single implementation of missing and unexpected field validation.
🤖 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 `@CHANGELOG.md`:
- Around line 28-33: Update the CHANGELOG release objective bullets to avoid
asserting that authoritative CI/release self-scanning or stable packaging
validation is already implemented. Since those workflow changes remain pending,
defer or narrow the claims to describe the current state accurately; only retain
release-blocking and pre-publication validation language if the corresponding
workflows were added.
In `@check-code-intel-tools.ps1`:
- Around line 303-304: Update the text-mode summary’s $coreMark and $proMark
calculations to treat $builtinSentrux as satisfying sentrux core and pro,
matching the existing $missing logic. Preserve the current found-based marks
when the builtin fallback is not active so non-JSON output reflects the actual
doctor result.
In `@crates/code-intel-cli/src/builtin_provider_evidence.rs`:
- Around line 136-152: The effect declarations in the native evidence
construction must distinguish external Sentrux execution from in-process
gate/check execution. Update the static effect arrays near the native object and
related evidence entries to include process_spawn only when
tool_path_prefix.is_some(), while always retaining repo_read because git_head()
runs unconditionally; apply this consistently to the arrays around the native,
execution, and observational declarations.
- Around line 309-334: Update from_external’s violation extraction to cap the
collected violations at the adapter’s maximum of 32 and truncate each violation
message to at most 1024 characters. Preserve the existing rule, trimming, and
success behavior while ensuring external output cannot produce contract-invalid
details.
In `@crates/code-intel-cli/src/doctor_adapter.rs`:
- Around line 183-204: Update the native observation builder around the
graphProvider and sentrux.builtin fields to use actual availability probes
instead of hardcoded true values. Check cargo with tool_available("cargo",
prefix), and derive graph source and binary presence from their corresponding
paths; derive the builtin Sentrux result from its actual availability check.
Preserve the existing observation schema while ensuring every reported field
reflects the probed environment.
- Around line 160-166: Update the fallback match around run_script_bootstrap so
only AdapterError::Unavailable triggers native_bootstrap(options). Propagate
AdapterError::Contract and all other errors unchanged, preserving native
fallback solely for missing or unavailable script prerequisites.
In `@crates/code-intel-cli/src/execution_kernel.rs`:
- Around line 66-85: Update failures() to classify "domain_unknown" nodes
alongside "domain_failed" in the domain array, preserving the existing node and
verdict fields and fallback behavior so structured failure output matches
first_failure() and reports unknown-domain failures.
In `@crates/code-intel-cli/src/hospital_diagnosis.rs`:
- Line 355: Update the JSON Schema for the code-intel-hospital.v1 triage object
to declare failing_rules while retaining its existing additionalProperties
restriction. Ensure the schema’s failing_rules definition matches the emitted
value from the hospital diagnosis output so documents containing
triage.failing_rules validate successfully.
In `@crates/code-intel-cli/src/sentrux_gate.rs`:
- Line 16: Remove the unused PathBuf import from the std::path use declaration
in sentrux_gate.rs, retaining only Path.
In `@crates/code-intel-cli/src/sentrux.rs`:
- Around line 61-67: Update finish so unsuccessful runs return an error
describing the sentrux operation as failed without claiming a fabricated exit
code; preserve the existing success path and caller-controlled process exit
behavior.
In `@orchestration/integrations.json`:
- Around line 566-571: Update orchestration/integrations.json at lines 566-571
to include crates/code-intel-cli/src/sentrux_gate.rs among the matching evidence
inputs and regenerate the five-digest list; update
orchestration/internalization/sentrux.json at lines 15-18 to add the native gate
source and conformance evidence to operationTrace and bind its digest in
ownedModifications.
In `@orchestration/internalization/rg.json`:
- Around line 5-9: Update the production registry entry for inventory.rg.compat
in integrations.json to use the current capability_inventory.rs digest f8af3e1a…
instead of 43ced9ef…, and refresh any dependent evidence or identity fields that
embed the old digest. Keep the registry and this rg.json record consistent for
the required inventory.rg capability.
---
Nitpick comments:
In @.sentrux/rules.toml:
- Around line 3-19: The relaxed thresholds in the [constraints] block need an
explicit tracked modernization reference. Add a linked issue or ticket
identifier to the existing comments documenting the max_coupling, max_cc, and
no_god_files relaxations, and ensure it describes the planned tightening back
toward the intended quality gates.
In `@crates/code-intel-cli/src/builtin_provider_evidence.rs`:
- Around line 22-25: Eliminate duplicated private module inclusion at both
affected sites: in crates/code-intel-cli/src/builtin_provider_evidence.rs:22-25,
remove the #[path] declaration and import sentrux_gate and Violation through
crate::sentrux_gate; in crates/code-intel-cli/src/artifact_ref.rs:6-10, remove
the #[path] declaration, declare content_contract once in the crate root, and
import its three helpers through crate::content_contract.
In `@crates/code-intel-cli/src/hospital_diagnosis.rs`:
- Around line 416-453: Extract the duplicated details.violations traversal from
treatment and render_hospital into a shared violation_lines helper that accepts
the rule and an optional limit, centralizing message extraction, target joining,
empty-target formatting, and violation/target caps. Update both callers to use
the helper while preserving their existing bullet prefixes and output behavior.
In `@crates/code-intel-cli/src/sentrux_adapter.rs`:
- Around line 372-392: Refactor the existing exact validation function to
delegate to exact_with_optional, passing an empty optional-field list while
preserving its current required fields and label arguments. Keep
exact_with_optional as the single implementation of missing and unexpected field
validation.
In `@crates/code-intel-cli/src/sentrux_gate.rs`:
- Around line 485-497: Update measure_project and rust_import_cycles so
collected file contents are reused instead of rereading .rs files from the
repository. Store the decoded text alongside each relative path while building
files, then change rust_import_cycles to accept that contents collection and
consume it directly; update all callers, including run_gate/run_check flows,
while preserving existing cycle-detection behavior.
- Around line 997-1018: The temporary fixture directories created by the
affected tests leak when assertions fail. Refactor the shared fixture-path setup
around gate_rejects_legacy_baseline_without_engine_identity and the test at the
referenced neighboring range to use a drop-based cleanup guard, such as a
TempFixture wrapper implementing Drop, and remove the explicit success-path
cleanup while preserving each test’s existing assertions and fixture contents.
🪄 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: afe5ee66-6f01-4b2d-bd8e-bf02be5a019c
📒 Files selected for processing (23)
.sentrux/baseline.json.sentrux/rules.tomlCHANGELOG.mdcheck-code-intel-tools.ps1crates/code-intel-cli/src/artifact_ref.rscrates/code-intel-cli/src/builtin_provider_evidence.rscrates/code-intel-cli/src/capability.rscrates/code-intel-cli/src/capability_inventory.rscrates/code-intel-cli/src/content_contract.rscrates/code-intel-cli/src/dag_run.rscrates/code-intel-cli/src/doctor_adapter.rscrates/code-intel-cli/src/execution_kernel.rscrates/code-intel-cli/src/hospital_diagnosis.rscrates/code-intel-cli/src/main.rscrates/code-intel-cli/src/run_cli.rscrates/code-intel-cli/src/run_error.rscrates/code-intel-cli/src/sentrux.rscrates/code-intel-cli/src/sentrux_adapter.rscrates/code-intel-cli/src/sentrux_gate.rsorchestration/integrations.jsonorchestration/internalization/graph.jsonorchestration/internalization/rg.jsonorchestration/internalization/sentrux.json
…w fixes Fixes the CI failure and addresses the PR #15 review findings: - integrations.json: add sentrux_gate.rs to provider.sentrux-adapt's toolchainDigestEvidence.inputs and rebuild both provider digest arrays in input order — the atomic capability contract pairs inputs and digests by index, which is what failed all four CI jobs. - Register the native gate in the sentrux internalization record: a provider.sentrux-adapt/native-gate operation trace entry (with the matching registry command) and an ownedModifications binding for sentrux_gate.rs. - builtin_provider_evidence: bound external violation extraction (32 entries, 1 KiB per message, empties dropped) so a verbose external Sentrux degrades details instead of turning a domain verdict into a contract failure; declare process_spawn only on the external path — the built-in engine does not spawn. - doctor: fall back to the native observation only on Unavailable — a script that ran and produced a nonconforming observation stays a Contract failure instead of being masked by an optimistic fallback. - execution_kernel::failures(): report domain_unknown nodes in the domain list (exit-20 runs no longer show an empty failures block). - check-code-intel-tools.ps1: text summary marks honor the builtin engine so human output cannot contradict the JSON ok verdict. - sentrux CLI: failing verdict message no longer fabricates an exit code; drop the unused PathBuf import; scope the CHANGELOG workflow claims to the companion ci(release) commit; reference the tracked-debt location in .sentrux/rules.toml. Verified: cargo fmt --check clean; 973 tests pass (the one failure is the pre-existing local pwsh unicode issue in advisory_workflow_recommend, green on CI); atomic capability contract passes; `run execute` self-scan exits 0. Refs #14
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 @.sentrux/rules.toml:
- Around line 7-8: Restore the prior release-gate thresholds and re-enable the
god-file rule in the policy values consumed by sentrux_gate.rs, keeping the
header documentation consistent with the enforced limits. Do not relax the gate
unless measured ratchet evidence, the baseline, and policy documentation are
updated together.
In `@crates/code-intel-cli/tests/internalization_record.rs`:
- Around line 849-855: Extend the test assertions around the owned entry for
sentrux_gate.rs to verify its local:b03:native-gate-source-sha256 evidence ID
contains the recomputed expected source digest, not merely the path. Reuse the
test’s existing digest computation and expected-value symbols, preserving the
owned count and path checks.
🪄 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: 04fee9d8-7145-4906-9df6-88e4f754b74d
📒 Files selected for processing (13)
.sentrux/baseline.json.sentrux/rules.tomlCHANGELOG.mdcheck-code-intel-tools.ps1crates/code-intel-cli/src/builtin_provider_evidence.rscrates/code-intel-cli/src/doctor_adapter.rscrates/code-intel-cli/src/execution_kernel.rscrates/code-intel-cli/src/sentrux.rscrates/code-intel-cli/src/sentrux_gate.rscrates/code-intel-cli/tests/internalization_record.rsorchestration/integrations.jsonorchestration/internalization/graph.jsonorchestration/internalization/sentrux.json
🚧 Files skipped from review as they are similar to previous changes (9)
- check-code-intel-tools.ps1
- .sentrux/baseline.json
- orchestration/internalization/graph.json
- CHANGELOG.md
- crates/code-intel-cli/src/doctor_adapter.rs
- crates/code-intel-cli/src/sentrux.rs
- crates/code-intel-cli/src/execution_kernel.rs
- crates/code-intel-cli/src/sentrux_gate.rs
- crates/code-intel-cli/src/builtin_provider_evidence.rs
The $defs/triage definition sets additionalProperties: false, so the failing_rules field emitted since e746956 violated the declared contract. Adds the field as an optional, fully-typed property (kind + bounded violation details) so reports validate under the schema while older reports without the field stay valid. Refs #14
- ticket_r03 now recomputes the sentrux_gate.rs source digest and asserts the exact local:b03:native-gate-source-sha256 evidence ID, so a stale record digest can no longer pass on path presence alone. - .sentrux/rules.toml documents the measured ratchet evidence inline (engine, date, values, and the failing target for max_cc) plus why the previous B/70/no-god thresholds cannot be restored: they were never green under any engine, and god-file growth is enforced as monotonic non-increase by the baseline no-degradation gate rather than the disabled absolute rule. Refs #14
…ngine The stable-wrapper E2E prepared its fixture baseline through the PATH-resolved `sentrux` forwarder (the old lite engine), so the authoritative run's built-in gate correctly fail-closed on the foreign baseline identity (`baseline_engine_mismatch`) and the run ended domain_failed. Provision the baseline and rules check with the same `code-intel sentrux` engine the run gates with; PATH `sentrux` no longer participates in the authoritative path at all. Verified locally: Stable wrapper E2E: OK (all phases, exit 0). Refs #14
The builtin-engine probe in check-code-intel-tools.ps1 only looked for target\release\code-intel.exe (Windows separators and suffix), so on macOS/Linux the hermetic CI self-scan saw no builtin engine, demanded an external PATH sentrux, and doctor domain-failed with "bootstrap readiness failed" (exit 10). Probe all four build outputs (release/debug, with and without .exe) using forward slashes, which Join-Path resolves on every platform. Refs #14
- ci.yml (both jobs) and release.yml run `run execute` on the exact candidate tree right after the release build, with no skip flags; exit 10 (domain gate) or 70 (process) blocks the pipeline. - release.yml packages the stable zip from `git archive HEAD` so earlier steps cannot mutate what ships, emits <zip>.sha256 and a release-manifest.json (tag, commit, zip digest), uploads all three assets, and requires the packaged binary to pass its own check and gate against the packaged payload before publication. Refs #14
8b07c36 to
af1aa3a
Compare
…adapter The no-degradation gate compares against .sentrux/baseline.json, which was snapshotted from the PR #15 tree (quality 3971, coupling 44.78). This branch merged v0.6.0 main (audit layer, +22 files) and adds the edit.ast-grep-plan adapter module; the honest measurement of that tree is quality 3969 / coupling 45.07 with god files and cycles unchanged (29 / 0). Re-baselined via the gate's own prescribed operation: code-intel sentrux --operation save_baseline. Self-scan run execute now exits 0 on this tree.
* test(inventory): cover linked worktree git pointer * feat(capability): add ast-grep edit planning * fix(snapshot): exclude nested linked worktrees * fix(orchestration): repin source digests after worktree and inventory changes snapshot.rs, capability_inventory.rs, and capability_exec.rs changed in this branch, but git.json kept the old snapshot.rs digest, rg.json pinned intermediate rather than final file digests, and integrations.json still carried the pre-branch capability_inventory.rs toolchain digest in five entries. Recomputed all pins from the checked-out tree (Get-FileHash parity with the internalization_record gate). * chore(sentrux): re-baseline ratchet for v0.6.0 audit layer plus edit adapter The no-degradation gate compares against .sentrux/baseline.json, which was snapshotted from the PR #15 tree (quality 3971, coupling 44.78). This branch merged v0.6.0 main (audit layer, +22 files) and adds the edit.ast-grep-plan adapter module; the honest measurement of that tree is quality 3969 / coupling 45.07 with god files and cycles unchanged (29 / 0). Re-baselined via the gate's own prescribed operation: code-intel sentrux --operation save_baseline. Self-scan run execute now exits 0 on this tree. --------- Co-authored-by: Curry <curry@test.com>
… slice holds (#45) * fix(audit): require --repo and validate before render (ai-safety-003) The audit kernel's fail-closed validator (registry membership, evidence grounding, recomputed overall, the zero-findings coverage rule) only ran behind `--operation validate`. `--operation render` parsed a report and printed it with no registry, no evidence grounding, and no shape checks, so a fabricated, drifted, or malformed report could reach human-facing markdown or HTML as if it were authoritative (issue #34, ai-safety-003). `render` now requires `--repo` and runs through the same `validate_and_parse` pipeline `validate` uses before it renders anything; a report that fails validation returns the same error `validate` would have produced instead of being rendered. Update the four cli_tests.rs cases that encoded the old "render never needs --repo" contract, and add a case asserting render fails closed on a report that fails validation. Docs updated to match: `--operation render` is now documented as requiring `--repo` and running the validate pipeline first. * ci(release): validate any produced audit report before it can publish (ai-safety-003) The fail-closed validator existed and was well-tested but ran on no automated path: not CI, not the orchestrator, not the release workflow (issue #34, ai-safety-003). Add an additive "Validate any produced audit report" step, after each self-scan step in both ci.yml jobs and in release.yml, that looks for audit-report.json at the repo root, under orchestration/, and in the self-scan artifact directory, and runs `code-intel audit --operation validate --repo . --report <path>` on any it finds, failing the step on a validation error. Departments are agent-run today, not part of `run execute`, so no workflow currently produces an audit-report.json automatically -- this step is the structural guarantee for whenever one does show up, not an assumption that one exists yet. release.yml's "Validate packaged Skill bootstrap" step also gets an audit-report.json check against the extracted payload using the packaged binary, alongside the existing packaged `sentrux check`/`gate` calls, so release green, self-scan green, and published-artifact green keep referring to the same snapshot for audit evidence too, not just structural evidence. * test(sentrux): pin a fast regression guard for resolved import cycles Issue #14's v0.5.1 acceptance criteria ask for a regression check that fails CI if the dag_run/execution_kernel cycle (removed in #15) comes back, added to the existing cycle-detection mechanism rather than a new one. That mechanism already exists and is already wired into CI: the absolute `max_cycles = 0` rule in .sentrux/rules.toml, evaluated by sentrux_gate.rs's Tarjan-based rust_import_cycles against every push/PR self-scan. Add sentrux_gate::this_repository_has_no_resolved_import_cycles, which calls the same run_check() engine directly against this repository's own source tree as a plain `cargo test`. This gives a reintroduced cycle (this pair or any other) a seconds-fast failure signal instead of waiting for a full release-mode self-scan build. crates/code-intel-cli/src/sentrux_gate.rs is itself pinned by a supply-chain provenance record (orchestration/internalization/sentrux.json, ownedModifications + operationTrace, checked by tests/internalization_record.rs). Editing the file to add the test changes its SHA-256, so the recorded native-gate-source-sha256 digest is updated to match -- the same maintenance step the file's own history (c3a8ca2) took the last time this file changed. This is a provenance identity record, not the structural quality baseline; updating it to reflect a reviewed, intentional, additive source change is expected and is a different action from regenerating .sentrux/baseline.json to paper over a regression. * docs(changelog): record ai-safety-003 fix and re-verify the v0.5.1 slice Document the render/CI/release validate wiring under [Unreleased], and record (with pointers to the evidence, not just an assertion) that the v0.5.1 self-dogfood acceptance criteria from issue #14 -- the dag_run/execution_kernel cycle at zero under an absolute rule, CI and release self-scan against the real compiled binary, and packaged/ self-scan/release snapshot identity -- were already landed by #15 and held through #38/#42, verified against current main rather than re-implemented here. * test(hospital): assert the actionable failure fields for a real structural violation Acceptance criterion 3 from issue #14 (Hospital must name the first failed rule, evidence, target files, and smallest rerun command on a structural failure) was already implemented by hospital_diagnosis.rs's treatment()/render_hospital() -- but no existing test exercised it: the structural() fixture helper in this file only ever seeds `failure:{"kind":"none"}`, even for a "fail" verdict, so the precedence matrix test only checked the diagnosis string, never the rendered text. Add architecture_gate_failure_names_the_rule_targets_and_smallest_rerun_command, which seeds a structural admission carrying the same shape a real max_cycles violation on dag_run.rs/execution_kernel.rs produces, and asserts hospital.md contains the failing rule and message, the target files, a dedicated "## Failing rules" section, and the literal "Rerun the smallest gate: code-intel sentrux --operation check --repo <repo-root>." line -- and that a surgery plan is produced. This closes the coverage gap rather than just re-reading the source to confirm the behavior exists. * fix(provenance): re-pin provider.sentrux-adapt digest for edited sentrux_gate.rs The cycle regression guard added to sentrux_gate.rs changed its sha256; orchestration/internalization/sentrux.json was re-pinned in the same change but the provider.sentrux-adapt toolchainDigests entry in orchestration/integrations.json was missed, failing test-atomic-capability-contract.ps1 on every platform. Recomputed and verified via the contract test (ok: true, 11 toolchain evidence capabilities checked).
Implements the v0.5.1 slice of #14 — verified against a live reproduction of the reported failure, not just the issue text.
Root causes established (full analysis in the #14 comment)
-SkipSentruxGate, andrun executeappeared nowhere in CI. Release green proved only that a gate-skipping pipeline doesn't crash.sentrux.cmdis a forwarder hardcoded to one dev checkout; sentrux-lite hardcodescycle_count = 0; the committed baseline was produced by a different engine on a different scale (quality 0.547float vs4213int) with no engine identity recorded.failuremust be{kind:"none"}even onverdict:"fail"), then Hospital reduced rules to booleans — while the full failing output sat unused insentrux-command-observation.jsonin the same run directory.process_failedwas aux-node noise (doctor bootstrap contract, worktree.githandling) outranking the real domain verdict (exit 10) in the run outcome.What this branch does
dag_run <-> execution_kernel(run CLI front-end →run_cli.rs,RunError→run_error.rs) and the previously invisibleartifact_ref <-> capability(shared primitives →content_contract.rs), found by the new engine's real cycle detection.sentrux-nativeengine in the binary (code-intel sentrux --operation scan|health|check|gate|save_baseline): deterministic metrics, structured violations with target files, resolved-import cycle detection for Rust.evidence.sentruxruns it in-process by default;options.toolPathPrefixstill injects an external Sentrux (test seam / V overlay).failuresblock separating process from domain failures..gitpointer files no longer break inventory.max_cycles = 0stays absolute.Verification (local, Windows)
cargo fmt --checkclean; 973 tests pass; the only failure isadvisory_workflow_recommend_…which fails identically on the unmodified tree (local pwsh unicode issue — CI should arbitrate).run executeself-scan on this tree: exit 0.cycles exceeded: 1 > 0 (targets: src/a.rs, src/b.rs), the rerun command, andsurgery: planned | target: src/a.rs.Pending: workflow files (token scope)
A second commit (
ci(release): release-blocking self-scan and verifiable stable packaging) adds the self-scan job toci.yml/release.ymland hardens stable packaging (git archive HEAD,.sha256+ release manifest, packaged-binary check/gate). It exists locally but the active OAuth token lacks theworkflowscope to push workflow file changes. To land it:Refs #14