Skip to content

chore(flake-autopilot): sync the scripts and tests with loft-enterprise main after #9810 and #9848 - #429

Merged
anvesh-loft merged 5 commits into
mainfrom
engqa-2159/sync-after-9810
Dec 4, 2026
Merged

anvesh-loft merged 5 commits into
mainfrom
engqa-2159/sync-after-9810

Conversation

@anvesh-loft

@anvesh-loft anvesh-loft commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

One more sync of the flake autopilot scripts and tests from loft-enterprise main, now that loft-enterprise #9810, #9848 and #9893 have merged. #9848 lets Slack start the bot from a release report and #9893 makes a release report one short line per feature; slack_thread.py and its test come along, with the workflow-input assertions in the reusable form. That PR brings its own version of the ticket-mode guard: a merged PR counts as a ticket's fix when it closes the ticket, or when it names the spec and changes code. The patch this copy carried since #428 goes away and the guard comes from the synced code, byte for byte.

Two fixes from the review of this PR, on top of the synced code:

  • GitHub hides an HTML comment after visible text, done <!-- Fixes ENGQA-1 -->, so the PR-body parser takes it out too. A CI-only PR whose closing line sits in such a comment no longer counts as the ticket's fix. The closing-line rule for visible text stays as it is.
  • A release run with no alert posts its report as its own message and the run's link as a reply. When that reply fails, a re-run of the step posts only the link under the report it recognises as its own instead of a second full report. The report carries the URL of its autopilot run as Slack metadata, which no reader sees and the text does not link, so a run queued for the same nightly finds another URL there and posts its whole report.

The patches the copy carries on top of loft-enterprise main stay: the token-leak bats case that can fail, the test that both workflows mount the input only, and the two fixes above. loft-enterprise keeps its own copy until #9890 switches the callers to this tag.

How it was checked

  • 573 pytest cases and 25 bats cases pass. The three new cases fail against the scripts before the fixes, the queued-run case against the first version of the fix.
  • The synced ticket mode keeps the ENGQA-1354 case: a CI-only PR that quotes a spec is no fix.

Part of ENGQA-2159

🤖 Generated with Claude Code

…se main after #9810

The ticket-mode guard now comes from the synced code, so the copy of it carried
since #428 goes away. The leak-test and mount-only patches stay.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@anvesh-loft
anvesh-loft requested a review from a team as a code owner December 3, 2026 18:24
@anvesh-loft
anvesh-loft requested a review from Piotr1215 December 3, 2026 18:24
@anvesh-loft

Copy link
Copy Markdown
Contributor Author

/vcluster-review

@vcluster-pr-approver

Copy link
Copy Markdown

🔍 The agent swarm is reviewing PR #429. I'll post the results here when it's done.

Admins can watch the run live

@loft-bot loft-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review run: first, head 0792531
Panel review: 0 blocking (QA: 0 need a test, 1 weak test, 0 no test, 0 product gap), 5 quality notes, 12 lanes. The weak-test count is a downgraded coverage gap held for a QA reviewer, not a merge blocker.

Checked: correctness, security, test-quality, operability, reuse, architecture, dead code, typos, QA coverage, QA product gaps, PR metadata, tech debt; 4 QA claims audited one by one. Skipped: e2e family and entry-point fidelity (no e2e files, no customer bug), infra (no workflow, Terraform, Helm or Dockerfile change), docs follow-up (internal CI tooling), layout (not a restructure). The four changed scripts match loft-enterprise main (4b35e83, #9810) byte for byte; 573 unit tests pass.

Needs a human

  • Should a merged PR that changes only CI files but says "Fixes ENGQA-N" count as the ticket's fix? At this head it does: ticket_group.py:147 checks for a code change only on a spec-name match, while base checked both, and the tests assert the new behaviour on purpose. The PR body says a merged PR counts as a fix only when it changes code.

A QA reviewer decides these; they do not block on their own.

PR-level notes

  • consider — Could we add acceptance criteria to ENGQA-2159 and re-run the review? Its "Done when" items are live rollout checks, so the panel could not tell which scenario in this diff needs a test.

Quality notes (non-blocking)

  • .github/actions/flake-autopilot/scripts/ticket_group.py:202 — consider — Non blocking test coverage gap: Could we also add multi-spec ticket cases where an open PR names a quiet spec only in a quote, a ~~~ fence or a fixer PR's Verification section (plus one with > Fixes ENGQA-1), asserting the verdict stays quiet? Reverting this line to the base matching leaves all 573 tests green; only the one-spec path has these cases. This becomes blocking if a quoted or fenced mention must never cancel the quiet replay on multi-spec tickets.
  • .github/actions/flake-autopilot/scripts/select_groups.py:186 — consider — Non blocking test coverage gap: Could we also add a select() case and an in-flight verdict_of case where only the open PR's title names the spec? Reading the title is new here, and dropping it from pr_names_spec leaves every test result unchanged.
  • .github/actions/flake-autopilot/scripts/ticket_group.py:89 — consider — Non blocking test coverage gap: Could we also add a merged and an open PR titled fix: alpha (fixes ENGQA-1) whose body does not close the ticket, asserting it counts? Every test keeps the closing line in the body, so dropping the title from pr_closes_ticket still passes.
  • .github/actions/flake-autopilot/scripts/select_groups.py:15 — consider — Could we have verify_fix.py, linear_ticket.py and agent_result.py import BOT_LOGIN/BOT_BRANCH_PREFIX straight from select_groups and drop the copy at verify_fix.py:22? Two "flake-fixer/" definitions can now drift, and linear_ticket.py only works through agent_result's re-import (fix upstream first).
  • .github/actions/flake-autopilot/scripts/select_groups.py:108 — consider — Could we split own_words into named steps (fence, list item, quote continuation) with a comment per state flag, perhaps in its own module, or read GitHub's rendered body_html instead? This 58-line loop now decides in-flight and merged-fix verdicts, and its docstring says raw <pre>/<blockquote> still counts as the PR's own words (fix upstream first).

Reviewer routing

  • Code-owner approval comes from @loft-sh/eng-merge-devops (CODEOWNERS *); Piotr1215 is already requested, so please confirm he can give it.
  • Tech debt: these scripts live in two repos and every fix lands upstream, then re-syncs. Could the ENGQA-2159 owner record which repo is the source of truth and whether the two carried local patches move upstream? Change history was unavailable in this run.
  • Docs: no follow-up needed (internal CI tooling).

@vcluster-pr-approver

Copy link
Copy Markdown

@anvesh-loft ✅ Review finished for #429

View the session

@anvesh-loft

Copy link
Copy Markdown
Contributor Author

Good one on the closes-ticket case: that is #9810's rule as merged in loft-enterprise, a PR that closes the ticket counts without a file check, and its tests assert it on purpose. The scripts here are that code byte for byte, so this PR keeps it; the body now says the rule as it is. Whether a CI-only PR that says Fixes ENGQA-N should still need a code change is a loft-enterprise question, raised with the #9810 author. The multi-spec quote and fence cases go with it, since the tests are synced from there.

Slack can start the bot from a release report there since #9848 merged today.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@anvesh-loft anvesh-loft changed the title chore(flake-autopilot): sync the scripts and tests with loft-enterprise main after #9810 chore(flake-autopilot): sync the scripts and tests with loft-enterprise main after #9810 and #9848 Dec 3, 2026
@anvesh-loft

Copy link
Copy Markdown
Contributor Author

Added loft-enterprise #9848 (merged 18:37Z today) to this sync: slack_thread.py and its test. The panel flagged on #9890 that the thin callers would otherwise drop it. 4d42dea.

@Piotr1215 Piotr1215 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include the latest Slack report change and its tests in this sync. It merged after this revision. Switching the caller now would restore the long per-spec release reports. Keep the shared workflow assertions when bringing over the tests. loft-enterprise#9893 Caller PR

573 pytest cases and 25 Bats cases passed locally.

f = near and FENCE.match(rest)
f = f if f and not (f.group(1)[0] == "`" and "`" in f.group(2)) else None
quote, rule, heading = near and rest.startswith(">"), near and BREAK.match(rest), near and HEADING.match(rest)
note = near and rest.startswith("<!--")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment after visible text survives this filter. In a local ticket run, a CI-only PR whose description named the spec and contained the closing phrase only in an inline HTML comment changed the verdict from active on base to fixed here. The Linear answer then chose Ready for Release. Please strip inline HTML comments in the source parser and add a ticket-verdict regression case. The visible closing-line rule can stay as designed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. own_words now takes out a comment after visible text too, however many lines of its paragraph it runs on, so Adds the step. <!-- Fixes ENGQA-1 --> is no closing line. A comment that never closes in its paragraph stays text, as GitHub shows it, and the closing-line rule for visible text is unchanged. Cases: three hidden and two shown bodies in the closing-line test, a ticket-verdict case where a CI-only PR names the spec and closes the ticket only inside a comment and the verdict stays active, and two grouping cases. All of them fail against the script before the change. d8e2534.

else:
posted = slack(token, "chat.postMessage", {"channel": channel, "text": text}, send)
if split and posted.get("ts"):
slack(token, "chat.postMessage", {"channel": channel, "thread_ts": posted["ts"], "text": follow}, send)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the retry after this reply fails send only the missing link? I simulated Slack accepting the parent and rejecting this reply. The same run then finds the parent without a dedup marker and posts a second full report. Please cover the partial-post case when updating this path.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. A re-run now posts only the link when the thread's first message is this run's own report: the nightly's report or stop note, posted after this autopilot run started (own_root, from the message's ts and the run's created_at), and no reply carries the run's link yet. A later run of the same nightly started after that message, so it still posts its whole report, and once the link is there a further re-run posts nothing. The new test walks the failed reply, the re-run, the further re-run, the later run and the stop note. d8e2534.

anvesh-loft and others added 2 commits December 4, 2026 11:05
Brings over the one-line-per-feature release report and its tests. Scripts and tests are the loft-enterprise main copies again, with this action's path and workflow-input adaptations.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…-run adds only its missing link

GitHub hides `<!-- Fixes ENGQA-1 -->` after visible text, so the PR-body parser takes such a comment out too, however many lines of its paragraph it runs on. A CI-only PR whose closing line sits in one no longer counts as the ticket's fix, with a ticket-verdict case and two grouping cases for it.

A release run with no alert posts its report as its own message and the run's link as a reply. When that reply fails, a re-run of the step posts only the link under the report it recognises as its own, the nightly's report posted after this run started, instead of a second full report. A later run of the same nightly still posts its whole report.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@anvesh-loft

Copy link
Copy Markdown
Contributor Author

Agreed, #9893 is in: slack_thread.py and its test are the loft-enterprise main copies again, with the path and workflow-input adaptations of this action (3aa9b2a). The two findings above are fixed on top in d8e2534, carried as patches over the synced code; loft-enterprise keeps its own copy until #9890 switches the callers to this tag. 573 pytest and 25 bats pass.

@anvesh-loft
anvesh-loft requested a review from Piotr1215 December 4, 2026 15:14

@Piotr1215 Piotr1215 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compact release report and shared workflow assertions are in. The HTML comment and same-run retry cases pass. One regression remains in the retry path. A queued release run can lose its own report. 573 pytest cases and 25 Bats cases passed locally.

…n in slack metadata

A run queued for the same nightly can start before the first run posts its report, so the time of the message does not say whose it is. The report now carries the URL of its autopilot run as Slack metadata, which no reader sees and the text does not link, and a re-run posts only the missing link when that URL is its own. The queued run finds another URL and posts its whole report, and a report without metadata is nobody's.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@anvesh-loft
anvesh-loft requested a review from Piotr1215 December 4, 2026 16:07

@Piotr1215 Piotr1215 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The queued-run case is fixed. The report now names its autopilot run in Slack metadata, so a queued run posts its whole report and a re-run adds only its own missing link. The new case fails when own_root stops comparing the run URL. 573 pytest cases and 25 Bats cases passed locally.

@anvesh-loft
anvesh-loft merged commit 5fef9ac into main Dec 4, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants