Skip to content

test(server): bound profile-gate allocation parity to a 2-alloc tolerance - #1528

Merged
Dumbris merged 2 commits into
mainfrom
fix/issues-w5b2-internal-server-tests
Oct 6, 2026
Merged

Dumbris merged 2 commits into
mainfrom
fix/issues-w5b2-internal-server-tests

Conversation

@Dumbris

@Dumbris Dumbris commented Oct 6, 2026

Copy link
Copy Markdown
Member

Summary

Replaces exact testing.AllocsPerRun equality with an absolute 2-alloc tolerance in the profile-gate fleet-independence witnesses in internal/server. Under -race, a tiny-alloc artifact shifts one allocation between the measurement windows, which made the exact comparison flaky. A genuine O(n) regression (about 4096 allocs) still fails.

Items

  • [Bug]: Profile-gate allocation parity still flakes under race on Go 1.27/macOS #1523 (allocation parity flake under -race)
    • Root cause: exact equality of AllocsPerRun results between small and large fleets. The race detector moves one allocation across windows, so the equality fails intermittently.
    • Change: compare with an absolute tolerance of 2 in internal/server/profile_tool_test.go and internal/server/profile_url_gate_test.go.
    • Test: a new negative witness test in profile_url_gate_test.go proves an O(n) regression (about 4096 allocs) still exceeds the tolerance and fails.

Skipped items

None.

Design choice

Option taken: a small absolute tolerance (2 allocs) instead of exact equality.

Trade-off: the tests are robust to the -race artifact, and an O(n) regression is still caught (shown by the negative witness). A regression that adds only 1 or 2 constant allocations is no longer detected. In particular, TestSelectableProfileNames_PinOutcomesDoSameWork can no longer catch the early-return timing-oracle regression it was written for.

This choice awaits maintainer review.

Review Status

Clean after 1 round(s). Unresolved findings:

  • glm:1.1 (low, low-deferred): the 2-alloc tolerance means TestSelectableProfileNames_PinOutcomesDoSameWork can no longer catch the early-return timing-oracle regression it was written for. Zcode rated this medium. I re-mapped it to low because the rubric classes a test that cannot fail as low.

Closes #1523

…ance (refs #1523)

Replace exact AllocsPerRun equality with an absolute tolerance of 2 in the
fleet-independence witnesses; the -race tiny-alloc artifact shifts one
allocation between windows. O(n) regressions (~4096 allocs) still fail, proven
by a new negative witness test.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 243d400
Status: ✅  Deploy successful!
Preview URL: https://df41a632.mcpproxy-docs.pages.dev
Branch Preview URL: https://fix-issues-w5b2-internal-ser.mcpproxy-docs.pages.dev

View logs

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/issues-w5b2-internal-server-tests

Available Artifacts

  • archive-darwin-amd64 (31 MB)
  • archive-darwin-arm64 (28 MB)
  • archive-linux-amd64 (19 MB)
  • archive-linux-arm64 (17 MB)
  • archive-windows-amd64 (31 MB)
  • archive-windows-arm64 (27 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (27 MB)
  • installer-dmg-darwin-arm64 (24 MB)
  • smart-mcp-proxymcpproxy-goN7LEAL.dockerbuild (0 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 37444117826 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

The 2-alloc tolerance is for the 4096-item fleet test that flaked in #1523.
The 64-profile pin-outcome test guards a regression that differs by 0-2
allocations, so it keeps tolerance 0 (refs #1523).
@Dumbris
Dumbris enabled auto-merge (squash) October 6, 2026 10:47
@Dumbris
Dumbris merged commit b654360 into main Oct 6, 2026
40 of 45 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.

[Bug]: Profile-gate allocation parity still flakes under race on Go 1.27/macOS

2 participants