Skip to content

fix(ci): respect an explicit ACTIONLINT_DOWNLOAD_ATTEMPTS=0 instead of silently defaulting to 4#7811

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
xfodev:fix/actionlint-download-attempts-explicit-parse-7773
Jul 21, 2026
Merged

fix(ci): respect an explicit ACTIONLINT_DOWNLOAD_ATTEMPTS=0 instead of silently defaulting to 4#7811
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
xfodev:fix/actionlint-download-attempts-explicit-parse-7773

Conversation

@xfodev

@xfodev xfodev commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What & why

scripts/actionlint.mjs computed the download-retry cap as Math.max(1, Number.parseInt(process.env.ACTIONLINT_DOWNLOAD_ATTEMPTS ?? "4", 10) || 4). Since 0 is falsy in JS, Number.parseInt("0", 10) || 4 is 4 — so an operator who set ACTIONLINT_DOWNLOAD_ATTEMPTS=0 silently got 4 attempts instead of the 1 the outer Math.max would otherwise floor it to.

Change

  • Extract the parse into scripts/lib/actionlint-download-attempts.mjs (resolveActionlintDownloadAttempts) using an explicit Number.isFinite check instead of the || 4 fallback — mirroring scripts/migrate-selfhost-sqlite-to-postgres.ts's validation shape. An explicit "0" is now honored (floored to 1 by Math.max); missing/blank/non-integer still default to 4.
  • Side-effect-free helper module (+ a .d.mts, like scripts/check-branding-drift.d.mts) so it's importable by a unit test without running actionlint.mjs's side-effecting top-level flow (which requires the native linter and calls process.exit).
  • Add test/unit/actionlint-download-attempts.test.ts covering the 0 → 1 regression plus default/positive/negative cases.

scripts/** is outside the Codecov coverage.include set, so codecov/patch does not gate it — the test runs in the backend vitest suite. Verified locally: 4 new tests pass, root tsc --noEmit clean, git diff --check clean, and npm run actionlint still exits 0.

Closes #7773

…f silently defaulting to 4

scripts/actionlint.mjs computed maxAttempts as
`Math.max(1, Number.parseInt(env.ACTIONLINT_DOWNLOAD_ATTEMPTS ?? "4", 10) || 4)`.
Because 0 is falsy, `Number.parseInt("0", 10) || 4` is 4, so an operator setting
ACTIONLINT_DOWNLOAD_ATTEMPTS=0 silently got 4 attempts instead of the 1 the outer
Math.max would otherwise floor it to.

Extract the parse into scripts/lib/actionlint-download-attempts.mjs
(resolveActionlintDownloadAttempts) using an explicit Number.isFinite check instead
of the `|| 4` fallback — mirroring migrate-selfhost-sqlite-to-postgres.ts's
validation shape — so an explicit "0" is honored (and floored to 1), while
missing/blank/non-integer values still default to 4. A side-effect-free helper
module (with a .d.mts, like check-branding-drift.mjs) keeps actionlint.mjs's
side-effecting top-level flow importable-free for the unit test.

Add test/unit/actionlint-download-attempts.test.ts covering the 0-floored-to-1
regression plus the default/positive/negative cases. `npm run actionlint` still
exits 0.

Closes JSONbored#7773
@xfodev
xfodev requested a review from JSONbored as a code owner July 21, 2026 13:05
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.57%. Comparing base (07064df) to head (2e919e8).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7811   +/-   ##
=======================================
  Coverage   88.57%   88.57%           
=======================================
  Files         725      725           
  Lines       76409    76409           
  Branches    22762    22762           
=======================================
  Hits        67682    67682           
  Misses       7681     7681           
  Partials     1046     1046           
Flag Coverage Δ
shard-1 51.93% <ø> (-3.48%) ⬇️
shard-2 51.63% <ø> (-0.95%) ⬇️
shard-3 51.40% <ø> (+4.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 21, 2026
@loopover-orb

loopover-orb Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-21 13:22:41 UTC

4 files · 1 AI reviewer · no blockers · readiness 95/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This fixes a real bug: the old `Number.parseInt(...) || 4` fallback treated an explicit ACTIONLINT_DOWNLOAD_ATTEMPTS=0 as falsy and silently substituted 4. The new `resolveActionlintDownloadAttempts` helper uses `Number.isFinite` to distinguish a genuine parsed 0 from a missing/NaN value, correctly floors to 1 via the outer `Math.max`, and is extracted into a side-effect-free module so it's unit-testable without triggering actionlint.mjs's top-level side effects. The change is small, well-scoped, tied to issue #7773, and covered by targeted unit tests including the exact 0→1 regression case.

Nits — 3 non-blocking
  • The magic numbers 4 (default attempts) called out in the brief are self-explanatory in context (default retry count) and don't need named constants — this is a stylistic nit only.
  • scripts/lib/actionlint-download-attempts.d.mts has no accompanying JSDoc/comment mirroring the .mjs file, though this is minor since the .mjs docstring already documents the contract.
  • Consider adding a test case for a non-integer-but-parseable string like "3.7" to document that parseInt truncates rather than rejects it, though this is optional given existing coverage is solid.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #7773
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 71 registered-repo PR(s), 42 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor xfodev; Gittensor profile; 71 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The PR replaces the `Number.parseInt(...) || 4` fallback with an explicit `Number.isFinite` check mirroring the referenced pattern, correctly floors ACTIONLINT_DOWNLOAD_ATTEMPTS=0 to 1, and adds a regression test covering the 0->1 case plus default/positive/negative scenarios.

Review context
  • Author: xfodev
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: JavaScript, TypeScript
  • Official Gittensor activity: 71 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 29b959b into JSONbored:main Jul 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

actionlint.mjs's || fallback swallows an explicit ACTIONLINT_DOWNLOAD_ATTEMPTS=0

1 participant