[jsweep] Clean action_conclusion_otlp.cjs#31420
Conversation
- Use Number() + Number.isFinite() instead of parseInt for clearer NaN/Infinity handling - Reorder spanName/startMs computation before endpoint branch - Simplify if/else to positive-condition-first (remove double negation) - Add test for Infinity input (startMs: undefined path via Number.isFinite) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Cleans up action_conclusion_otlp.cjs to make the startMs parsing more explicit and the control flow easier to read, and adds a targeted test to cover the new parsing guard.
Changes:
- Switches
GITHUB_AW_OTEL_JOB_START_MSparsing toNumber()with aNumber.isFinite()guard (rejectsNaN/Infinityexplicitly). - Reorders
spanName/startMscomputation ahead of the endpoint logging branch and flips the branch to a positive check (if (endpoints)). - Adds a new test case ensuring
"Infinity"results instartMs: undefined.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/action_conclusion_otlp.cjs | Refactors startMs parsing and slightly restructures endpoint-logging flow for clarity. |
| actions/setup/js/action_conclusion_otlp.test.cjs | Adds test coverage for the "Infinity" start timestamp case. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
There was a problem hiding this comment.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · ● 1.6M
🧪 Test Quality Sentinel ReportTest Quality Score: 100/100✅ Excellent test quality
Test Classification Details
No Flagged TestsAll analyzed tests are classified as design tests with no issues detected. Language SupportTests analyzed:
Verdict
The new test directly validates the behavioral contract introduced in the production change: when The mock target ( 📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does:
Implementation Tests (Low Value) verify how the system does it:
Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators. References: §25653320848
|
jsweep: Clean
action_conclusion_otlp.cjsContext: Pure Node.js module (invoked from
post.jsandclean.sh)Changes
Number()+Number.isFinite()instead ofparseInt: More explicit about rejectingNaNandInfinitywhen parsingGITHUB_AW_OTEL_JOB_START_MS.parseInt('Infinity', 10)returnsNaN(falsy, same result), but the new code documents intent clearly viaNumber.isFinite.spanName/startMsare now computed before the endpoint branch — reads top-to-bottom without jumping.if (!endpoints) { ... } else { ... }toif (endpoints) { ... } else { ... }to remove the double-negation cognitive load.Tests
should pass startMs: undefined when GITHUB_AW_OTEL_JOB_START_MS is Infinity— covers theNumber.isFiniteguard thatparseIntdid not explicitly test.✅ Validation
npm run format:cjs✓npm run lint:cjs✓npm run typecheck✓npx vitest run action_conclusion_otlp.test.cjs— 18/18 passed ✓