Skip to content

FLT-322 brief: wire the smoke gate into sync-push in shadow (Susie Franny)

sync-push.ps1 runs on every push in the fleet. Today a failure in this wiring would stop the whole family's work, so the first rule is that nothing this adds may change whether, or how, the push and the peer pulls happen. The gate observes only.

Working directory: C:\Users\fives\source\repos\fleet-repo-sync-wt\WT-0cdb-FLT-322, branch wt/WT-0cdb/FLT-322. Edit sync-push.ps1, add tests/sync-push-shadow.Tests.ps1, write docs/flt-322-sync-push-report.md. Do not push.

Change sync-push.ps1

Before the git push at line 39, when -NoPush is not set, run the gate best effort:

  1. New param [string]$ForgeSmokePath, default $HOME\.forge\smoke\bin\forge-smoke.exe. New switch -SkipPeers, which skips the peer schtasks loop. It exists so tests can never trigger real machines.
  2. Test-Path the binary. Absent: log Skipped, reason absent, go straight to the push.
  3. Run verify --repo <path> --commit <HEAD sha> --base <base> with a 5 second limit, then, for the same commit, publish --repo <path> --commit <sha> --remote <origin url> with a 15 second limit. <base> is origin/HEAD if it resolves, otherwise origin/<branch>. If neither resolves, use forty zeros, which the gate reads as the full tree.
  4. Start each with Start-Process -WindowStyle Hidden -PassThru, redirecting stdout and stderr to temp files, never pipes, so a grandchild holding a pipe cannot hang the push. Bound the wait with WaitForExit(ms). On timeout, kill by the PID this script started, with taskkill /T /F /PID, hidden. This script runs under Windows PowerShell 5.1, where Process.Kill($true) does not exist. It must also run under pwsh.
  5. Wrap everything in one try/catch. Any throw logs Skipped with the reason, and the push proceeds. Restore the current directory. Do not leave $LASTEXITCODE from the gate visible to the push line, and do not touch $ErrorActionPreference.
  6. Append one JSON line per run to $HOME\.forge\smoke\sync-push-shadow.jsonl: UTC time, repo, branch, sha, gate result (Pass, Block, CannotRun, or Skipped with a reason), wouldBlock, reason codes, and wall milliseconds for each call. A failure writing this line is itself swallowed. FORGE_SMOKE_HOME relocates this file if set. Never write Pass for anything the gate did not report as a pass.
  7. Print one line, such as forge-smoke (shadow): Block wouldBlock=true Missing, 412 ms. Never make it look like a push failure.
  8. The gate's exit code never affects this script's. Shadow means exit 0 from the gate anyway, but treat any exit the same.

Keep the existing output lines unchanged. Keep the edit small: one helper function plus one call.

Tests: tests/sync-push-shadow.Tests.ps1

Follow tests/fleet-repo-sync.Tests.ps1: real bare origin, real clone, the script run as a child process under $env:FRS_TEST_HOST. Always pass -SkipPeers -SkipMacs. No test may reach a real machine or the real ~/.forge: set FORGE_SMOKE_HOME. Stand-in gates are small .cmd scripts in $TestDrive, passed through -ForgeSmokePath.

Each case asserts that the origin branch moved to the new commit, as well as the log line:

  • Absent binary: pushes, logs Skipped absent.
  • Gate exits 1 with garbage output: pushes, logs Skipped with a parse reason, not Pass.
  • Gate hangs: a script that sleeps 120 seconds. Pushes, logs Skipped timeout, whole run bounded under 40 seconds, and the stand-in process is gone afterward.
  • Gate holds stdout with a detached grandchild: pushes, bounded the same way.
  • Gate reports Block: pushes, logs Block, wouldBlock true.
  • Gate reports Pass: pushes, logs Pass.
  • Log directory not writable: pushes.
  • -NoPush: the gate does not run.

Check

powershell -NoProfile -Command "$env:FRS_TEST_HOST='powershell'; Invoke-Pester tests/sync-push-shadow.Tests.ps1 -Output Detailed"

Run it under pwsh as well if your sandbox allows. Keep every window hidden. If your sandbox refuses a call, state exactly which one and stop on that case. Do not substitute an edited test or a private runner and call the result a pass. The orchestrator re-runs everything in a normal shell.

Report

docs/flt-322-sync-push-report.md: real output, anything that does not pass, and any way this could still stop or delay a push beyond the 20 second bound. Commit by exact path. Message starts FLT-322: and ends with Co-Authored-By: Susie Franny (Muse) <noreply@meta.com>.