Skip to content

v1.91.333.0 fix(scorecard): --now bounds every windowed line; recommended-harness week is 83 PRs (GST-135) - #3635

Merged
capy-ai[bot] merged 7 commits into
mainfrom
capy/now-bounds-every-windowed
Oct 30, 2026
Merged

capy-ai[bot] merged 7 commits into
mainfrom
capy/now-bounds-every-windowed

Conversation

@garrytan

@garrytan garrytan commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3635,
  "head": "b8ed92426d525a982154f65fd1354659ecf4b30c",
  "version": "1.91.327.0",
  "base": "main",
  "gate": {
    "scorecard": {
      "pass": 52,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "9a6edd6ebe9ecd4bb72f57ecb61b1e09f8bac248",
  "product_patch_id": "ba6181ab97c0382c9127b38f946b3d92954d4983",
  "gstack_version": "1.91.331.0",
  "review_depth": {
    "depth": "standard",
    "class": "code",
    "runtime_lines": 104,
    "rules": "55726fab80631072",
    "base": "ae3d58c932375897184ae4d50a4a1a33e6e16fff",
    "registry": "ae3d58c932375897184ae4d50a4a1a33e6e16fff",
    "gate_scan": {
      "tagged": 0,
      "head": "b8ed92426d525a982154f65fd1354659ecf4b30c"
    },
    "reasons": [
      "runtime=104>50"
    ]
  },
  "pregate": "requires-remote cleared @9a6edd6ebe9e (1 checks, current for b8ed92426d52)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/41010284207",
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/41010287269",
    "pregate.json/remote_gate: remote-gate tree=9a6edd6ebe9e tests=10203"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/ and README.md, plus retro templates and CONTRIBUTING.md references to the scorecard"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 7,
    "fixed": 0,
    "scope": "frozen",
    "dispatches": {
      "specialist": 6
    }
  }
}

What changed

gstack-factory-scorecard --now 2026-10-15 with a 14-day window: before this PR every line counted through the day of the run; after, only the window counts

--now 2026-10-15 --since-days 14 used to count 290 merged PRs because every read ran to the real present; it now counts 65, the same number GitHub search gives for that window.

Before/after as text: --now 2026-10-15 with a 14-day window: before, every line counted through the day of the run (290 merged PRs); after, only the window counts (65, matching GitHub search)
--- Before · before.txt · captured output
+++ After · after.txt · captured output
+$ gstack-factory-scorecard --repo garrytan/gstack --now 2026-10-15T00:00:00Z --since-days 14   # after (this PR)
-$ gstack-factory-scorecard --repo garrytan/gstack --now 2026-10-15T00:00:00Z --since-days 14   # before (959c8a6)
 ## Factory scorecard: garrytan/gstack (2026-10-01 to 2026-10-15, 14 days)
+| Merged PRs | 65 (crew 64, outside 1) 
+| Gate runs green / red / cancelled | 1 / 0 / 0; known cost $88.86 on 1 of 1 runs 
+| Releases cut | 0 
-| Merged PRs | 290 (crew 285, outside 5) 
-| Gate runs green / red / cancelled | 156 / 18 / 2; known cost $2533.76 on 89 of 176 runs 
-| Releases cut | 2 (v1.91.318.0, v1.91.242.0) 
 
Window Merged PRs, old code Merged PRs, fixed GitHub search
--now 2026-10-15T00:00:00Z --since-days 14 290 65 merged:2026-10-01..2026-10-14 = 65
--now 2026-10-29T00:00:00Z --since-days 14 not run 197 merged:2026-10-15..2026-10-28 = 197
--now 2026-10-26T00:00:00Z --since-days 7 188 83 merged:2026-10-19..2026-10-25 = 83

Why

GST-135 found that --now changed only the scorecard heading, so a past week measured later counted everything up to the day of the run. The scorecard now has one window, from now - since-days up to (not including) now, and every line counts only what falls inside it. The "Where gstack's own numbers stand" section in docs/recommended-harness.md said 103 merged PRs for the week of 2026-10-19; the real week has 83, and every number in that table now comes from the fixed run for that exact week.

Blast radius

The change touches lib/factory-scorecard.ts and listWorkflowRuns in scripts/lib/ci-history.ts, which gstack-test-health also calls. That caller passes no until, so its runs read keeps the same query and results; test/test-health-report.test.ts passed unchanged against the recorded fixture (script ran). The /retro skill runs the scorecard without --now, so its window still ends at the current time.

Approvals

No approvals recorded for branch capy/now-bounds-every-windowed. Garry approved the GST-135 work on 2026-10-29 ("do it"), relayed by GStack Minder.

Summary

The scorecard's --now flag was meant to let you measure a past week after the fact, but each read filtered only on the window start. Merged PRs, gate runs and their cost, free-suite runs, issue searches and releases all ran to the real present. They now all filter through one window helper, so a week measured later reports only that week.

Review turned up a quieter version of the same problem. With --now in the past, the merged-PR and gate-run reads could hit their page cap and return a short count with no warning. Those reads now mark the line unavailable instead. Releases are read to the last page, because GitHub sorts them by creation date and a draft can be published long after it was created. Free-suite runs compare both window ends as times rather than strings. The harness guide documents --now and its window, and its flaky row now counts flake records and cases separately.

Test Coverage

[+] lib/factory-scorecard.ts
  ├── scoreWindow()            [★★★ TESTED] "--now closes the window"
  ├── inWindow()
  │   ├── [★★★ TESTED] item exactly at end is excluded
  │   ├── [★★★ TESTED] item after end is excluded
  │   ├── [★★ TESTED]  item before start is excluded
  │   └── [GAP]        unparsable timestamp gives false
  ├── searchRange()
  │   ├── [★★ TESTED]  whole-second window
  │   └── [GAP → TESTED in c7f30e5] sub-second --now rounding
  ├── readMergedPrs / readGateRuns / readFreeRetries / readReleases [★★★ TESTED]
  ├── page caps: merged PRs, gate runs, releases [★★★ TESTED]
  ├── readReleases: late-published draft on a later page [★★★ TESTED]
  └── collectScorecard(): issue searchRange [★★ TESTED]
[+] scripts/lib/ci-history.ts
  ├── createdFilter(since, until) [★★ TESTED]
  └── listWorkflowRuns() until    [★★★ TESTED]

Tests: 20 → 24 (+4 new) in test/factory-scorecard.test.ts
Coverage: 88% value-weighted (14 of 16 paths at audit time; the sub-second gap was closed by a test in c7f30e5)
Test value: 4 tests written, 0 rejected by the authoring gate, 1 existing test extended, 0 paths weakly covered.
Regression proof: the --now closes the window test was written first and failed against the unfixed code (it was the one failing test of 21, recorded when 40fe5c0 was built); it passes after the fix. The new page-cap and late-release test also fails against the old release paging and passes at b8ed924.
Tests ran: scorecard 52

Pre-Landing Review

No blocking findings in any review. The first review, at 40fe5c0, found eight informational items, and c7f30e5 fixed them all. A rerun at 7b0551d found five more, and b8ed924 fixed them. Those were release paging that read every page, page-cap tests for gate runs and releases, a narrower header comment, and the flaky row's wording.

On 2026-10-30 the review step ran a final time at b8ed924 with the 1.91.331.0 reviewers, which restore the pre-#3621 briefs. That run used the core checklist, six specialists (testing, maintainability, security, performance, simplification and state-machines), the native adversarial pass and the cross-family outside voice. Nothing reached the blocking floor (a failing test, a production break, or lost data or secrets). It found seven informational items after merging duplicates. All seven are listed under Review notes and left as they are, so the head did not change.

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=7 fixed=0 scope=frozen dispatches=6

Gate edits: none detected (listed=6 eligible=4 inspected=4 unread=0, no tagged hunks)

Outside review (openai/gpt-6.1-sol, reading the diff and the published numbers against the evidence runs): at b8ed924, 1 Medium finding, GitHub's 1,000-result limit (the first note below). Every published number matched the evidence, including "17 paid flake records across 11 cases" and "4 cases that flaked more than once".

Review notes

The b8ed924 review noted 7 informational findings, and all of them stay as they are.

  1. GitHub's 1,000-result limit (outside voice, rated Medium, and the adversarial pass), lib/factory-scorecard.ts:274. GitHub returns at most 1,000 runs for a filtered workflow-runs list. So the 20-page cap on gate runs can't fire, and a window with more than 1,000 gate or free-suite runs would print a short count instead of "unavailable". gstack had 54 gate runs and 83 free runs in the doc's week. Worth a follow-up that checks total_count.
  2. Release paging cost (performance and the adversarial pass), lib/factory-scorecard.ts:334. Reading every release page costs one API call per 100 releases, and a repo with more than 2,000 releases always gets "unavailable" on the releases line. That was the intended trade when b8ed924 made the release count correct. gstack has 2 releases.
  3. Untested runs boundary (testing), scripts/lib/ci-history.ts:120. listWorkflowRuns has no direct test for a run created exactly at until, or for one whose created_at does not parse. Both are covered only indirectly through the scorecard tests.
  4. Free-run page cap (maintainability), scripts/lib/ci-history.ts:115. listWorkflowRuns still stops quietly at its page cap, so the free-retry line can't show "unavailable" for more than 2,000 runs. Its docstring's "a partial history is never reported" overstates this.
  5. Shifting pages (adversarial), lib/factory-scorecard.ts:172. Page-by-page reads can count a row twice or skip one if a PR, run or release changes while the pages are being read. That was true before this PR too.
  6. Exactly 20 full pages (adversarial, low confidence), lib/factory-scorecard.ts:173. A read that ends exactly on a full 20th page is reported as unavailable, even though it was complete.
  7. Numbers that age (adversarial, low confidence), docs/recommended-harness.md:291. The remeasured week reads run conclusions, artifacts and issue close times as they are on the day of the run, so a later rerun can drift as artifacts expire. The evidence names the run, but the doc doesn't give the measurement date.

Exploratory QA

Ran the fixed scorecard live against garrytan/gstack for three windows (table above) and compared each merged-PR count with an uncapped GitHub search for the same dates. All three match. At b8ed924 the doc's week (--now 2026-10-26T00:00:00Z --since-days 7) was rerun and gave the same scorecard JSON as the run behind the doc. Logs: runs/r330-1026-7, runs/fixed-1015-14, runs/fixed-1029-14, runs/fixed-1026-7, runs/base-1015-14 and runs/base-1026-7 in the lane's evidence folder.

Design Review

No frontend files changed, so design review was skipped.

Eval Results

No prompt-related files changed, so evals were skipped.

Greptile Review

No Greptile comments.

Plan Completion

6 of 6 plan items done: the failing-first test, the one window helper, the harness section numbers from the 2026-10-26 seven-day rerun, the recorded evidence, everyday wording in the doc, and the CHANGELOG [Unreleased] entry with no VERSION bump.

Verification Results

All five obligations passed and none were blocked or skipped: the two live --now runs (65 and 197 merged PRs), the seven-day rerun for 2026-10-26 (83, rerun again at b8ed924 with the same result), the GitHub search for merged:2026-10-19..2026-10-25 (83), and typecheck plus the scorecard tests and module-size ratchet.

TODOS

No TODO items completed in this PR.

Documentation

Status: updated. One factual edit: the factory scorecard guide now documents the --now window end.

Scope: base 959c8a6..c7f30e5 (2 commits, 7 files); the staged, unstaged and new-file sets were empty. Searched every tracked doc and authored template for scorecard and windowing references.

Documentation health:

  • docs/recommended-harness.md: Updated. Added [--now <iso>] to the scorecard usage block and a note that the window is [now - since-days, now), with --now (default: the current time) setting its end so a past week measured later counts only that week. The remeasured numbers were not changed.
  • retro/SKILL.md.tmpl (Step 7.5): Current. It runs without --now, so the window ends at the current time.
  • retro/sections/report-format.md.tmpl: Current.
  • docs/standalone-binaries.md: Current.
  • capy/README.md: Current.
  • README.md: Current.
  • CONTRIBUTING.md: Current.
  • docs/TESTING_INTERNALS.md: Current.
  • docs/test-audit-2026-10.md: Current (dated history, left as written).
  • CHANGELOG.md: Current (not edited; the [Unreleased] entry matches the diff).

Coverage: --now window semantics have reference coverage (the harness guide and the bin help) and a worked example in "Where gstack's own numbers stand". The new listWorkflowRuns until option and createdFilter are internal helpers, so there is no documentation debt.

Diagram drift: none.

Test plan

  • gstack-evidence scorecard lane (test/factory-scorecard.test.ts, test/test-health-report.test.ts, test/docs-config-keys.test.ts and test/module-size-ratchet.test.ts) at b8ed924: 52 pass, 0 fail
  • bun run typecheck at b8ed924: 0 errors
  • Remote pregate on a Ubicloud VM at tree 9a6edd6ebe9e (head b8ed924): 10203 tests, 0 failed, $0.06 spent
  • Free Tests (run 41010284207, macOS named regressions included) and Windows Free Tests (run 41010287269), dispatched at b8ed924: success, cleared into the pregate record; gstack-pregate verify: ok

Open in Capy

… week is 83 PRs (GST-135)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 6 commits October 30, 2026 02:19
…o the window, one instant comparison for runs

Pre-landing review fixes for GST-135: readMergedPrs, readGateRuns and readReleases throw past MAX_PAGES
instead of returning a partial count; readReleases pages until it reaches the window start;
listWorkflowRuns compares both bounds with Date.parse and skips unparsable timestamps; tests for a
sub-second window, releases behind a full page and the PR page cap; doc wording on the red-train row
and the unverified 142-PR baseline removed.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…sed date, not a bare epoch literal

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ross cases

GitHub lists releases by creation, so stopping on a page's oldest
publication could miss a draft published inside the window. Read every
page (the page cap still marks the line unavailable). Pin the gate-run
and release page caps with a test. The harness doc's flaky row now says
17 paid flake records across 11 cases instead of 17 cases.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…-windowed

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@github-actions github-actions Bot changed the title fix(scorecard): --now bounds every windowed line; recommended-harness week is 83 PRs (GST-135) v1.91.333.0 fix(scorecard): --now bounds every windowed line; recommended-harness week is 83 PRs (GST-135) Oct 30, 2026
@capy-ai
capy-ai Bot merged commit 11c17d4 into main Oct 30, 2026
62 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.

1 participant