Repository navigation
Run the bats suite on main pushes (coverage parity with unit) — re-scoped after #1485 correction #1486
Description
Story
As a maintainer relying on main as the source of truth for agent scripts,
I want the bats suite to run on pushes to main with the same coverage it has on PRs,
so that trunk-state regressions in shell-script behavior are surfaced by every merge, matching the parity unit already has.
Problem (re-scoped 2026-08-08 — see the correction comment on #1485)
Original framing claimed both corrupting merges in #1485 landed with "zero post-merge signal." That was wrong: test-dev-lead.yml (unit) does run on main pushes (paths-filtered) and ran green on both corrupting merges — the signal existed but was blind to duplicate-definition corruption (bash last-definition-wins). The structural guard for that failure mode is #1482, not more test runs.
What remains true and worth fixing: the bats job lives in lint.yml, which triggers on pull_request and workflow_dispatch only. ci.yml (push+PR) covers lint/security but not bats. So shell-script behavioral coverage from the bats suites exists on PRs but never re-runs against actual trunk state after a squash merge — a gap unit does not have.
Acceptance Criteria
- The
batsjob (or an equivalent job reusingscripts/run-bats.sh) runs onpush: branches: [main], paths-filtered like its PR trigger (scripts/**,tests/**,.github/workflows/**). - No change to PR-triggered behavior; no new required checks on PRs.
- A failing main-push run is visible to the Fleet Monitor (confirm main-branch failures for
lint.ymlappear in its reports, as petry-projects — workflow failures detected 2026-08-08 #1484 suggests they do; otherwise add an on-failure issue-open step). template-driftremains excluded from any main-push wiring until [bug] seed-repo-template fetches standards unpinned — pin to published stable, compliance accepts N-1 (continues #1436) #1448 is resolved.
Tasks
- Add the paths-filtered
push: branches: [main]trigger tolint.yml(or split the bats job into its own workflow if lint-on-main-push is undesirable — keep the diff minimal either way). - Verify one green main-push run after merge.
Dev Notes
- Keep the diff to trigger blocks only — no script or job restructuring ([Phase 4] Name and guard the "agent optimizes the check, not the intent" failure mode #1468).
- Land after fix: restore trunk scripts to single-definition state — surgical dedup of engine.sh + 3 more (#1485) #1487 (merged 2026-08-08) — done; trunk is restored, so the first main-push run should start green.
- This story is deliberately narrow. It does NOT claim to guard against [Incident] Trunk corruption: main's scripts carry 3–6x duplicated function definitions (merged via #1420, #1292) — surgical restoration required #1485-style corruption — that is [Phase 4] Post-conflict-resolution integrity check — catch duplicated/corrupted content before it's trusted #1482's mechanical detector. This is test-coverage parity between PR and trunk, nothing more.
References
- Epic: Formalize the agentic PR-interaction model (event-first, timers-as-backstop) — clear, repeatable, enforceable #1402
- Motivating incident: [Incident] Trunk corruption: main's scripts carry 3–6x duplicated function definitions (merged via #1420, #1292) — surgical restoration required #1485 (and its correction comment re-scoping this story)
- Structural guard (separate): [Phase 4] Post-conflict-resolution integrity check — catch duplicated/corrupted content before it's trusted #1482
- Known-red exclusion: [bug] seed-repo-template fetches standards unpinned — pin to published stable, compliance accepts N-1 (continues #1436) #1448
Activity
[-]Run unit/bats suites on main pushes — trunk merged corrupted twice with zero post-merge signal[/-][+]Run the bats suite on main pushes (coverage parity with unit) — re-scoped after #1485 correction[/+]don-petry commentedon Aug 18, 2026
Dev-Lead: issue #1486 implementation failed — will retry
The engine failed (
engine-error— e.g. a timeout or transient engine error). This was attempt 1 of 3; dev-lead will retry automatically. You can also re-apply thedev-leadlabel to retry now.engine-errorLast 40 lines of engine output (redacted)
don-petry commentedon Aug 18, 2026
Dev-Lead Implementation Plan
Issue: #1486 — Run the bats suite on main pushes (coverage parity with unit) — re-scoped after #1485 correction
Scope
Add a paths-filtered
push: branches: [main]trigger tolint.ymlso thebatsjob re-runs against trunk state after every merge, and exclude the known-redtemplate-driftjob from main-push runs (#1448) — no change to PR-triggered behavior.Implementation Checklist
push: branches: [main]with pathsscripts/**,tests/**,.github/workflows/**to theon:block of.github/workflows/lint.yml(AC1)if: github.event_name != 'push'to thetemplate-driftjob so it stays excluded from main-push wiring until [bug] seed-repo-template fetches standards unpinned — pin to published stable, compliance accepts N-1 (continues #1436) #1448 is resolved (AC4)pull_request+workflow_dispatchtriggers untouched — no new required PR checks (AC2)lint.yml's bats listTests to Write
tests/test_lint_main_push_trigger.bats— assert lint.yml haspush: branches:[main]with the three paths, that thepull_requesttrigger is unchanged, and thattemplate-driftcarries theevent_name != 'push'guardTest Command
scripts/run-bats.sh tests/test_lint_main_push_trigger.bats(full suite: thebatsjob's file list inlint.yml)AC3 note
Fleet Monitor already tracks lint.yml failures across all events/branches (
fleet_monitor.shqueriesactions/workflows/<id>/runswith no event filter, andlint.ymlis not inFLEET_GATE_WORKFLOWS), so a failing main-push run surfaces in its reports with no extra wiring — matching #1484. No on-failure issue-open step needed.don-petry commentedon Aug 18, 2026
Dev-Lead: Implementation Complete
Plan Execution
push: branches: [main]trigger to.github/workflows/lint.ymlon:block, scoped toscripts/**,tests/**,.github/workflows/**(AC1)if: github.event_name != 'push'to thetemplate-driftjob so it stays excluded from main-push wiring until [bug] seed-repo-template fetches standards unpinned — pin to published stable, compliance accepts N-1 (continues #1436) #1448 is resolved (AC4)pull_request+workflow_dispatchtriggers and PR paths untouched — no new required PR checks (AC2)tests/test_lint_main_push_trigger.batsguard and registered it in thebatsjob's file listTest Results
Repo lint (
.dev-lead/scripts/dev-lead-lint.sh):all checks passed(shellcheck on 110 files + agent-profile/CODEOWNERS validation).scripts/validate-workflow-schedules.sh: OK — no minute-0 crons introduced.yamllint(ci.yml config) on lint.yml: passes (the sole comment-indentation warning at the caller-stub-freeze block pre-exists onmainand is untouched).Files Changed
.github/workflows/lint.yml: added the main-push trigger block, added theevent_name != 'push'guard totemplate-drift, and registered the new bats file. Trigger/job-guard changes only — no script or job restructuring ([Phase 4] Name and guard the "agent optimizes the check, not the intent" failure mode #1468).tests/test_lint_main_push_trigger.bats(new): pins the wiring so a future template sync cannot silently drop the main-push trigger (AC1), alter PR-trigger behavior (AC2), or wiretemplate-driftinto the push path before [bug] seed-repo-template fetches standards unpinned — pin to published stable, compliance accepts N-1 (continues #1436) #1448 is resolved (AC4).Notes
scripts/fleet_monitor.shqueriesrepos/<repo>/actions/workflows/<id>/runswith no event/branch filter, so a failinglint.ymlrun on amainpush is counted like any other failure;lint.ymlis not inFLEET_GATE_WORKFLOWS, so a genuine failure surfaces in the report / high-failure tracking. This matches what petry-projects — workflow failures detected 2026-08-08 #1484 suggested, so no on-failure issue-open step was added.lint.yml'son:runs every non-excluded lint job on main pushes (bats included). AC4's explicittemplate-driftcarve-out confirms this whole-workflow approach was the intended path; only the known-redtemplate-drift([bug] seed-repo-template fetches standards unpinned — pin to published stable, compliance accepts N-1 (continues #1436) #1448) is excluded.feat: implement issue #1486 — Run the bats suite on main pushes (cove…