fix(test): stop rebuilding env/keys per iteration in repo-name validation tests - #6880
Merged
Merged
Conversation
…tion tests test/unit/github-labels.test.ts's "rejects invalid repository names before making GitHub calls" and test/unit/github-pr-actions.test.ts's "validates the repo name before any GitHub call" each called createTestEnv() up to 9 times and generated a fresh RSA-2048 key (generateRsaPrivateKeyPem(), real synchronous CPU work) up to 4 times -- once per malformed-name case in a loop. ensurePullRequestLabel/ closePullRequest reject on parseRepoFullName()/splitRepo() before ever touching `env` (src/github/labels.ts, src/github/pr-actions.ts), so none of that setup was needed more than once per env-shape. Reported as a timeout flake alongside three already-fixed sibling tests (test/unit/ai-summaries.test.ts, test/unit/agent-sdk-driver.test.ts, the #5132 miner clone/worktree suite), but this one didn't reproduce under realistic single-suite-equivalent load (3x clean runs under simulated CPU contention) -- the earlier failure was traced to two full test suites running concurrently on one machine, not a normal-load risk. Fixing the confirmed redundant setup anyway since it's the same safe, zero-behavior-change pattern already proven on the sibling PRs: measured ~20% faster on both files together under sustained load (44.7s/45.4s/40.9s vs a 56.0s/56.4s/54.8s baseline, 3 runs each), all 58 tests still pass, and a full local npm run test:ci pass shows both files fully clean.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
24 tasks
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
24 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test/unit/github-labels.test.ts's "rejects invalid repository names before making GitHub calls" andtest/unit/github-pr-actions.test.ts's "validates the repo name before any GitHub call" each calledcreateTestEnv()up to 9 times, and generated a fresh RSA-2048 key (generateRsaPrivateKeyPem(), real synchronous CPU work) up to 4 times -- once per malformed-name case in a loop.ensurePullRequestLabel/closePullRequestreject onparseRepoFullName()/splitRepo()before ever touchingenv(src/github/labels.ts,src/github/pr-actions.ts), so none of that setup was needed more than once per env-shape (plain vs. keyed).test/unit/ai-summaries.test.ts(fix(test): stop ai-summaries forbidden-word sweep timing out under load #6874),test/unit/agent-sdk-driver.test.ts(fix(test): reduce and widen the agent-sdk-driver real-git test timeout #6871), and the#5132miner clone/worktree suite (fix(test): widen timeouts on real-git miner clone/worktree tests #6869).npm run test:cibackgrounded at the same time) -- a self-inflicted, unrealistic doubling of load, not a normal-load risk.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally -- test-only change totest/**, which Codecov does not measure, so there is no patch-coverage obligation.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateAdditional validation beyond the standard checklist: both target tests run 3x in isolation and 3x under simulated heavy CPU contention with zero failures (see timing data in Summary). A full local
npm run test:cirun (single suite, not concurrent with anything else) shows bothgithub-labels.test.tsandgithub-pr-actions.test.tsfully clean.Safety
UI Evidencesection below. (Not applicable -- no visible/UI changes.)UI Evidence
Not applicable -- test-only change, no UI/frontend/docs surface touched.
Notes
gittensory-orbstring intest/unit/release-selfhost-prerelease.test.ts, left behind by commit7c5965d8's otherwise-correct rebrand of.github/workflows/release-selfhost.yml) was also surfaced by this PR'snpm run test:cirun and is being fixed in its own separate PR.