Skip to content

FLT-322 fix brief 2: sync-push shadow wiring (Cedric)

Read docs/flt-322-sync-push-fix-brief.md, whose requirements stand. Your repair is still uncommitted in this worktree. The orchestrator ran your tests in a normal shell: 0 of 20 on both hosts. Do not commit or push.

What failed, verbatim

powershell (5.1), every test. Editing dropped the file's UTF-8 BOM. The original begins EF BB BF, yours begins 3C 23 0D. Windows PowerShell then reads the file as ANSI, and an em dash in an existing line breaks the parser:

At ...\sync-push.ps1:156 char:24
+     "macs: SKIPPED ..." mac-reconcile.sh not found next to this script ...
Unexpected token 'mac-reconcile.sh' in expression or statement.

Every session in the fleet runs this script with powershell -File. Landing that would have stopped every push in the family.

pwsh, every test.

fatal: '$GIT_DIR' too big
You cannot call a method on a null-valued expression.
at Get-OriginHead, tests\sync-push-shadow.Tests.ps1: line 67
at Assert-Pushed, tests\sync-push-shadow.Tests.ps1: line 76

Fix

  1. Restore the BOM, so the file's encoding matches the original. Do not change the existing non-ASCII lines.
  2. Add a first test, parses and runs under Windows PowerShell 5.1: it checks the script's first three bytes are the BOM, and runs the real script with powershell -NoProfile -NonInteractive -File with -SkipPeers -SkipMacs -NoPush against a real temp repo, asserting exit 0 and no parser error in the output. This must fail on your current file. Confirm that by running it before you restore the BOM.
  3. Fix the $GIT_DIR too big failure at Get-OriginHead. Find the cause. Do not assume it is the path length alone.
  4. Fix whatever else fails once those are gone. Fix the code when it is wrong and the test when the test is wrong, and name which in your report.

You can run the tests now

The sandbox refused Pester's TestRegistry feature, which these tests do not use. Turn that feature off in configuration. This does not touch the registry or any policy. Do not change the execution policy and do not run an edited copy of the tests.

Import-Module Pester -MinimumVersion 5.0
$c = New-PesterConfiguration
$c.Run.Path = 'tests/sync-push-shadow.Tests.ps1'
$c.TestRegistry.Enabled = $false
$c.Output.Verbosity = 'Detailed'
$env:FORGE_SMOKE_REAL_BIN = 'C:\Users\fives\source\repos\fleet-harness-wt\WT-0cdb-FLT-322\src\Forge.Gates.Smoke.Cli\bin\Release\net10.0\forge-smoke.exe'
$env:FRS_TEST_HOST = 'powershell'; Invoke-Pester -Configuration $c
$env:FRS_TEST_HOST = 'pwsh';       Invoke-Pester -Configuration $c

Bound each run to 10 minutes, hidden. Iterate until both hosts are green. If a further sandbox refusal stops you, state the exact refused call and stop.

Report

Update docs/flt-322-sync-push-report.md, short: final real output for both hosts, and what you changed. The orchestrator re-runs everything before accepting.