Skip to content

Keep release-readiness trackers fresh: 3h cadence, freshness banner, scoped event triggers - #36409

Merged
PureWeen merged 5 commits into
mainfrom
pureween-rr-freshness-triggers
Jul 7, 2026
Merged

PureWeen merged 5 commits into
mainfrom
pureween-rr-freshness-triggers

Conversation

@PureWeen

@PureWeen PureWeen commented Jul 6, 2026

Copy link
Copy Markdown
Member

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Why

The [Release Readiness] tracker issues (SR9 #35867, preview7 #36138, preview6 #35866) were refreshed once per weekday morning, so they drifted stale as the day progressed. This keeps them fresher without spamming watchers, and surfaces staleness explicitly when a body is frozen by the idempotent no-op.

What

1. Cadence + freshness banner (release-readiness.yml, NightlyFeed.ps1, both engines)

  • Schedule 30 8 * * 1-5 → 30 8-20/3 * * * (every 3h, 08:30–20:30 UTC, all 7 days).
  • New pure helper Format-ReportFreshnessBanner -GeneratedAt -Now [-StaleHours 4] renders 🕐 Report generated N ago and appends ⏳ …data may be stale (older than 4h) past threshold. Fail-open on null/unparseable; clamps clock skew. Wired into both the SR and preview reports. Derived at render time from the generation timestamp and deliberately excluded from Get-ReportSemanticHash so it never churns the idempotent no-op.

2. Same-tracker writer serialization (release-readiness.yml)

  • Added a JOB-level concurrency: group: release-readiness-tracker-${{ matrix.canonicalKey }} (cancel-in-progress: false) on per-tracker-report. Same-tracker writers now serialize across ALL event kinds — the old top-level group keyed on event_name let two different-event runs race the same gh issue edit and clobber Release Captain Notes. Different trackers still run in parallel.
  • Top-level cancel-in-progress → ${{ github.event_name == 'pull_request' }} (only PR validation cancels; writer runs are never cancelled mid-edit). The existing re-read-live-body-before-edit + malformed-marker skip guards are preserved as defense-in-depth.

3. Scoped base-repo event triggers (release-readiness.yml)

  • Added issues (labeled, closed), milestone (created, closed), and push (main, net11.0, release/**). No pull_request_target.
  • Detect step maps each event to a scope filter (reusing existing BRANCH_FILTER plumbing + new MAJOR_FILTER): push→pushed branch, issues→majors from regressed-in-<major>* labels, milestone→major in title, dispatch/schedule unchanged. Untrusted text (label names, milestone/issue titles) flows ONLY via env: and is parsed with jq/grep — never interpolated into a run: block. Org gate github.repository == 'dotnet/maui' prevents fork activation. issues: write stays on the writer job only.

Tests

  • New hash-stability test: renders the report twice with different fetchedAt, asserts the banner text differs but the release-readiness-hash marker is identical (proves the banner is not hashed).
  • 12 new Format-ReportFreshnessBanner unit tests (fresh/stale/singular/plural/ISO-string/null/unparseable/clock-skew/custom-threshold).
  • Full suite green (838/0 in a networked env).

Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com

Copilot AI added 3 commits July 6, 2026 08:27
Step 1 of 3 (freshness): keep the tracker issues fresher throughout the day
without spamming watchers.

- Cadence: change the schedule cron from weekdays-only `30 8 * * 1-5` to
  `30 8-20/3 * * *` (every 3h, 08:30-20:30 UTC, all 7 days). A material change
  (CI flip, new source PR, milestone gate) is now surfaced within ~3h instead
  of a day. This is spam-safe: the SR engine's semantic-hash no-op skips
  `gh issue edit` when nothing material changed, and issue-BODY edits are
  notification-silent regardless.

- Freshness banner: add a pure, deterministic `Format-ReportFreshnessBanner`
  helper (NightlyFeed.ps1) rendered just below the `**Generated**:` line in both
  engines. It shows how long ago the report was generated (🕐) and flags
  `⏳ data may be stale` past a 4h threshold. It is DERIVED-AT-RENDER from the
  generation timestamp and is DELIBERATELY excluded from Get-ReportSemanticHash
  (folding a render-time age into the hash would differ every run and break the
  idempotent no-op). Caller passes -Now, so the helper is fully unit-testable.

Note: generation ~= render, so in production the age is ~0 and the ⏳ note is a
safety valve; the absolute `**Generated**:` timestamp remains the durable
staleness signal for a body frozen by the no-op.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…in Notes

Two release-readiness runs writing the same tracker issue concurrently could
interleave the read-modify-write that splices human-authored Release Captain
Notes back into the freshly generated report, silently clobbering those notes.
Today the only concurrency group is keyed on github.event_name, so runs of
different event kinds (e.g. a scheduled run and a future event-triggered run)
land in different groups and do not serialize.

- Add a per-job concurrency group on per-tracker-report keyed on
  matrix.canonicalKey with cancel-in-progress: false, so same-tracker writers
  run one-at-a-time across every event kind while different trackers stay
  parallel. Serialize-don't-cancel guarantees an in-flight gh issue edit
  completes instead of being killed mid-splice.
- Re-key the run-level cancel-in-progress to only cancel pull_request runs
  (a new push supersedes stale validation); schedule/dispatch runs are never
  cancelled mid-flight.
- Document that the existing re-read-live-body-before-edit logic is now
  defense-in-depth behind the per-tracker group (primary guard); the guards
  that skip the edit on missing/malformed note markers are preserved, not
  weakened.
- Add a report hash-STABILITY test (render twice with different fetchedAt →
  identical sha= marker) guarding the idempotent no-op against volatile-field
  regressions including the Step 1 freshness banner, plus pure-renderer unit
  tests for Format-ReportFreshnessBanner (fresh/stale/singular/plural/ISO/
  null/clock-skew).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The 3-hourly schedule fans out to every tracker; a material signal that lands
between runs (a regression label, a milestone gate flip, a push that advances
HEAD) waits up to ~3h to surface. Add scoped base-repo event triggers that
recompute ONLY the affected tracker(s), reusing the existing single-tracker
BRANCH_FILTER plumbing.

- on: add issues (labeled, closed), milestone (created, closed), and push
  (branches: main, net11.0, release/**). Deliberately NOT pull_request_target
  (fork secret-exfil vector) — these are base-repo events, so no fork code is
  ever checked out or executed.
- Detect step maps the triggering event to a scope filter: push -> the pushed
  branch (matches a tracker's branchName/surveyRef); issues -> the union of
  .NET majors named by the issue's regressed-in-<major>* labels; milestone ->
  the major in its title; workflow_dispatch -> inputs.branch (unchanged);
  schedule -> full refresh. Extend the matrix jq select with an optional
  MAJOR_FILTER (comma-list vs .majorVersion). A filter that matches no tracker
  yields an empty matrix and the pipeline short-circuits.
- SECURITY: every attacker-influencable field (label names, milestone/issue
  title) is passed via env: and parsed with jq/grep — never interpolated into a
  run: block via ${{ }} — and MAJOR_FILTER is reduced to digits, so untrusted
  text can never reach the shell as code.
- Restrict the pipeline to github.repository == 'dotnet/maui' (mirrors the org
  gate in rebase.yml) so the new triggers can't act on a fork.
- Widen the writer-step gate so push/issues/milestone actually write; keep
  issues: write scoped to the writer job only (detect stays contents: read).
- Document why run-level cancel-in-progress stays false for writer events:
  cancelling the run would kill a per-tracker job mid-`gh issue edit`;
  GitHub's pending-run collapse bounds the request budget without that risk.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 6, 2026 14:14
@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 6, 2026 14:14 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36409

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36409"

@github-actions

github-actions Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Skill Validation Results

@PureWeen — new skill validation results are available based on this last commit: e0f7260.
To request a fresh validation after new comments or commits, comment /evaluate-skills.

Overall Passed Static Passed LLM Skipped Skills 20 Agents 6

✅ Skill Validation Results — e0f7260 · Keep release-readiness trackers fresh: 3h cadence, freshness banner, scoped event triggers · 2026-07-07T04:24:14Z

✅ Static Checks Passed

Skills: 20 | Eval specs linted: 7

Full lint output
── .github/skills/agentic-labeler/tests/eval.vally.yaml
npm warn deprecated prebuild-install@7.1.3: No longer maintained. Please contact the author of the relevant native addon; alternatives are available.
✔ .github/skills/agentic-labeler/tests/eval.vally.yaml is valid
── .github/skills/code-review/tests/eval.capability.vally.yaml
✔ .github/skills/code-review/tests/eval.capability.vally.yaml is valid
── .github/skills/code-review/tests/eval.vally.yaml
✔ .github/skills/code-review/tests/eval.vally.yaml is valid
── .github/skills/code-review/tests/hermeticity.vally.yaml
✔ .github/skills/code-review/tests/hermeticity.vally.yaml is valid
── .github/skills/evaluate-pr-tests/tests/eval.vally.yaml
✔ .github/skills/evaluate-pr-tests/tests/eval.vally.yaml is valid
── .github/skills/try-fix/tests/eval.vally.yaml
✔ .github/skills/try-fix/tests/eval.vally.yaml is valid
── .github/skills/verify-tests-fail-without-fix/tests/eval.vally.yaml
✔ .github/skills/verify-tests-fail-without-fix/tests/eval.vally.yaml is valid

⏭️ LLM Evaluation: Skipped

No changed skills with eval specs found.

🔍 Full results and investigation steps

@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 6, 2026 14:15 — with GitHub Actions Inactive
@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 6, 2026 14:17 — with GitHub Actions Inactive
@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 6, 2026 14:18 — with GitHub Actions Inactive
@github-actions github-actions Bot added the area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions label Jul 6, 2026
@PureWeen
PureWeen temporarily deployed to copilot-pat-pool July 6, 2026 14:18 — with GitHub Actions Inactive

Copilot AI 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.

Pull request overview

This PR updates the release-readiness automation to keep [Release Readiness] tracker issues fresher throughout the day by increasing the run cadence, adding scoped event triggers, and surfacing report staleness with a render-time freshness banner.

Changes:

  • Increased workflow cadence to every 3 hours (08:30–20:30 UTC, daily) and added scoped triggers (issues/milestone/push) to refresh only affected trackers.
  • Added a pure Format-ReportFreshnessBanner renderer and wired it into both SR and preview markdown outputs.
  • Added/expanded tests to validate banner behavior and semantic-hash stability.
Show a summary per file
File Description
.github/workflows/release-readiness.yml Adjusts schedule cadence, adds scoped event triggers, and introduces per-tracker concurrency to avoid same-tracker edit races.
.github/skills/release-readiness/tests/Test-ReleaseReadiness.ps1 Adds hash-stability coverage and unit tests for the new freshness banner renderer.
.github/skills/release-readiness/scripts/NightlyFeed.ps1 Introduces Format-ReportFreshnessBanner as a deterministic, testable renderer.
.github/skills/release-readiness/scripts/Get-ReleaseReadiness.ps1 Appends the new freshness banner beneath the SR report’s **Generated** line (render-time only).
.github/skills/release-readiness/scripts/Get-PreviewReadiness.ps1 Appends the new freshness banner beneath the preview report’s generated-at line.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 3

Comment on lines 85 to +87
concurrency:
group: release-readiness-${{ github.event_name }}-${{ github.event.pull_request.number || inputs.branch || 'all' }}
cancel-in-progress: true
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
Comment on lines +2236 to +2243
$shaRenderOld = ([regex]::Match($mdRenderOld, 'release-readiness-hash: sha=([0-9a-f]{64})')).Groups[1].Value
$shaRenderNew = ([regex]::Match($mdRenderNew, 'release-readiness-hash: sha=([0-9a-f]{64})')).Groups[1].Value
$banRenderOld = (($mdRenderOld -split "`n") | Where-Object { $_ -match 'Report generated' }) -join ''
$banRenderNew = (($mdRenderNew -split "`n") | Where-Object { $_ -match 'Report generated' }) -join ''
Assert-Eq -Label "Freshness banner text differs when fetchedAt differs" -Expected $true `
-Actual ($banRenderOld -ne '' -and $banRenderNew -ne '' -and $banRenderOld -ne $banRenderNew)
Assert-Eq -Label "Semantic hash is STABLE despite freshness-banner/fetchedAt change (no-op intact)" `
-Expected $shaRenderOld -Actual $shaRenderNew
Comment on lines +472 to +476
if ($span.TotalHours -ge $StaleHours) {
$staleH = [int][Math]::Floor($StaleHours)
return "> ⏳ _Report generated **$agePhrase** — data may be stale (older than ${staleH}h). A fresh run is scheduled every few hours._"
}
return "> 🕐 _Report generated $agePhrase._"
Copilot AI added 2 commits July 6, 2026 23:23
…h push concurrency

Two workflow correctness fixes surfaced by a multi-model review of this PR:

1. Scoped-trigger fan-out gap (confirmed by 3 independent reviewers). The
   detect step treated "both filters empty" as "refresh ALL trackers", so a
   base-repo event that produced no scope — an issue closed/labeled without a
   `regressed-in-<major>` label, or a milestone with a non-versioned title —
   fanned out to every tracker instead of scoping down, contradicting this PR's
   "refresh ONLY the affected tracker" thesis on the most common issues event.
   Introduce an explicit FANOUT flag set to 1 ONLY for schedule and
   workflow_dispatch (the events that legitimately mean "all"); for scoped event
   triggers (push/issues/milestone) an empty filter now yields an EMPTY matrix →
   has-trackers=false → the report job is skipped, reusing the same proven
   short-circuit as a push to an untracked branch. Every legitimately-scoped
   refresh (push→branch, issues→major, milestone→version) and the intended
   schedule/dispatch fan-out are preserved; unknown future events default to
   FANOUT=0 (skip, not surprise fan-out).

2. Per-branch push concurrency. The run-level group folded all pushes into
   `release-readiness-push-all` (no branch in the key), so a burst of pushes to
   DIFFERENT tracked branches could drop a needed per-branch refresh when
   pending-run supersede cancels the older pending run. Fold github.ref_name into
   the key so pushes to distinct branches get distinct groups; non-push events
   resolve ref_name to the default branch, leaving their keys unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…t guard

Script/test robustness fixes from the same multi-model review:

1. Stale-note threshold text (NightlyFeed.ps1, Format-ReportFreshnessBanner).
   The "(older than Nh)" note used [int][Math]::Floor($StaleHours), which
   silently rendered a fractional threshold like 2.5 as "2h" — misstating the
   configured window. Render the actual value with InvariantCulture instead, so
   4 → "4", 2.5 → "2.5", never a locale comma-decimal. Whole-number defaults are
   unchanged.

2. Banner-vs-hash docstring honesty. Clarify in the function DESCRIPTION that on
   the hash-gated SR engine a frozen (no-op'd) body is never re-rendered, so the
   the render-time stale note cannot newly surface there — the absolute
   **Generated**: timestamp remains the durable staleness signal; the live path
   is genuinely the preview engine, which re-renders every run.

3. Hash-stability test guard (Test-ReleaseReadiness.ps1). The render-twice test
   asserted sha equality but would have PASSED vacuously if both extractions
   returned empty strings (regex miss). Add 64-hex-digit guards on both
   extracted shas before the equality assertion so a missing/blank marker fails
   loudly instead of silently green.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@kubaflo kubaflo 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.

Note

🔍 AI-generated review (automated multi-model orchestrator, on behalf of @kubaflo) — Opus 4.8 · GPT-5.5 · Gemini 3.1 Pro.

✅ APPROVED — 3h cadence + freshness banner + scoped triggers

Three coordinated changes, all sound:

1. Format-ReportFreshnessBanner (pure renderer) + wiring

A deterministic banner ("🕐 generated N ago", ⏳ past a threshold). The design carefully avoids the trap that would break the SR engine's idempotent no-op: a render-time age must never feed Get-ReportSemanticHash (else two runs on identical data → different hashes → churn every run). This is documented at every touch point and enforced by a test — Format-MarkdownReport is rendered twice with different metadata.fetchedAt, asserting the banner text differs while the sha= marker stays identical, with an anti-vacuous-pass guard requiring a genuine 64-hex digest on each render. Fail-open (skipped if the helper isn't loaded / timestamp unparseable). Unit tests cover fresh/moments/under-threshold/over-threshold/days/singular-plural and the injected far-past ⏳ path.

2. Cadence: weekdays-08:30 → every-3h 08:30–20:30 UTC

Material changes (CI flip, new source PR, milestone gate) now surface within ~3h. The watcher-spam concern is correctly mitigated — the SR semantic-hash no-op skips gh issue edit when nothing material changed, and issue-body edits are notification-silent regardless.

3. Scoped base-repo event triggers — security reviewed ✅

New issues (labeled/closed), milestone (created/closed), and push (main/net11.0/release/**) triggers, each mapped to a BRANCH_FILTER/MAJOR_FILTER so only the affected tracker recomputes. The injection surface is handled correctly:

  • Every attacker-influencable field (issue labels, milestone title) is passed via env: and parsed with jq/grep — none is interpolated into a run: block via ${{ }}.
  • pull_request_target is deliberately not used (fork secret-exfil vector), and the pipeline is org-gated (github.repository == 'dotnet/maui').
  • FANOUT gating: only schedule/workflow_dispatch fan out to all trackers on an empty filter; scoped events short-circuit to an empty matrix (no "recompute the world" on an unrelated close/label).
  • Concurrency: cancel-in-progress restricted to pull_request so a writer run is never killed mid-gh issue edit; github.ref_name folded into the key so bursts to different tracked branches don't collapse and drop a needed per-branch refresh.

CI green (Static validation, Validate (PR), Skill Validation all pass). Careful, well-tested, security-conscious. Verdict: Approve.

@PureWeen
PureWeen merged commit 462e72a into main Jul 7, 2026
17 of 18 checks passed
@PureWeen
PureWeen deleted the pureween-rr-freshness-triggers branch July 7, 2026 17:40
@github-actions github-actions Bot added this to the .NET 10 SR9 milestone Jul 7, 2026
SyedAbdulAzeemSF4852 pushed a commit to SyedAbdulAzeemSF4852/maui that referenced this pull request Jul 27, 2026
…scoped event triggers (dotnet#36409)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Why
The `[Release Readiness]` tracker issues (SR9 dotnet#35867, preview7 dotnet#36138,
preview6 dotnet#35866) were refreshed once per weekday morning, so they
drifted stale as the day progressed. This keeps them fresher without
spamming watchers, and surfaces staleness explicitly when a body is
frozen by the idempotent no-op.

## What
**1. Cadence + freshness banner** (`release-readiness.yml`,
`NightlyFeed.ps1`, both engines)
- Schedule `30 8 * * 1-5` → `30 8-20/3 * * *` (every 3h, 08:30–20:30
UTC, all 7 days).
- New pure helper `Format-ReportFreshnessBanner -GeneratedAt -Now
[-StaleHours 4]` renders `🕐 Report generated N ago` and appends `⏳ …data
may be stale (older than 4h)` past threshold. Fail-open on
null/unparseable; clamps clock skew. Wired into both the SR and preview
reports. **Derived at render time from the generation timestamp and
deliberately excluded from `Get-ReportSemanticHash`** so it never churns
the idempotent no-op.

**2. Same-tracker writer serialization** (`release-readiness.yml`)
- Added a JOB-level `concurrency: group: release-readiness-tracker-${{
matrix.canonicalKey }}` (`cancel-in-progress: false`) on
`per-tracker-report`. Same-tracker writers now serialize across ALL
event kinds — the old top-level group keyed on `event_name` let two
different-event runs race the same `gh issue edit` and clobber Release
Captain Notes. Different trackers still run in parallel.
- Top-level `cancel-in-progress` → `${{ github.event_name ==
'pull_request' }}` (only PR validation cancels; writer runs are never
cancelled mid-edit). The existing re-read-live-body-before-edit +
malformed-marker skip guards are preserved as defense-in-depth.

**3. Scoped base-repo event triggers** (`release-readiness.yml`)
- Added `issues` (labeled, closed), `milestone` (created, closed), and
`push` (main, net11.0, release/**). **No `pull_request_target`.**
- Detect step maps each event to a scope filter (reusing existing
BRANCH_FILTER plumbing + new MAJOR_FILTER): push→pushed branch,
issues→majors from `regressed-in-<major>*` labels, milestone→major in
title, dispatch/schedule unchanged. Untrusted text (label names,
milestone/issue titles) flows ONLY via `env:` and is parsed with jq/grep
— never interpolated into a `run:` block. Org gate `github.repository ==
'dotnet/maui'` prevents fork activation. `issues: write` stays on the
writer job only.

## Tests
- New hash-stability test: renders the report twice with different
`fetchedAt`, asserts the banner text differs but the
`release-readiness-hash` marker is identical (proves the banner is not
hashed).
- 12 new `Format-ReportFreshnessBanner` unit tests
(fresh/stale/singular/plural/ISO-string/null/unparseable/clock-skew/custom-threshold).
- Full suite green (838/0 in a networked env).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 7, 2026
@github-actions github-actions Bot modified the milestones: .NET 10 SR9, .NET 10 SR10 Aug 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants