Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ jobs:
$env:CODE_INTEL_SMOKE_BIN = Get-CodeIntelBinDir -Platform $platform
cargo test -p code-intel --test install_smoke --locked packaged_install_runs_relocated_sentrux_shim -- --ignored --nocapture
if ($LASTEXITCODE -ne 0) { throw "packaged sentrux-shim install smoke failed with exit ${LASTEXITCODE}" }

# #232 / DR-0001: the doctor bootstrap node reads
# <bin>/legacy/run-code-intel.ps1 and <bin>/pipeline.config.json
# unconditionally; a from-release install that skips deploying them
Expand All @@ -706,6 +707,28 @@ jobs:
cargo test -p code-intel --test install_smoke --locked packaged_install_deploys_legacy_pipeline_entrypoint -- --ignored --nocapture
if ($LASTEXITCODE -ne 0) { throw "packaged legacy-pipeline-entrypoint install smoke failed with exit ${LASTEXITCODE}" }

- name: Packaged installer stale-home smoke
shell: pwsh
run: |
# DR-0001: invoke the packaged installer with an existing stale
# `$env:CODE_INTEL_HOME` and prove the explicit release root wins.
$bootstrap = Get-Content -Raw -LiteralPath (Join-Path $env:RUNNER_TEMP "code-intel-smoketest-bootstrap.json") | ConvertFrom-Json
$releaseRoot = [IO.Path]::GetFullPath([string]$bootstrap.release_root)
$staleHome = Join-Path $env:RUNNER_TEMP "code-intel-stale-home"
New-Item -ItemType Directory -Force -Path $staleHome | Out-Null
$env:CODE_INTEL_HOME = $staleHome
$installer = Join-Path $releaseRoot "legacy/install-code-intel-pipeline.ps1"
$raw = & pwsh -NoProfile -File $installer -RepoPath $releaseRoot -SkipSentruxVlangOverlay -RequireRepowise:$false -Json
if ($LASTEXITCODE -ne 0) {
throw "packaged installer stale-home smoke failed with exit code ${LASTEXITCODE}:`n$($raw -join [Environment]::NewLine)"
}
$result = ($raw -join [Environment]::NewLine) | ConvertFrom-Json
$actualHome = [IO.Path]::GetFullPath([string]$result.paths.codeIntelHome)
if ($actualHome -ne $releaseRoot) {
throw "packaged installer kept stale $env:CODE_INTEL_HOME '$actualHome' instead of release root '$releaseRoot'"
}
Write-Host "Packaged installer explicit-root smoke passed: $actualHome"

- name: Packaged Sentrux capability closure smoke
shell: pwsh
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- `sentrux gate` 在全新 checkout 上因缺基线硬崩溃:missing-baseline 前置检查原本查的是 native baseline 路径,实际 `sentrux gate` 读的是 lite 引擎的 `.sentrux/cache/lite-baseline.json`,现已对齐,缺失时正确落回 `manual_required`(fixes #322)。
- 安装器在显式传入新的仓库或发布根目录时不再被陈旧的 `$env:CODE_INTEL_HOME` 覆盖,避免新二进制读取旧的 Provider manifest(fixes #363)。
- 修复 workflow recommendation 的 Rust 侧 parity 回归(#314)。
- `sentrux_gate` 全量并行测试踩踏两处根因分开修:(1) `tool_path.rs` 的 `path_search_skips_relative_entries` 探测目录名只用 `module_path!()`,在被 `#[path]` 编入多个 `cargo test` 二进制(`run_commit`/`survival_scan` 等)时对同名父模块编译时相同,跨进程共享同一 `target/tool-path-*` 目录并互相踩踏;现补上 `std::process::id()` + 进程内 `AtomicU64` 计数器,与 #175 的 `unique_temp_dir()` 同一套 pid+nonce 写法(fixes #178)。(2) `sentrux_gate.rs`/`boundary_rules_tests.rs` 里 9 处 `run_check(...).expect(...)`/`run_gate(...).expect(...)` 把"引擎子进程没跑起来"和"仓库真的检测到规则违规"报成同一个红灯;新增仅测试用的 `expect_check_ran`/`expect_gate_ran` helper,`Err` 分支 panic 出明确区分于业务断言的文案,并配 `#[should_panic]` regression 测试直接执行 `Err` 路径验证文案本身(fixes #192)。
- **安装器从未把 `legacy/run-code-intel.ps1` 与 `pipeline.config.json` 部署进 `<bin>`,导致每个正式发布安装都过不了 doctor bootstrap 就绪检查(#232)**:`doctor_bootstrap::observe` 无条件要求这两个文件存在于 `<bin>` 下,跟 `require_understand`/`require_repowise` 不同,没有 `options` 开关;而 `Install-CodeIntelBinary` 只部署了编译产物和 `orchestration/integrations.json`。新增 `Install-LegacyPipelineEntrypoint`(复刻既有 `Install-IntegrationsManifest` 的 `Copy-Item` 写法)补齐这一步,并按 DR-0001 把复现测试并入 install-smoke CI 闸(非 ignore 断言部署步骤存在,`#[ignore]` 版由打包安装 CI 步骤实跑)。
Expand Down
21 changes: 21 additions & 0 deletions legacy/scripts/tests/test-regression-fixes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,8 @@ Test-Case "check-code-intel-tools.ps1 fails CODE_INTEL_HOME pointing at a missin
# ---------------------------------------------------------------------------
. (Get-ScriptFunctionsSource -Path (Join-Path $root "tools\code-intel-platform.psm1") -Only @(
"Get-CodeIntelPlatform",
"Get-CodeIntelHome",
"Resolve-CodeIntelPath",
"Get-CodeIntelPosixProfileInstruction",
"ConvertTo-CodeIntelPosixEnvLine",
"Update-CodeIntelPosixEnvContent",
Expand All @@ -943,6 +945,25 @@ Test-Case "check-code-intel-tools.ps1 fails CODE_INTEL_HOME pointing at a missin
"Add-UserPathPrefix"
))

Test-Case "explicit installer root wins over a stale CODE_INTEL_HOME override" {
$dir = New-ScratchDir "explicit-home"
$legacy = Join-Path $dir "legacy-release"
$current = Join-Path $dir "current-release"
New-Item -ItemType Directory -Force -Path $legacy, $current | Out-Null
$previousHome = $env:CODE_INTEL_HOME
try {
$env:CODE_INTEL_HOME = $legacy
$resolved = Get-CodeIntelHome -Root $current
Assert-Equal (Get-Item -LiteralPath $current).FullName $resolved "installer root must not be shadowed by a stale ambient CODE_INTEL_HOME"
Assert-Equal (Get-Item -LiteralPath $legacy).FullName (Get-CodeIntelHome) "ambient CODE_INTEL_HOME must remain the fallback without an explicit root"
Assert-Equal (Get-Item -LiteralPath $legacy).FullName (Get-CodeIntelHome -Root " ") "a whitespace root must use the ambient fallback"
}
finally {
$env:CODE_INTEL_HOME = $previousHome
Remove-Item -Recurse -Force $dir -ErrorAction SilentlyContinue
}
}

Test-Case "posix env: profile instruction is the single copy-paste source line per platform" {
Assert-Equal "echo 'source ~/.config/code-intel/env.sh' >> ~/.zshrc" (Get-CodeIntelPosixProfileInstruction -Platform macos) "macos instruction must target ~/.zshrc"
Assert-Equal "echo 'source ~/.config/code-intel/env.sh' >> ~/.bashrc" (Get-CodeIntelPosixProfileInstruction -Platform linux) "linux instruction must target ~/.bashrc"
Expand Down
6 changes: 3 additions & 3 deletions legacy/tools/code-intel-platform.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ function Get-CodeIntelPlatform {
function Get-CodeIntelHome {
param([string]$Root = "")

if (-not [string]::IsNullOrWhiteSpace($env:CODE_INTEL_HOME)) {
return (Resolve-CodeIntelPath $env:CODE_INTEL_HOME)
}
if (-not [string]::IsNullOrWhiteSpace($Root)) {
return (Resolve-CodeIntelPath $Root)
}
if (-not [string]::IsNullOrWhiteSpace($env:CODE_INTEL_HOME)) {
return (Resolve-CodeIntelPath $env:CODE_INTEL_HOME)
}
return (Resolve-CodeIntelPath (Get-Location).Path)
}

Expand Down
Loading