← Back to Pull requests

Reduce Windows CI latency without reducing native test coverage #1162

Merged
c1-squire-dev[bot] merged 6 files (312 lines) on Oct 03, 2026 17:18 UTC
View on GitHub
c1-squire-dev[bot] c1-squire-dev[bot] commented on Oct 03, 2026 15:21 UTC
Author

Summary

  • Run the existing native Windows short-mode suite as four concurrent, automatically discovered test shards in both PR and main CI.

  • Verify every selected package/test pair completes, retain all subtests with their parent, and upload per-shard timing and inventory artifacts.

  • Preserve the existing go-test (windows-latest) required-check name; it passes only when all four shards pass.

  • Batch the concurrent-close fixture's writes while retaining all 150,000 grants, WAL mode, grant-count assertions, and a populated-WAL premise before close.

  • Remove unused Windows coverage instrumentation; Linux coverage collection and storage durability settings remain unchanged.
  • Motivation

    In run https://github.com/ConductorOne/baton-sdk/actions/runs/37128377008 the Windows test step took 23.93 minutes versus 2.95 minutes on Linux. The concurrent-close fixture took 736 seconds, of which close itself took only 1.23 seconds. Its setup committed 15,000 grant batches plus 1,500 entitlement batches. Batching reduces those setup transactions to 150 grant batches and one entitlement batch without shrinking the fixture.

    Package-only sharding would retain the long per-package tail. Test-name sharding divides the storage-heavy packages too. New tests enter the native platform's discovered inventory automatically; missing execution is an error rather than a green empty shard.

    Verification

  • Full go test -tags=baton_lambda_support -v ./...: passed (66 packages with tests, 24 without).

  • make lint with the CI-pinned golangci-lint v2.13.2: zero issues.

  • Concurrent-close fixture: passed with a populated WAL and all 150,000 grants; local elapsed time 13.11s before batching and 7.11s after.

  • All four local shards passed: 2,091 Linux-native inventory entries completed across the partition.

  • Shard regression checks passed locally and on Windows: examples, fuzz seeds and skips are preserved; a successful test binary that omits discovered tests fails the audit.

  • Actionlint passed for both changed workflows.

  • Native Windows CI is green: https://github.com/ConductorOne/baton-sdk/actions/runs/37133194865 (final revision 0e9500f).
  • Measured Windows results

    | Metric | Previous run | This PR |
    | --- | --- | --- |
    | Workflow elapsed | 25m34s | 8m14s |
    | Slowest Windows job | 25m30s | 8m03s |
    | Concurrent-close test (150,000 grants) | 736.03s | 49.88s |
    | Native top-level inventory completed | 2,089 | 2,090 |
    | Skipped tests/subtests | 101 | 101 |

    Windows shard jobs completed in 6m19s, 6m53s, 7m49s, and 8m03s. Artifact audit verified identical discovery inventories across all four runners, with every native top-level package/test pair completed exactly once. No baseline test was removed; the current main revision adds one capability test. The skip inventory is identical to the baseline.

    The slowest Windows job is 68% faster and concurrent-close is 93% faster. Aggregate Windows runner time is 29m04s across four runners versus 25m30s before: roughly 14% more runner work for 68% less latency. These are observed runs, not a controlled repeated benchmark.

    Coverage and risk

    No new test skips, reduced fixture dimensions, disabled disk sync, in-memory replacement of native storage, or production code changes. Existing -short behavior and baton_lambda_support build tag remain in place. Four runners trade additional aggregate runner work and cache restores for shorter elapsed time. The unchanged Linux suite continues exercising cross-test execution in one process.

    Diff: 312 lines (+294 / -18) across 6 files Reviewer: pquerna Review duration: 116m
    All Vouch review confidence checks passed
    Residual risk 0.05 = Change Risk (0.45) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 312 lines diff across 6 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.88 · 5 substantive comment(s)
    0.88
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    88%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.344
    Real PR Conversation Timeline
    9 items
    github-actions[bot] github-actions[bot] commented on Oct 03, 2026 15:21 UTC
    Bot

    <!-- review-superseded: {"report_comment_id": 5970541508, "run_id": "37132942429", "run_attempt": "1"} -->
    <details>
    <summary>Superseded — see the <a href="https://github.com/ConductorOne/baton-sdk/pull/1162#issuecomment-5970541508">current review report</a> for commit <code>3eafa1ebc73f</code></summary>

    General PR Review: Reduce Windows CI latency without reducing native test coverage

    Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
    Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base df0612bd4fe9.
    _Review mode: full_
    View review run

    Review Summary


    The PR moves the Windows -short test run from the go-test matrix into a new 4-shard windows-tests job in both ci.yaml and main.yaml. A new scripts/windows-test-shard.py lists every test with go test -list, assigns each top-level test name to a shard by SHA-256 hash, and runs that shard with an anchored -run pattern. Afterward it checks that every assigned package/test pair passed or skipped and that no unassigned top-level test ran. A new aggregator job is named go-test (windows-latest), so the required-check name is unchanged; it passes only when every shard passes. Windows coverage instrumentation is dropped, and TestC1ZConcurrentClose now writes grants in batches of 1,000 and entitlements in one call. The test still checks 150,000 grants and now also checks that the WAL file is non-empty before close. No production code, proto, exported API or dependency changed.

    I scanned the full diff for security and correctness. The listing flags match the run flags, and Go's -run handling keeps the anchored ^(A|B)$ pattern working, so subtests stay with their parent. The audit ignores subtest names (those containing /), so fuzz seed entries are not flagged. PutEntitlements splits large inserts into chunks internally (executeChunkedInsert), so the single 15,000-entitlement call is safe. windows-test-result uses if: always() and requires result == success, so cancelled or skipped shards fail the check.

    How the repo criteria applied: Risk triage: Silence – no (missing or unexpected tests fail the shard). Durability – no (CI and test code only). Uncontrolled dimensions – partly: hash-based shard balance shifts as tests are added, and the selector length grows with the inventory, but the script fails loudly on both. Consumer distance – no. Consequence: rung 1 (fix CI). Verdict: LOW. The SDK API, proto, serialized-state, defaults and dependency checks don't apply because no such surfaces changed.

    Not covered: I did not see a native Windows run of this script, and the PR body also defers that to this PR's CI artifacts. I did not measure how close each shard's -run selector is to the script's 30,000-character limit. The script fails with a clear error if a shard exceeds it.

    Security Issues


    None found.

    Correctness Issues


    None found.

    Suggestions


  • New — .github/workflows/ci.yaml:68 (same line in .github/workflows/main.yaml): --count 4 is hard-coded separately from the shard: [0, 1, 2, 3] matrix. If --count is raised but the matrix is not, tests hashed to the new shard IDs never run and every shard still passes. Each shard only audits its own assignment, so nothing catches the gap. docs/TESTING.md documents the coupling, but --count ${{ strategy.job-total }} removes it. Confidence: high.
  • <details>
    <summary>Prompt for AI agents</summary>

    Verify each finding against the current code and only fix it if needed.
    
    ## Suggestions
    
    In `.github/workflows/ci.yaml`:
    - Around line 68: Replace `--count 4` in the "Run and audit native Windows tests" step with `--count ${{ strategy.job-total }}` so the shard count always matches the matrix length. Otherwise a mismatch silently leaves tests unrun.
    
    In `.github/workflows/main.yaml`:
    - Around line 79: Make the same change (`--count ${{ strategy.job-total }}`) in the windows-tests job.
    
    In `docs/TESTING.md`:
    - In the "Native Windows CI" section: Once the count comes from the matrix, update or remove the sentence saying the matrix and `--count` must be kept in sync by hand.
    

    </details>

    </details>

    github-actions[bot] github-actions[bot] commented on code on Oct 03, 2026 15:23 UTC
    Code Review
    .github/workflows/ci.yaml:1
    @@ -54,6 +49,49 @@ jobs:
             uses: guyarb/golang-test-annotations@v0.9.0
             with:
               test-results: test.json
    +  windows-tests:
    +    name: Windows tests (shard ${{ matrix.shard }})
    +    runs-on: windows-latest
    +    timeout-minutes: 20
    +    strategy:
    +      fail-fast: false
    +      matrix:
    +        shard: [0, 1, 2, 3]
    +    steps:
    +      - name: Checkout code
    +        uses: actions/checkout@v6
    +      - name: Install Go
    +        uses: actions/setup-go@v6
    +        with:
    +          go-version-file: "go.mod"
    +      - name: Run and audit native Windows tests
    +        run: python scripts/windows-test-shard.py --shard ${{ matrix.shard }} --count 4

    🟡 Suggestion: --count 4 is hard-coded separately from the shard: [0, 1, 2, 3] matrix. If someone raises --count but leaves the matrix alone, the tests assigned to the new shard IDs never run and every shard still passes. The per-shard audit can't catch this because each shard only checks its own assignment. Taking the count from the matrix removes that drift (same change in main.yaml). Confidence: high.

            run: python scripts/windows-test-shard.py --shard ${{ matrix.shard }} --count ${{ strategy.job-total }}
    

    github-actions[bot] github-actions[bot] commented on Oct 03, 2026 15:23 UTC
    Bot

    <!-- review-superseded: {"report_comment_id": 5970568605, "run_id": "37133194885", "run_attempt": "1"} -->
    <details>
    <summary>Superseded — see the <a href="https://github.com/ConductorOne/baton-sdk/pull/1162#issuecomment-5970568605">current review report</a> for commit <code>0e9500fc080d</code></summary>

    General PR Review: Reduce Windows CI latency without reducing native test coverage

    Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
    Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base df0612bd4fe9.
    _Review mode: full_
    View review run

    Review Summary


    The PR moves the Windows -short test run from the go-test matrix into a new 4-shard windows-tests job in both ci.yaml and main.yaml. A new scripts/windows-test-shard.py lists every test with go test -list, assigns each top-level test name to a shard by SHA-256 hash, and runs that shard with an anchored -run pattern. Afterward it checks that every assigned package/test pair passed or skipped and that no unassigned top-level test ran. A new aggregator job is named go-test (windows-latest), so the required-check name is unchanged; it passes only when every shard passes. Windows coverage instrumentation is dropped, and TestC1ZConcurrentClose now writes grants in batches of 1,000 and entitlements in one call. The test still checks 150,000 grants and now also checks that the WAL file is non-empty before close. No production code, proto, exported API or dependency changed.

    I scanned the full diff for security and correctness. The listing flags match the run flags, and Go's -run handling keeps the anchored ^(A|B)$ pattern working, so subtests stay with their parent. The audit ignores subtest names (those containing /), so fuzz seed entries are not flagged. PutEntitlements splits large inserts into chunks internally (executeChunkedInsert), so the single 15,000-entitlement call is safe. windows-test-result uses if: always() and requires result == success, so cancelled or skipped shards fail the check.

    How the repo criteria applied: Risk triage: Silence – no (missing or unexpected tests fail the shard). Durability – no (CI and test code only). Uncontrolled dimensions – partly: hash-based shard balance shifts as tests are added, and the selector length grows with the inventory, but the script fails loudly on both. Consumer distance – no. Consequence: rung 1 (fix CI). Verdict: LOW. The SDK API, proto, serialized-state, defaults and dependency checks don't apply because no such surfaces changed.

    Not covered: I did not see a native Windows run of this script, and the PR body also defers that to this PR's CI artifacts. I did not measure how close each shard's -run selector is to the script's 30,000-character limit. The script fails with a clear error if a shard exceeds it.

    Security Issues


    None found.

    Correctness Issues


    None found.

    Suggestions


  • New — .github/workflows/ci.yaml:68 (same line in .github/workflows/main.yaml): --count 4 is hard-coded separately from the shard: [0, 1, 2, 3] matrix. If --count is raised but the matrix is not, tests hashed to the new shard IDs never run and every shard still passes. Each shard only audits its own assignment, so nothing catches the gap. docs/TESTING.md documents the coupling, but --count ${{ strategy.job-total }} removes it. Confidence: high.
  • <details>
    <summary>Prompt for AI agents</summary>

    Verify each finding against the current code and only fix it if needed.
    
    ## Suggestions
    
    In `.github/workflows/ci.yaml`:
    - Around line 68: Replace `--count 4` in the "Run and audit native Windows tests" step with `--count ${{ strategy.job-total }}` so the shard count always matches the matrix length. Otherwise a mismatch silently leaves tests unrun.
    
    In `.github/workflows/main.yaml`:
    - Around line 79: Make the same change (`--count ${{ strategy.job-total }}`) in the windows-tests job.
    
    In `docs/TESTING.md`:
    - In the "Native Windows CI" section: Once the count comes from the matrix, update or remove the sentence saying the matrix and `--count` must be kept in sync by hand.
    

    </details>

    ---
    Reviewed commit: 3eafa1ebc73f
    <!-- review-state: {"last_reviewed_sha": "3eafa1ebc73fe6640bf5b38ae7febb1a977b2369", "base_sha": "df0612bd4fe92a762d7e88ce4a3b67deb6ae91a9", "workflow_ref": "ConductorOne/github-workflows/.github/workflows/general-pr-review.yaml@refs/heads/main", "run_id": "37132942429", "run_attempt": "1", "summary_marker": "### General PR Review:", "verdict_mode": "baseline", "publication": "completed", "started_at": "2026-10-03T15:21:28Z", "working_comment_id": 5970525238, "working_comment_updated_at": "2026-10-03T15:23:26Z"} -->

    </details>

    github-actions[bot] github-actions[bot] commented on Oct 03, 2026 15:23 UTC
    Reviewer

    No blocking issues found — see the full review report

    <!-- review-publication: {"run_id": "37132942429", "run_attempt": "1", "workflow_ref": "ConductorOne/github-workflows/.github/workflows/general-pr-review.yaml@refs/heads/main", "summary_marker": "### General PR Review:", "verdict_mode": "baseline", "report_comment_id": 5970541508} -->

    github-actions[bot] github-actions[bot] commented on Oct 03, 2026 15:25 UTC
    Bot

    <!-- review-superseded: {"report_comment_id": 5970568605, "run_id": "37133194885", "run_attempt": "1"} -->
    <details>
    <summary>Superseded — see the <a href="https://github.com/ConductorOne/baton-sdk/pull/1162#issuecomment-5970568605">current review report</a> for commit <code>0e9500fc080d</code></summary>

    General PR Review: Reduce Windows CI latency without reducing native test coverage

    Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
    Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base df0612bd4fe9.
    _Review mode: incremental since 3eafa1eb_
    View review run

    Review Summary


    The new commit adds scripts/windows_test_shard_test.py, a Python unittest that builds a throwaway Go module and runs windows-test-shard.py against it. It checks two things: Example, Fuzz-seed and skipped tests count as completed, and a test binary that exits 0 without running its selected tests fails the shard. Both ci.yaml and main.yaml now run this test on shard 0 before the real shard run. I scanned the full PR diff (workflows, docs/TESTING.md, pkg/dotc1z/c1file_concurrent_test.go, and the shard script) for security and correctness issues. No new issues found.

    On the repo-local criteria: the change touches only CI and test code. It changes no exported API, proto, serialized state, default, or dependency, so the compatibility sections do not apply. Triage per the risk rubric:

  • Silence: partially. A shard that runs nothing would pass silently. The inventory audit and this new test address that.

  • Durability: no.

  • Uncontrolled dimensions: no.

  • Consumer distance: low, because only CI consumes the output.

  • Verdict: LOW. No escalation is needed.
  • The fixture's go 1.27.1 matches the repo's go.mod, so setup-go needs no toolchain download.

    Security Issues


    None found.

    Correctness Issues


    None found.

    Suggestions


  • Prior — still present — .github/workflows/ci.yaml:71 (also .github/workflows/main.yaml:82): --count 4 is still hard-coded separately from the shard: [0, 1, 2, 3] matrix. If only --count is raised, the tests hashed to the new shard IDs never run, and every shard still passes because each one audits only its own assignment. The open thread already covers this. Confidence: high.
  • <details>
    <summary>Prompt for AI agents</summary>

    Verify each finding against the current code and only fix it if needed.
    
    ## Suggestions
    
    In `.github/workflows/ci.yaml`:
    - Around line 71: In the "Run and audit native Windows tests" step, replace `--count 4` with `--count ${{ strategy.job-total }}` so the shard count always matches the matrix length.
    
    In `.github/workflows/main.yaml`:
    - Around line 82: Make the same change (`--count ${{ strategy.job-total }}`) in the windows-tests job.
    
    In `docs/TESTING.md`:
    - In the "Native Windows CI" section: Once the count comes from the matrix, update or remove the sentence saying the matrix and `--count` must be kept in sync by hand.
    

    </details>

    </details>

    github-actions[bot] github-actions[bot] commented on Oct 03, 2026 15:27 UTC
    Bot

    General PR Review: Reduce Windows CI latency without reducing native test coverage

    Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
    Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base df0612bd4fe9.
    _Review mode: incremental since 3eafa1eb_
    View review run

    Review Summary


    The new commit adds scripts/windows_test_shard_test.py, a Python unittest that builds a throwaway Go module and runs windows-test-shard.py against it. It checks two things: Example, Fuzz-seed and skipped tests count as completed, and a test binary that exits 0 without running its selected tests fails the shard. Both ci.yaml and main.yaml now run this test on shard 0 before the real shard run. I scanned the full PR diff (workflows, docs/TESTING.md, pkg/dotc1z/c1file_concurrent_test.go, and the shard script) for security and correctness issues. No new issues found.

    On the repo-local criteria: the change touches only CI and test code. It changes no exported API, proto, serialized state, default, or dependency, so the compatibility sections do not apply. Triage per the risk rubric:

  • Silence: partially. A shard that runs nothing would pass silently. The inventory audit and this new test address that.

  • Durability: no.

  • Uncontrolled dimensions: no.

  • Consumer distance: low, because only CI consumes the output.

  • Verdict: LOW. No escalation is needed.
  • The fixture's go 1.27.1 matches the repo's go.mod, so setup-go needs no toolchain download.

    Security Issues


    None found.

    Correctness Issues


    None found.

    Suggestions


  • Prior — still present — .github/workflows/ci.yaml:71 (also .github/workflows/main.yaml:82): --count 4 is still hard-coded separately from the shard: [0, 1, 2, 3] matrix. If only --count is raised, the tests hashed to the new shard IDs never run, and every shard still passes because each one audits only its own assignment. The open thread already covers this. Confidence: high.
  • <details>
    <summary>Prompt for AI agents</summary>

    Verify each finding against the current code and only fix it if needed.
    
    ## Suggestions
    
    In `.github/workflows/ci.yaml`:
    - Around line 71: In the "Run and audit native Windows tests" step, replace `--count 4` with `--count ${{ strategy.job-total }}` so the shard count always matches the matrix length.
    
    In `.github/workflows/main.yaml`:
    - Around line 82: Make the same change (`--count ${{ strategy.job-total }}`) in the windows-tests job.
    
    In `docs/TESTING.md`:
    - In the "Native Windows CI" section: Once the count comes from the matrix, update or remove the sentence saying the matrix and `--count` must be kept in sync by hand.
    

    </details>

    ---
    Reviewed commit: 0e9500fc080d
    <!-- review-state: {"last_reviewed_sha": "0e9500fc080dc2836dbaa358ca422497af009f20", "base_sha": "df0612bd4fe92a762d7e88ce4a3b67deb6ae91a9", "workflow_ref": "ConductorOne/github-workflows/.github/workflows/general-pr-review.yaml@refs/heads/main", "run_id": "37133194885", "run_attempt": "1", "summary_marker": "### General PR Review:", "verdict_mode": "baseline", "publication": "completed", "started_at": "2026-10-03T15:25:48Z", "working_comment_id": 5970559100, "working_comment_updated_at": "2026-10-03T15:27:01Z"} -->

    github-actions[bot] github-actions[bot] commented on Oct 03, 2026 15:27 UTC
    Reviewer

    No blocking issues found — see the full review report

    <!-- review-publication: {"run_id": "37133194885", "run_attempt": "1", "workflow_ref": "ConductorOne/github-workflows/.github/workflows/general-pr-review.yaml@refs/heads/main", "summary_marker": "### General PR Review:", "verdict_mode": "baseline", "report_comment_id": 5970568605} -->

    pquerna pquerna approved these changes on Oct 03, 2026 17:17 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    c1-squire-dev[bot] c1-squire-dev[bot]
    Labels
    risk: low confidence: 88.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.7% (MEDIUM) · Higher = larger blast radius
    44.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 88.9% · Lower = rushed or shallow review
    88.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 5.0% · Safe to merge
    5.0%