feat(LinuxTentacleE2E): Phase 12.L.E.17 — events.jsonl Phase-A-truncate regression pin
Summary
Real production-regression target. The .sh's docstring at lines 186-192 documents a prior bug where:
The old code used
sudo tee+sudo chown, but neither/usr/bin/teenor/bin/chown .../upgrade-events.jsonlare in the sudoers allowlist — both calls failed silently,|| trueswallowed the error, and the file was NEVER truncated. Events accumulated across runs until theEVENTS_MAX=50cap fired, then every subsequentemit_eventbecame a no-op. Observationally: after N upgrades the UI event timeline froze mid-upgrade at whatever event pushed the count past 50.
Without this pin, the exact same regression can ship again. Someone "tidies up" by reintroducing sudo to the truncate, or changes EVENTS_MAX semantics, or drops the : > "$EVENTS_FILE" line entirely on line 195.
Test mechanism
Run E1.h-style upgrade TWICE (re-dispatch). After the second run, count events with kind=="start":
- Phase A's truncate means each run produces exactly one
"start"event in a fresh-truncated file - After run-2: count must be 1 (run-2's start), NOT 2 (run-1 accumulated + run-2 appended)
Why same target version (re-dispatch) vs two different versions
- Same-version is simpler infrastructure (one mirror tarball, no v3 build path)
- Count-of-start signal is version-agnostic — works regardless
- Second run runs Phase A+B fully (no already-up-to-date short-circuit on Linux currently), giving us two genuine truncate-then-emit cycles to test against
Assertions
- Run-1 alone produces exactly 1
"start"event (sanity baseline) - After run-2: exactly 1
"start"event total (truncate fired) - After run-2: total events ≈ run-1 total (NOT 2×; tolerance +5 for timing variability in healthz retry counts)
- Run-2's last event is
"success"(proves run-2 completed; otherwise we'd be comparing partial vs full event counts)
Fidelity tier
.sh + real systemd + real bash + real append-only file with real truncate at start of each Phase A.
Expected runtime: ~10s (2× E1.h ≈ 2×~5s).
Test plan
-
Linux E2E workflow runs (manual workflow_dispatchafter merge) -
E1uEventsTruncate_TwoSequentialUpgrades_PhaseATruncatesBetweenpasses within ~15s -
No regression on existing 17 Linux E2E tests