Skip to content

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/tee nor /bin/chown .../upgrade-events.jsonl are in the sudoers allowlist — both calls failed silently, || true swallowed the error, and the file was NEVER truncated. Events accumulated across runs until the EVENTS_MAX=50 cap fired, then every subsequent emit_event became 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

🟢 High (Rule 12.4): real prod .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_dispatch after merge)
  • E1uEventsTruncate_TwoSequentialUpgrades_PhaseATruncatesBetween passes within ~15s
  • No regression on existing 17 Linux E2E tests

🤖 Generated with Claude Code

Merge request reports

Loading