Skip to content

Align dataset refresh window with the ISO week it is labelled with - #751

Closed
Groenbech96 wants to merge 1 commit into
mainfrom
fix/dataset-refresh-iso-week-window
Closed

Align dataset refresh window with the ISO week it is labelled with#751
Groenbech96 wants to merge 1 commit into
mainfrom
fix/dataset-refresh-iso-week-window

Conversation

@Groenbech96

@Groenbech96 Groenbech96 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Fixes AB#644112.

What actually went wrong

The week-30 run started 2026-07-20T05:10:48Z with since-days: 7, i.e. merged:>=2026-07-13. The candidates it collected were merged 07-13T09:25Z (BCApps#9313), 07-13T15:52Z (#9316) and 07-15T19:22Z (#9404) — all genuinely inside that window. The 7-day lookback was not wrong.

What was wrong is the label: collect-and-screen.yml named the branch and PR after the ISO week the job ran in (week 30), while the window it collected is week 29 (Jul 13–19). So #743 presented week-29 work as week-30 candidates, and by review time an in-window PR read as two weeks stale.

Secondary, and real: the trailing window has fuzzy edges. The bound is date-only and open-ended (>= with no upper bound), measured from a variable job start time — so PRs merged between Monday 00:00 and the job start (05:10) fall into this batch and into next week's.

Fix

Make the window and the label the same object instead of two independent notions of "week".

  • New Get-IsoWeekWindow in BCBenchUtils.psm1 resolves a full ISO week (Mon 00:00:00Z → Sun 23:59:59Z) plus its YYYY-WW label; WeeksAgo = 1 is the last completed week.
  • Collect-And-Screen.ps1 searches the bounded range merged:<since>..<until> instead of merged:>=<date>, closing the boundary overlap. Invalid ranges throw.
  • The workflow derives branch (dataset/week-2026-29), PR title and search window from that same window, so "week N" always means "merged during week N".
  • The PR body now states the merge window, so a candidate's age is explainable at review time.

On the removed since-days input

since-days was a valid input and behaved as documented; it is replaced by weeks-ago only because a trailing N-day window cannot carry an exact week label. weeks-ago: 2 re-collects an older week, and Collect-And-Screen.ps1 -MergedSince/-MergedUntil still takes arbitrary ranges. Happy to re-expose an ad-hoc range as a dispatch input if that flexibility is wanted in CI — it would need a window-based branch name rather than a week label.

Verification

  • Get-IsoWeekWindow checked across year boundaries (2026-01-05 → 2025-12-29..2026-01-04; 2027-01-04 → ISO week 2026-53).
  • Ran Collect-And-Screen.ps1 against microsoft/BCApps with default, explicit-full-week, partial and invalid windows; search string, summary and week label are correct in each case, and the range query verifiably clips both ends.
  • A run today (2026-07-27) resolves to 2026-07-20T00:00:00Z..2026-07-26T23:59:59Z = ISO week 2026-30, disjoint from the week-29 batch.
  • YAML parses; pre-commit clean.

Copilot AI review requested due to automatic review settings July 27, 2026 07:44

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

Aligns dataset collection windows, branch names, and PR metadata with the ISO week candidates were merged.

Changes:

  • Adds reusable ISO-week window calculation.
  • Uses bounded merge timestamps during candidate collection.
  • Includes year/week labels and merge windows in generated PRs.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
scripts/BCBenchUtils.psm1 Adds ISO-week window calculation.
scripts/Collect-And-Screen.ps1 Collects PRs within bounded merge dates.
scripts/New-DatasetPrBody.ps1 Adds the merge window to PR bodies.
.github/workflows/collect-and-screen.yml Derives collection metadata from one week window.

Comment thread scripts/BCBenchUtils.psm1
The weekly refresh named its branch/PR after the ISO week the job ran in,
but collected a trailing 7-day window ending at the job start time. Those two
never describe the same period: the Monday week-30 run opened "week 30" while
its contents were week 29 merges (#743 shipped BCApps#9316 / #9313, merged
2026-07-13). The 7-day lookback was correct - those PRs were genuinely inside
it - the label was not, so in-window candidates read as stale on review.

The trailing window also has fuzzy edges: the bound is date-only and
open-ended, so PRs merged between midnight and the job start land in this
batch and in the next one.

Resolve the window as a full ISO week (Mon 00:00:00Z - Sun 23:59:59Z) via a
new Get-IsoWeekWindow helper, default to the last completed week, and derive
the branch, PR title and search range from that one window, so "week N" always
means "merged during week N". The merge window is also written into the PR body
so a candidate's age is explainable at review time.

Note: this replaces the since-days dispatch input with weeks-ago. since-days
was not wrong, but a trailing N-day window cannot carry an exact week label;
Collect-And-Screen.ps1 still accepts -MergedSince/-MergedUntil for arbitrary
ranges.

Fixes AB#644112

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Groenbech96
Groenbech96 force-pushed the fix/dataset-refresh-iso-week-window branch from b3b55b9 to 1a331eb Compare July 27, 2026 07:49
@Groenbech96 Groenbech96 changed the title Collect dataset candidates for the ISO week they were merged in Align dataset refresh window with the ISO week it is labelled with Jul 27, 2026
@Groenbech96
Groenbech96 marked this pull request as draft July 27, 2026 07:51
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.

2 participants