Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Normalize shell line endings and dotnet test scripts

Yuechen Li36bfa6e76f79
diff --git a/.gitattributes b/.gitattributes
index 561765e2..01a7bca2 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -69,5 +69,6 @@ testdata/step242/**/*.json text eol=lf
#*.RTF diff=astextplain
*.json text eol=lf
+*.sh text eol=lf
*.stp text eol=lf
*.step text eol=lf
diff --git a/Aetheris.CLI.Tests/AirTraceCommandTests.cs b/Aetheris.CLI.Tests/AirTraceCommandTests.cs
index 93b5abf1..c63999b7 100644
--- a/Aetheris.CLI.Tests/AirTraceCommandTests.cs
+++ b/Aetheris.CLI.Tests/AirTraceCommandTests.cs
@@ -1227,8 +1227,8 @@ public sealed class AirTraceCommandTests
var secondDir = Path.Combine(Path.GetTempPath(), "aetheris-trace-tests", Guid.NewGuid().ToString("N"));
Assert.Equal(0, Run("trace", "--fixture", FirmamentV2Fixture("Region/valid/side-hole-v2.valid.firmfixture"), "--out-dir", firstDir).ExitCode);
Assert.Equal(0, Run("trace", "--fixture", FirmamentV2Fixture("Region/valid/side-hole-v2.valid.firmfixture"), "--out-dir", secondDir).ExitCode);
- var first = File.ReadAllText(Path.Combine(firstDir, "side-hole-v2.trace.json")).Replace(firstDir, "<OUT>");
- var second = File.ReadAllText(Path.Combine(secondDir, "side-hole-v2.trace.json")).Replace(secondDir, "<OUT>");
+ var first = NormalizeOutDir(File.ReadAllText(Path.Combine(firstDir, "side-hole-v2.trace.json")), firstDir);
+ var second = NormalizeOutDir(File.ReadAllText(Path.Combine(secondDir, "side-hole-v2.trace.json")), secondDir);
Assert.Equal(first, second);
}
@@ -1299,6 +1299,9 @@ public sealed class AirTraceCommandTests
private static string PrimitiveFixture(string relative) => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/Firmament/Primitive", relative));
private static string RegionFixture(string relative) => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/Firmament/Region", relative));
private static string FirmamentV2Fixture(string relative) => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/FirmamentV2", relative));
+ private static string NormalizeOutDir(string text, string outDir) =>
+ text.Replace(outDir.Replace("\\", "\\\\", StringComparison.Ordinal), "<OUT>", StringComparison.Ordinal)
+ .Replace(outDir, "<OUT>", StringComparison.Ordinal);
[Fact]
public void FirmamentV2SideHoleYAxis_TraceJsonContainsRouteEvidence()
diff --git a/docs/build-hygiene-x1-local-build-fixes.md b/docs/build-hygiene-x1-local-build-fixes.md
new file mode 100644
index 00000000..c1eeccdd
--- /dev/null
+++ b/docs/build-hygiene-x1-local-build-fixes.md
@@ -0,0 +1,115 @@
+# BUILD-HYGIENE-X1 — local build fixes after FTC-06 validation
+
+## 1. Problem statement
+
+STEP-AP242-HARDEN-X1 completed its intended FTC-06 `ADVANCED_FACE.same_sense` preservation work, but local validation still exposed two unrelated hygiene blockers in the everyday developer loop:
+
+- `scripts/test-active.sh` failed under bash because the shell scripts were checked in with CRLF line endings.
+- `dotnet build Aetheris.slnx -f net10.0 --no-restore` could fail on Windows with locked files under `obj`, including `Aetheris.Server` static web asset cache files and Roslyn-produced intermediate DLLs in other projects.
+
+These fixes are local build/test hygiene only.
+
+## 2. CRLF shell script root cause
+
+All tracked `scripts/*.sh` files were stored with CRLF line endings. Under bash this surfaced as:
+
+```text
+set: pipefail\r: invalid option name
+```
+
+## 3. Line-ending policy
+
+The scripts were normalized to LF and the repo policy now explicitly protects shell scripts with:
+
+```gitattributes
+*.sh text eol=lf
+```
+
+This keeps Git Bash and other POSIX shells from reintroducing CRLF into shell entrypoints.
+
+## 4. File-lock symptom
+
+The full solution build could fail with errors such as:
+
+- `CS2012` on `obj\Debug\net10.0\*.dll` files, often reported as locked by `VBCSCompiler`;
+- `MSB3491` / `MSB3501` on `*.FileListAbsolute.txt`;
+- `MSB4018` in `Aetheris.Server` static web asset cache files such as `rpswa.dswa.cache.json`.
+
+## 5. File-lock root cause found
+
+This was reproducible locally without any long-lived `Aetheris.Server` process running.
+
+Observed diagnosis:
+
+- `Get-Process Aetheris.Server` returned no live server process.
+- Sysinternals `handle.exe` was not installed locally.
+- `Get-CimInstance Win32_Process` showed active `VBCSCompiler.exe` plus many `dotnet ... MSBuild.dll /nodemode:1 /nodeReuse:true` worker processes during the failing build.
+- The failing solution build logged several projects being built twice in the same invocation, including repeated output lines such as `Aetheris.Kernel.Core -> ...`, `Aetheris.Forge -> ...`, and `Aetheris.Server -> ...`.
+- `dotnet build Aetheris.slnx -f net10.0 --no-restore -m:1` succeeded, while the default parallel build reproduced the locks.
+
+The local root cause is therefore solution-build parallelism against shared intermediate outputs in the current solution graph, not a CAD/STEP behavior regression and not a required server-process teardown change.
+
+## 6. Fix applied or local remediation steps
+
+Applied fixes:
+
+- normalized all `scripts/*.sh` files to LF;
+- added `.gitattributes` protection for `*.sh`;
+- taught the bash helper scripts to resolve `dotnet` reliably on Windows Git Bash by honoring `DOTNET_BIN`, `dotnet`, `dotnet.exe`, or the standard `C:\Program Files\dotnet\dotnet.exe` location;
+- aligned `scripts/test-active.sh` with the existing active-suite policy by passing `--filter "Category!=SlowCorpus"` so NIST slow-corpus snapshot audits do not leak back into the default active lane;
+- added repo-local `Directory.Build.rsp` with:
+
+```text
+-maxCpuCount:1
+```
+
+`Directory.Build.rsp` is automatically consumed by command-line MSBuild / `dotnet build`, so the normal repo command:
+
+```bash
+dotnet build Aetheris.slnx -f net10.0 --no-restore
+```
+
+now runs with the same sequential scheduling that proved stable during diagnosis.
+
+If someone intentionally wants to bypass repo defaults for an experiment, they can use `-noAutoResponse` and pass explicit MSBuild switches themselves.
+
+## 7. Commands run
+
+Commands used during diagnosis and validation:
+
+```bash
+file scripts/*.sh
+grep -RIl $'\r' scripts || true
+bash -n scripts/test-active.sh
+bash -n scripts/test-legacy.sh
+bash -n scripts/test-corpus.sh
+bash -n scripts/test-diagnose-hang.sh
+dotnet --info
+dotnet restore Aetheris.slnx
+dotnet clean Aetheris.slnx -f net10.0
+dotnet build Aetheris.slnx -f net10.0 --no-restore
+dotnet build Aetheris.slnx -f net10.0 --no-restore -m:1
+Get-Process dotnet -ErrorAction SilentlyContinue | Select-Object Id,ProcessName,Path,StartTime
+Get-Process Aetheris.Server -ErrorAction SilentlyContinue
+Get-CimInstance Win32_Process | Where-Object { $_.Name -match 'VBCSCompiler|dotnet' } | Select-Object ProcessId,Name,CommandLine
+```
+
+Post-fix validation also included the active script/test loop and focused FTC-06 coverage.
+
+## 8. Remaining limitations
+
+- The underlying duplicate-work scheduling shape of the current solution graph still merits future cleanup if faster parallel solution builds become a priority.
+- The repo-local mitigation intentionally favors reliable local command-line builds over maximum build parallelism.
+- The JavaScript SDK still reports existing npm audit warnings during build; those warnings were pre-existing and are outside BUILD-HYGIENE-X1 scope.
+
+## 9. Non-goals
+
+This milestone does not:
+
+- change STEP import/export semantics;
+- change CAD/kernel behavior;
+- change BRep topology behavior;
+- change Firmament V2 language semantics or lowering behavior;
+- change AIR Region route policy;
+- change CIR behavior;
+- change Firmasm behavior.
diff --git a/docs/build-test-policy-net10-and-legacy-v1.md b/docs/build-test-policy-net10-and-legacy-v1.md
index c9ccc7b1..12883c58 100644
--- a/docs/build-test-policy-net10-and-legacy-v1.md
+++ b/docs/build-test-policy-net10-and-legacy-v1.md
@@ -43,6 +43,8 @@ The helper scripts are:
`test-all.sh` is the active/default lane. `test-legacy.sh` exports `AETHERIS_RUN_LEGACY_TESTS=1` and runs the same `net10.0` framework lane with legacy sources included.
+Shell helper scripts in `scripts/*.sh` are repository-managed as LF line ending files. `.gitattributes` enforces `*.sh text eol=lf` so Git Bash and other POSIX shells do not trip over CRLF control characters.
+
## Promoting useful legacy tests
When a Firmament V1 or FrictionLab scenario becomes relevant to current V2/Core work:
@@ -84,4 +86,6 @@ AETHERIS_RUN_LEGACY_TESTS=1 dotnet test Aetheris.FrictionLab.Tests/Aetheris.Fric
scripts/test-corpus.sh
```
+Command-line MSBuild in this repo also uses `Directory.Build.rsp` to apply `-maxCpuCount:1` for repo-local builds. This keeps the current `Aetheris.slnx` developer loop reliable on Windows while the solution graph is still scheduling duplicate project work against shared `obj` outputs under higher parallelism.
+
When adding new corpus tests, keep representative active smoke coverage in the default suite and gate only the broad audit/corpus expansion.
diff --git a/scripts/_dotnet-env.sh b/scripts/_dotnet-env.sh
new file mode 100644
index 00000000..570d959c
--- /dev/null
+++ b/scripts/_dotnet-env.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+resolve_dotnet_bin() {
+ if command -v dotnet >/dev/null 2>&1; then
+ printf '%s\n' "dotnet"
+ return 0
+ fi
+
+ if command -v dotnet.exe >/dev/null 2>&1; then
+ printf '%s\n' "dotnet.exe"
+ return 0
+ fi
+
+ local windows_dotnet="/c/Program Files/dotnet/dotnet.exe"
+ if [[ -x "$windows_dotnet" ]]; then
+ printf '%s\n' "$windows_dotnet"
+ return 0
+ fi
+
+ printf '%s\n' "dotnet executable not found. Set DOTNET_BIN explicitly if dotnet is installed outside PATH." >&2
+ return 1
+}
diff --git a/scripts/test-active.sh b/scripts/test-active.sh
index b993d0de..251596ec 100755
--- a/scripts/test-active.sh
+++ b/scripts/test-active.sh
@@ -4,12 +4,16 @@ set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_root"
+source "$repo_root/scripts/_dotnet-env.sh"
+dotnet_bin="${DOTNET_BIN:-$(resolve_dotnet_bin)}"
+active_filter="Category!=SlowCorpus"
+
unset AETHERIS_RUN_LEGACY_TESTS
unset AETHERIS_RUN_CORPUS_TESTS
-dotnet build Aetheris.slnx -f net10.0 --no-restore
+"$dotnet_bin" build Aetheris.slnx -f net10.0 --no-restore
-dotnet test Aetheris.CLI.Tests/Aetheris.CLI.Tests.csproj -f net10.0 --no-build --logger "console;verbosity=minimal"
-dotnet test Aetheris.Kernel.Firmament.Tests/Aetheris.Kernel.Firmament.Tests.csproj -f net10.0 --no-build --logger "console;verbosity=minimal"
-dotnet test Aetheris.Kernel.Core.Tests/Aetheris.Kernel.Core.Tests.csproj -f net10.0 --no-build --logger "console;verbosity=minimal"
-dotnet test Aetheris.slnx -f net10.0 --no-build --logger "console;verbosity=minimal"
+"$dotnet_bin" test Aetheris.CLI.Tests/Aetheris.CLI.Tests.csproj -f net10.0 --no-build --filter "$active_filter" --logger "console;verbosity=minimal"
+"$dotnet_bin" test Aetheris.Kernel.Firmament.Tests/Aetheris.Kernel.Firmament.Tests.csproj -f net10.0 --no-build --filter "$active_filter" --logger "console;verbosity=minimal"
+"$dotnet_bin" test Aetheris.Kernel.Core.Tests/Aetheris.Kernel.Core.Tests.csproj -f net10.0 --no-build --filter "$active_filter" --logger "console;verbosity=minimal"
+"$dotnet_bin" test Aetheris.slnx -f net10.0 --no-build --filter "$active_filter" --logger "console;verbosity=minimal"
diff --git a/scripts/test-all.sh b/scripts/test-all.sh
index dd21eb84..2b77d954 100755
--- a/scripts/test-all.sh
+++ b/scripts/test-all.sh
@@ -1,8 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
-DOTNET_BIN="${DOTNET_BIN:-dotnet}"
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+source "$REPO_ROOT/scripts/_dotnet-env.sh"
+DOTNET_BIN="${DOTNET_BIN:-$(resolve_dotnet_bin)}"
PRIMARY_TFM="${AETHERIS_PRIMARY_TFM:-net10.0}"
run() {
diff --git a/scripts/test-corpus.sh b/scripts/test-corpus.sh
index 51ddf40a..afd359fa 100755
--- a/scripts/test-corpus.sh
+++ b/scripts/test-corpus.sh
@@ -4,7 +4,10 @@ set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_root"
-AETHERIS_RUN_CORPUS_TESTS=1 dotnet test Aetheris.Kernel.Firmament.Tests/Aetheris.Kernel.Firmament.Tests.csproj \
+source "$repo_root/scripts/_dotnet-env.sh"
+dotnet_bin="${DOTNET_BIN:-$(resolve_dotnet_bin)}"
+
+AETHERIS_RUN_CORPUS_TESTS=1 "$dotnet_bin" test Aetheris.Kernel.Firmament.Tests/Aetheris.Kernel.Firmament.Tests.csproj \
-f net10.0 \
--filter "FirmamentCirDifferentialAnalysisTests|Category=Corpus|AetherisSuite=Corpus" \
--logger "console;verbosity=minimal"
diff --git a/scripts/test-diagnose-hang.sh b/scripts/test-diagnose-hang.sh
index da9b8ecd..7f889ba1 100755
--- a/scripts/test-diagnose-hang.sh
+++ b/scripts/test-diagnose-hang.sh
@@ -9,13 +9,16 @@ fi
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_root"
+source "$repo_root/scripts/_dotnet-env.sh"
+dotnet_bin="${DOTNET_BIN:-$(resolve_dotnet_bin)}"
+
subject="$1"
shift
stamp="$(date -u +%Y%m%dT%H%M%SZ)"
results_dir="artifacts/test-diagnostics/hang-$stamp"
mkdir -p "$results_dir"
-dotnet test "$subject" -f net10.0 --no-build \
+"$dotnet_bin" test "$subject" -f net10.0 --no-build \
--blame-hang --blame-hang-timeout "${AETHERIS_BLAME_HANG_TIMEOUT:-120s}" \
--logger "console;verbosity=detailed" \
--results-directory "$results_dir" \