Skip to content

refactor(ci): drop the dag-facade and run-commit PowerShell call points (#78) - #79

Merged
2233admin merged 3 commits into
mainfrom
ps1-exit/ci-batch-1-dag-facade-run-commit
Jul 31, 2026
Merged

refactor(ci): drop the dag-facade and run-commit PowerShell call points (#78)#79
2233admin merged 3 commits into
mainfrom
ps1-exit/ci-batch-1-dag-facade-run-commit

Conversation

@2233admin

Copy link
Copy Markdown
Owner

First batch of the CI de-PS1 sweep (#78). Two call points off, 43 left.

ci.yml 调用点 处置
L306 test-run-commit-contract.ps1 A / 已覆盖 删步骤 + 删脚本
L235 test-dag-facade.ps1 B / 要 port 先补 Rust 测试与 CLI 能力,再删步骤;脚本留盘

A — test-run-commit-contract.ps1

每条断言都有 Rust 对等,多数更强:

PS1 断言 Rust
marker schema = code-intel-run-commit.v1 tests/decision_record.rs:318
marker.manifest.sha256 为真实 digest;manifest 字节原样保留 tests/run_commit.rs::cli_publication_preserves_the_callers_manifest_bytes_and_digest
facade 转发 RunCommit* 后发布成功 tests/run_commit.rs::production_run_commit_cli_restages_a09_refs_through_a06_and_publishes
runIdentity / snapshotIdentity 相干 tests/artifact_index.rs:159-182(篡改 digest / identity / snapshot 三种 marker 均被拒——PS1 只做正向检查)
A08 index 接纳有效 marker tests/dag_run.rs::production_dag_output_commits_and_enters_the_authoritative_index(走 Rust artifact index,PS1 走 update-code-intel-index.ps1 的字符串包含检查)

唯一没有搬过来的断言:marker 不含 legacy 的 generatedAt / reportSha256 字段。它守的是 PowerShell producer 会不会写出旧形状;marker 现在由 Rust 的固定结构写出,这两个字段不可能出现。理由记在 docs/ps1-exit/contract-inventory.md

B — test-dag-facade.ps1

hospital / doctor / manifest 三段早已覆盖,且更强:

  • tests/dag_run.rs::ungoverned_repository_completes_instead_of_failing_the_architecture_gate —— 除 PS1 断言的 succeeded/pass 外,还断言 hospital triage、gate 不发布 violation details、以及命令观测保留引擎真实退出码;配套的 ::baselined_repository_that_regresses_still_fails_the_architecture_gate 守住豁免不变成漏洞
  • ::production_run_preserves_doctor_domain_failure_and_completes_unrelated_branches —— 覆盖 PS1 那段「容忍 doctor bootstrap 缺口」的逻辑

没覆盖的三条,且契约只存在于 PowerShellrun-code-intel.ps1:3271 组装 <artifact root>/<repo name>/<stamp>.dag-staging-<nonce> 再喂给 run dag-coordinate --out。二进制自己够不到 artifact root——--out 是必填的。所以这不是「切换」,是「port」。

做法:

  1. run dag-coordinate 新增 --artifact-root,缺省时经既有的 resolve_artifact_rootCODE_INTEL_ARTIFACT_ROOT。组装逻辑放在 artifacts::compose_dag_staging_dir,与 resume / artifact index读取侧artifacts.rs:38-42)同一份路径语义。
  2. --out--artifact-root 互斥。两条路线对「谁拥有这个路径」的答案不同,静默采纳一个丢掉另一个比报错更糟。
  3. run 目录本身不预先创建——dag_run.rs:114fs::create_dir 独占声明,这个 fail-closed 语义必须留着。
  4. 目录名保留 yyyyMMdd-HHmmss 前缀(Howard Hinnant civil_from_days,不引入日期依赖):latest_run_dir 按名字排序,新写的 run 必须排在 launcher 写的 run 之后。

新增测试 tests/dag_run.rs

  • artifact_root_routes_runs_where_readers_look_and_matches_the_environment_default —— run 是 repo artifact root 的直接子目录、repo 名不重复出现在路径里、显式 flag 与环境变量两条路线的 inventory.rg/files.txt 字节相同、仓库名 repo & 文 能跑通
  • out_and_artifact_root_cannot_both_name_the_staging_directory

两个测试都不断言 run 结果——那由宿主工具链决定,production_run_route_executes_snapshot_then_inventory 在配好 doctor 的前提下覆盖它。

脚本为什么留盘

legacy/tools/compatibility/New-PublicationRetirementPacket.ps1:15 执行 test-dag-facade.ps1 作为 E05 的 golden-parity 证据,冻结的 orchestration/retirements/e05-publication/evidence/golden-parity.json 也记着这条 command。删文件会打断 E05 packet 的再生路径。本批只做到「下 CI」,删除留给 E05 收口。

其他

  • 重新 pin tests/dag_run.rsorchestration/internalization/{graph,sentrux}.json 的 conformance digest(这两处 pin 测试文件哈希)。已核对 internalization 目录内无其他 stale pin;retirement packet 的 overlay 冻结未动。
  • docs/ps1-exit/contract-inventory.md 第 80、82 行改为指向具体的 Rust test fn。

验证

  • cargo test 全绿:2631 passed / 45 suites
  • cargo fmt --all -- --check 干净
  • ci.yml YAML 解析通过,windows job 37 steps

观察到的既有 flake(非本 PR 引入,clean tree 亦复现):满并发跑全量时,internalization_record.rs:660recompute_sha 偶发 pwsh 子进程启动失败;dag_run.rs:392change impact --staleness current 也偶发。单独跑均稳定通过。已单开跟进。

Refs #78, #47

…ts (#78)

The first batch of the CI de-PS1 sweep. Two call points, two dispositions.

`test-run-commit-contract.ps1` (A / already covered): every assertion it made
has a Rust counterpart, most of them stronger. Marker schema is asserted at
tests/decision_record.rs:318, the manifest digest and verbatim byte
preservation at tests/run_commit.rs::cli_publication_preserves_the_callers_
manifest_bytes_and_digest, the CLI publication path at
::production_run_commit_cli_restages_a09_refs_through_a06_and_publishes, and
index admission at tests/dag_run.rs::production_dag_output_commits_and_enters_
the_authoritative_index plus the mutated-marker rejections in
tests/artifact_index.rs:159-182. The one assertion not carried over — that the
marker lacks the legacy generatedAt/reportSha256 fields — guarded the
PowerShell producer, which no longer writes the marker. The script is deleted.

`test-dag-facade.ps1` (B / ported): its hospital, doctor and manifest
assertions were already covered, but three were not, and the contract behind
them lived only in PowerShell. run-code-intel.ps1:3271 composed
`<artifact root>/<repo name>/<stamp>.dag-staging-<nonce>` and handed the result
to `run dag-coordinate --out`; the binary itself had no way to reach an
artifact root. So the composition moves into the binary as
`run dag-coordinate --artifact-root`, which also reads CODE_INTEL_ARTIFACT_ROOT
through the existing resolve_artifact_root, and the guard moves into
tests/dag_run.rs: a run lands as a direct child of the repository artifact
root, the repository name never repeats inside the path, the explicit flag and
the environment default produce byte-identical inventories, and a repository
named `repo & 文` survives the round trip. --out and --artifact-root are
mutually exclusive, because honouring one and dropping the other silently is
worse than refusing.

The script itself stays on disk: New-PublicationRetirementPacket.ps1:15
executes it as E05's golden-parity evidence, so deleting it is gated on E05
closing. Off CI is as far as this batch goes.

Also re-pins tests/dag_run.rs in the graph and sentrux internalization records,
which pin conformance-test digests.

Refs #78, #47
@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 31, 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: 17 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: ecf9c10b-098c-48d3-9365-7c28a2366d64

📥 Commits

Reviewing files that changed from the base of the PR and between fc7c364 and a56ca7d.

📒 Files selected for processing (20)
  • crates/code-intel-cli/tests/internalization_record.rs
  • orchestration/retirements/e07-native-code/compatibility-retirement-deletion-diff.json
  • orchestration/retirements/e07-native-code/compatibility-retirement-manifest.json
  • orchestration/retirements/e07-native-code/compatibility-retirement-ticket.json
  • orchestration/retirements/e07-native-code/e00-request.json
  • orchestration/retirements/e07-native-code/e01-request.json
  • orchestration/retirements/e07-native-code/e01-stderr.txt
  • orchestration/retirements/e07-native-code/evidence/c00-necessity.json
  • orchestration/retirements/e07-native-code/evidence/compatibility-window.json
  • orchestration/retirements/e07-native-code/evidence/contract-parity.json
  • orchestration/retirements/e07-native-code/evidence/dependency-inventory.json
  • orchestration/retirements/e07-native-code/evidence/dependency-snapshot.json
  • orchestration/retirements/e07-native-code/evidence/effect-parity.json
  • orchestration/retirements/e07-native-code/evidence/golden-parity.json
  • orchestration/retirements/e07-native-code/evidence/independent-approval.json
  • orchestration/retirements/e07-native-code/evidence/registry-reconciliation.json
  • orchestration/retirements/e07-native-code/evidence/replacement-atom.json
  • orchestration/retirements/e07-native-code/evidence/rollback-execution.json
  • orchestration/retirements/e07-native-code/evidence/usage-observation.json
  • orchestration/retirements/e07-native-code/gate-out/compatibility-retirement-decision.json
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added --artifact-root support for DAG coordination.
    • Artifact roots can be provided explicitly or through the CODE_INTEL_ARTIFACT_ROOT environment variable.
    • DAG staging directories are created automatically with unique timestamped names.
  • Bug Fixes

    • Improved validation for missing or conflicting staging options.
    • Execute mode now clearly rejects unsupported artifact-root usage.
  • Documentation

    • Updated command usage and coverage records for the revised DAG workflow.

Walkthrough

The CLI now supports --artifact-root and CODE_INTEL_ARTIFACT_ROOT for DAG staging. It composes unique repository staging paths, validates conflicting options, adds Rust integration coverage, removes obsolete Windows contract steps, and updates conformance records.

Changes

DAG artifact-root coordination

Layer / File(s) Summary
Artifact-root staging composition
crates/code-intel-cli/src/artifacts.rs
Adds artifact-root lookup and compose_dag_staging_dir. The function creates repository artifact directories and generates unique UTC-stamped staging paths.
CLI option validation and DAG wiring
crates/code-intel-cli/src/run_cli.rs, crates/code-intel-cli/tests/dag_run.rs
Adds --artifact-root and environment fallback support. DAG coordinate mode validates staging-path sources, while execute mode still requires --out. Tests cover path placement, special-character repositories, inventory output, and conflicting options.
CI and conformance evidence updates
.github/workflows/ci.yml, docs/ps1-exit/contract-inventory.md, orchestration/internalization/graph.json, orchestration/internalization/sentrux.json
Removes two Windows contract-test steps, documents Rust coverage and the deleted PowerShell test, and updates conformance hashes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant dag-coordinate
  participant compose_dag_staging_dir
  participant DAGExecution
  CLI->>dag-coordinate: parse staging-path options
  dag-coordinate->>compose_dag_staging_dir: compose path when artifact root is selected
  compose_dag_staging_dir-->>dag-coordinate: return unique staging directory
  dag-coordinate->>DAGExecution: run DAG with staging directory
Loading

Poem

A rabbit hops through artifact light,
Staging paths bloom in UTC night.
Roots are checked, conflicts flee,
Rust tests guard the DAG with glee.
CI steps rest beneath the moon.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the removal of the two PowerShell CI call points, which is the primary change.
Description check ✅ Passed The description directly explains the removed CI steps, added Rust CLI support, tests, retained script, and validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 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

🤖 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/run_cli.rs`:
- Around line 252-259: Update the validation in the dag-coordinate run path to
accept ARTIFACT_ROOT_ENV only when it contains a non-empty UTF-8 value, matching
resolve_artifact_root’s selection rule; otherwise return the existing
missing-artifact-root error. Add an integration test covering
CODE_INTEL_ARTIFACT_ROOT="" and verifying the command rejects it.
🪄 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: 5719f362-3faf-44b2-b9d4-79652e63ea33

📥 Commits

Reviewing files that changed from the base of the PR and between 3ccb31b and fc7c364.

📒 Files selected for processing (8)
  • .github/workflows/ci.yml
  • crates/code-intel-cli/src/artifacts.rs
  • crates/code-intel-cli/src/run_cli.rs
  • crates/code-intel-cli/tests/dag_run.rs
  • docs/ps1-exit/contract-inventory.md
  • legacy/scripts/tests/test-run-commit-contract.ps1
  • orchestration/internalization/graph.json
  • orchestration/internalization/sentrux.json
💤 Files with no reviewable changes (2)
  • legacy/scripts/tests/test-run-commit-contract.ps1
  • .github/workflows/ci.yml

Comment on lines +252 to +259
if out.is_none()
&& artifact_root.is_none()
&& env::var_os(ARTIFACT_ROOT_ENV).is_none()
{
return Err(format!(
"run dag-coordinate requires --out, --artifact-root, or {ARTIFACT_ROOT_ENV}"
));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reject an empty artifact-root environment value.

env::var_os(ARTIFACT_ROOT_ENV).is_some() accepts an empty or non-UTF-8 value. resolve_artifact_root ignores that value and selects LOCALAPPDATA or HOME instead. This can write the DAG run outside the user-selected artifact-root route.

Make this validation use the same non-empty UTF-8 rule as resolve_artifact_root. Add an integration test for CODE_INTEL_ARTIFACT_ROOT="".

Proposed fix
+                let has_artifact_root_env = env::var(ARTIFACT_ROOT_ENV)
+                    .ok()
+                    .is_some_and(|value| !value.trim().is_empty());
                 if out.is_none()
                     && artifact_root.is_none()
-                    && env::var_os(ARTIFACT_ROOT_ENV).is_none()
+                    && !has_artifact_root_env
                 {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if out.is_none()
&& artifact_root.is_none()
&& env::var_os(ARTIFACT_ROOT_ENV).is_none()
{
return Err(format!(
"run dag-coordinate requires --out, --artifact-root, or {ARTIFACT_ROOT_ENV}"
));
}
let has_artifact_root_env = env::var(ARTIFACT_ROOT_ENV)
.ok()
.is_some_and(|value| !value.trim().is_empty());
if out.is_none()
&& artifact_root.is_none()
&& !has_artifact_root_env
{
return Err(format!(
"run dag-coordinate requires --out, --artifact-root, or {ARTIFACT_ROOT_ENV}"
));
}
🤖 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/run_cli.rs` around lines 252 - 259, Update the
validation in the dag-coordinate run path to accept ARTIFACT_ROOT_ENV only when
it contains a non-empty UTF-8 value, matching resolve_artifact_root’s selection
rule; otherwise return the existing missing-artifact-root error. Add an
integration test covering CODE_INTEL_ARTIFACT_ROOT="" and verifying the command
rejects it.

…ance test

`Test-NativeCodeRetirementPacket.ps1:33-37` folds
`crates/code-intel-cli/tests/dag_run.rs` into E07's frozen source set, so adding
the artifact-root routing tests to that file made the packet stale and the
Windows lane failed on `E07 packet is stale relative to its frozen source set`.

Regenerated through `New-NativeCodeRetirementPacket.ps1` against the current
working tree, reusing the packet's original `EvaluatedAt` (1785441780) so the
compatibility window keeps its real start date — only the source snapshot
changed, not when the retirement was evaluated. The diff is 19 files, one line
each, all `snapshotIdentity`; every other field is byte-identical.

`test-retirement-packets.ps1` now passes all 8 packets and both audits.

Refs #78
…ough pwsh

`recompute_sha` shelled out to `Get-FileHash` once per pinned file, and every
operation trace pins two. The macOS runner killed the resulting burst of
concurrent `pwsh` processes with `Stack overflow.`, which surfaced as 26 of 40
records failing at once and read exactly like real digest drift. The same
helper flaked on Windows under full-suite parallelism earlier in this branch.

`content_contract::sha256_hex` over the same bytes is the same digest, so
nothing about what these records assert changes — only how the number is
obtained. The suite also drops from ~34s to ~21s locally.

Refs #78
@2233admin
2233admin merged commit 6b226e9 into main Jul 31, 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