修复错误,优化性能,实现类型系统,优化安装卸载过程

This commit is contained in:
LIm1tZz7 committed 2026-10-05 00:15:01 +08:00
1 parent fd5f320360
commit 48eec484b7
104 files changed
+4127 -845

No files matched your search

+8 -6
View File
@@ -1,6 +1,6 @@
# gate-check — 项目门禁
独立门禁目录,不再放在 `localdata/`(那里只留历史日志)。入口是 `run-gate.ps1`,三条车道并行。
独立门禁目录:脚本与说明都在这一个目录,入口是 `run-gate.ps1`,三条车道并行;车道日志与临时目录写到仓库根的 `logs/`。
## 快速开始
@@ -18,27 +18,29 @@ pwsh -NoProfile -File gate-check/run-gate.ps1 -Only server # 只跑一条车道
| --- | --- | --- |
| build | `cargo build --release` | 先单独跑:Haskell 测试要从 `chusql-core/storage/target/release` 加载动态库 |
| cargo | `cargo test --release`、`cargo clippy --all-targets -- -D warnings` | `-NoLint` 跳过 clippy |
| stack | engine → server → web → cli 的 `stack test <pkg> --fast` | 串行:stack 与快照目录不能并发写 |
| stack | engine → server → web → cli → bootstrap 的 `stack test <pkg> --fast` | 串行:stack 与快照目录不能并发写 |
| comments | `comment-check.ps1`、`comment-purity.ps1` | 注释长度与注释纯度 |
`build` 车道先跑完,再并行启动其余三条;这样动态库刷新与 Haskell 测试不会互相抢文件。
Web 步骤会先显式刷新该工程里的 model、engine、interface 与 server 本地依赖,再运行 Web 测试,避免构建工具依赖复用旧的注册库。刷新失败会使 Web 步骤失败,不继续测试。
## 退出码与日志
- 每步打印一行 `STEP_EXIT <步骤> <码>`;任一非零则 `GATE_EXIT=1`,否则 `GATE_EXIT=0`。
- 末尾打印 `STEPS=...`(各步骤退出码)与总用时。
- 日志在 `gate-check/logs/<车道>.log`(stderr 在 `.err.log`),终端实时转发同一份内容;文件不进版本库。
- 日志在仓库根的 `logs/<车道>.log`(stderr 在 `.err.log`),终端实时转发同一份内容;文件不进版本库。
- `comment-check.ps1` 有问题数时退出 1;`comment-purity.ps1` 只报告差异,恒退出 0。
## 相对旧脚本的提速点
1. 默认不再 `stack clean --full`:改为零清理;`-Clean` 只清各项目自己的工件,`-Full` 才回到旧行为。
2. 车道并行:Rust 测试 + clippy、四个 Haskell 套件、注释检查同时跑。
2. 车道并行:Rust 测试 + clippy、五个 Haskell 套件、注释检查同时跑。
3. 输出流式:旧脚本 `| Out-String` 要等整步跑完才吐字,这里逐行实时转发。
4. 单车道开关 `-Only`,改一个模块时不用全量。
## 约定
- 门禁由项目所有者手动运行;agent 只跑模块级测试,不跑全量门禁。
- 期望基线(随里程碑更新):Engine 357 / Server 88 / Web 56 / CLI 10 / Rust 140。
- 计数与主线进度以 `agent_credientials/project-plan.txt` 为准。
- 期望基线(随里程碑更新):Engine 373 / Server 102 / Web 56 / CLI 13 / Bootstrap 9 / Rust 154。
- 计数与主线进度以 `agent-credientials/project-plan.txt` 为准。
+1 -2
View File
@@ -2,7 +2,7 @@
# 有问题的文件不静默:问题数大于 0 时退出码为 1
param([string]$Root = (Split-Path -Parent $PSScriptRoot), [string[]]$Only)
$codeDirs = @('chusql-core','chusql-server','chusql-web','chusql-cli','chusql-bootstrap','chusql-interface','chusql-benchmark','scripts','gate-check')
$codeDirs = @('chusql-core','chusql-server','chusql-web','chusql-cli','chusql-bootstrap','chusql-interface','benchmark','scripts','gate-check')
$files = @()
foreach ($d in $codeDirs) {
$p = Join-Path $Root $d
@@ -13,7 +13,6 @@ foreach ($d in $codeDirs) {
}
if ($Only) { $files = $files | Where-Object { $n = $_.Name; ($Only | Where-Object { $n -like $_ }).Count -gt 0 } }
$files = $files | Sort-Object FullName
$files = $files | Where-Object { $_.FullName -notmatch '\\localdata\\' }
$problems = @()
$scanned = 0
+2 -2
View File
@@ -3,13 +3,13 @@
param([string]$Root = (Split-Path -Parent $PSScriptRoot))
Set-Location $Root
$dirs = @('chusql-core','chusql-server','chusql-web','chusql-cli','chusql-bootstrap','chusql-interface','chusql-benchmark','scripts','gate-check')
$dirs = @('chusql-core','chusql-server','chusql-web','chusql-cli','chusql-bootstrap','chusql-interface','benchmark','scripts','gate-check')
$files = @()
foreach ($d in $dirs) {
$p = Join-Path $Root $d
if (Test-Path -LiteralPath $p) {
$files += Get-ChildItem -LiteralPath $p -Recurse -File -Include *.hs,*.rs,*.js,*.css,*.html,*.ps1,*.sh |
Where-Object { $_.FullName -notmatch '\\\.stack-work\\|\\dist-newstyle\\|\\target\\|\\node_modules\\|\\localdata\\|\\logs\\|\\tmp\\' }
Where-Object { $_.FullName -notmatch '\\\.stack-work\\|\\dist-newstyle\\|\\target\\|\\node_modules\\|\\logs\\|\\tmp\\' }
}
}
$files = $files | Sort-Object FullName
+3 -3
View File
@@ -13,8 +13,8 @@ $env:GHC_CHARENC = 'UTF-8'
try { [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 } catch { }
$OutputEncoding = [System.Text.Encoding]::UTF8
$LogDir = Join-Path $PSScriptRoot 'logs'
$TmpDir = Join-Path $PSScriptRoot 'tmp'
$LogDir = Join-Path $Root 'logs'
$TmpDir = Join-Path $LogDir 'tmp'
New-Item -ItemType Directory -Force -Path $LogDir, $TmpDir | Out-Null
$env:PATH = (Join-Path $Root 'chusql-core\storage\target\release') + ';' + $env:PATH
$env:TEMP = $TmpDir
@@ -77,7 +77,7 @@ function Wait-Lanes($Lanes) {
# 清理本地依赖工件:-Clean 只清各项目自己的,-Full 连依赖副本一起清
function Invoke-Clean {
foreach ($dir in @('chusql-core\engine', 'chusql-server', 'chusql-web', 'chusql-cli')) {
foreach ($dir in @('chusql-core\engine', 'chusql-server', 'chusql-web', 'chusql-cli', 'chusql-bootstrap')) {
$argv = @('clean')
if ($Full) { $argv += '--full' }
Write-Host "== stack $($argv -join ' ') in $dir" -ForegroundColor DarkGray
+13 -4
View File
@@ -12,15 +12,23 @@ $OutputEncoding = [System.Text.Encoding]::UTF8
$codes = @()
# 跑一个步骤:切目录、输出原样透传、记录退出码
function Invoke-Step([string]$Label, [string]$Dir, [string[]]$Argv) {
function Invoke-Step([string]$Label, [string]$Dir, [string[]]$Argv, [string[]]$RefreshPackages = @()) {
Write-Host "=== $Label ==="
$code = 1
Push-Location -LiteralPath $Dir
try {
$exe = $Argv[0]
$rest = @($Argv | Select-Object -Skip 1)
& $exe @rest
if ($null -ne $global:LASTEXITCODE) { $code = [int]$global:LASTEXITCODE }
$ready = $true
if ($RefreshPackages.Count -gt 0) {
& stack build @RefreshPackages --fast --force-dirty
$code = [int]$global:LASTEXITCODE
$ready = $code -eq 0
}
if ($ready) {
& $exe @rest
if ($null -ne $global:LASTEXITCODE) { $code = [int]$global:LASTEXITCODE }
}
}
catch {
Write-Host "--- $Label raised: $_"
@@ -47,8 +55,9 @@ switch ($Kind) {
'stack' {
Invoke-Step 'engine' $engine @('stack', 'test', 'chusql-core-engine', '--fast')
Invoke-Step 'server' (Join-Path $Root 'chusql-server') @('stack', 'test', 'chusql-server', '--fast')
Invoke-Step 'web' (Join-Path $Root 'chusql-web') @('stack', 'test', 'chusql-web', '--fast')
Invoke-Step 'web' (Join-Path $Root 'chusql-web') @('stack', 'test', 'chusql-web', '--fast') @('chusql-core-model', 'chusql-core-engine', 'chusql-interface', 'chusql-server')
Invoke-Step 'cli' (Join-Path $Root 'chusql-cli') @('stack', 'test', 'chusql-cli', '--fast')
Invoke-Step 'bootstrap' (Join-Path $Root 'chusql-bootstrap') @('stack', 'test', 'chusql-bootstrap', '--fast')
}
'comments' {
$check = Join-Path $PSScriptRoot 'comment-check.ps1'