Repository navigation
[Test Quality] Pin exact errors and anchoring for --memory-limit/--pids-limit parsers - #11526
Merged
Merged
Conversation
Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active issues are identified, and the change is limited to focused parser contract tests covering malformed and zero-valued inputs with exact error assertions.
No open issues 🎉
What changed in this PR
This test-only PR strengthens parser contract coverage for --memory-limit and --pids-limit, asserting exact errors for malformed and zero-valued inputs.
Changes:
- Adds table-driven cases for whitespace, junk, signs, decimals, newlines, hexadecimal, and exponent formats.
- Verifies exact error objects and distinct positivity errors without an unintended
value.
| File | Description |
|---|---|
| src/option-parsers-agent-opts.test.ts | Expands parser tests with comprehensive malformed-input, exact-error, and zero-value assertions. |
Review effort: Lite (dynamic)
Contributor
Author
|
✅ Copilot review passed with no inline comments. @github-actions[bot] Add the |
lpcox
deleted the
test-quality/resource-limit-parsers-75545f8b507c8253
branch
November 13, 2026 15:29
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.
Contract
parseMemoryLimit/parsePidsLimit(src/option-parsers.ts) must accept only fully-matching values (<digits><b|k|m|g>,^\d+$) and return the documented error text. Values flow into Dockermem_limit/pids_limitin compose.Previous weakness
Tests only asserted
toHaveProperty('error')on a few trivially bad inputs. A regression dropping the$anchors (accepting2gb,1000abc,1e3,2g\n512m) and the wrong-error-branch case were not detected.Change
Test-only,
src/option-parsers-agent-opts.test.ts: table-driven malformed inputs (trailing/leading junk, whitespace, newline, hex/exponent, sign, decimals) asserting the exact error object (novalue), plus zero cases asserting the distinct "positive" error message.Evidence
./node_modules/.bin/jest --runInBand --no-coverage --runTestsByPath src/option-parsers-agent-opts.test.ts→ 39 passed.$anchors in both regexes): old tests → 1 failed (only the memory trailing case inrejects invalid formats... pids1000abcmissed); new tests → 10 failed on the intended assertions (e.g.2gb,1000abc,1e3,0x10, newline cases).anywarnings only).CI
Discovered by root Jest via
npm testin.github/workflows/build.yml. Unit-level evidence only; no container/network enforcement involved.