Skip to content

fix(miner): accept lib/ subdirectory modules in the package checker - #3778

Merged
JSONbored merged 1 commit into
mainfrom
fix-miner-package-checker
Jul 6, 2026
Merged

fix(miner): accept lib/ subdirectory modules in the package checker#3778
JSONbored merged 1 commit into
mainfrom
fix-miner-package-checker

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • scripts/check-miner-package.mjs's file-list validation only ever matched flat lib/<name>.(js|d.ts) files (both the ALLOWED allowlist regex and the "missing lib/*.js artifacts" check).
  • chore(miner): scaffold calibration module types (#2332) #3704 (merged) added packages/gittensory-miner/lib/calibration/{index,types}.{js,d.ts} — a one-level subdirectory — which neither pattern accounts for, since they don't allow a / inside lib/.
  • Confirmed this is currently breaking main: the latest push-triggered CI run on origin/main fails validate-code > "Test with coverage" on test/unit/check-miner-package.test.ts > passes on the real miner workspace package, meaning every PR rebased onto current main inherits this failure regardless of its own changes.
  • Fix: widen both regexes to accept an optional one level of subdirectory under lib/, matching the existing flat-file convention otherwise.

Closes #3777

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

No UI changes in this PR — a build-tooling script fix only, so the UI Evidence section below is not applicable.

Notes

  • scripts/** is outside Codecov's src/**-only coverage measurement, so this PR owes no patch-coverage obligation, but regression tests are included anyway (one confirming the new subdirectory case passes, one confirming a file nested two levels deep is still rejected).

check-miner-package.mjs's file-list validation only ever matched flat
lib/<name>.(js|d.ts) files. #3704 added lib/calibration/{index,types}
as a one-level subdirectory, which both the ALLOWED regex and the
"missing lib/*.js artifacts" check missed -- breaking main's
validate-code check for every subsequent PR regardless of its own
changes.

Closes #3777
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@1102504). Learn more about missing BASE report.
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3778   +/-   ##
=======================================
  Coverage        ?   93.29%           
=======================================
  Files           ?      317           
  Lines           ?    32368           
  Branches        ?    11872           
=======================================
  Hits            ?    30199           
  Misses          ?     1537           
  Partials        ?      632           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored JSONbored self-assigned this Jul 6, 2026
@JSONbored
JSONbored merged commit de375d3 into main Jul 6, 2026
10 checks passed
@JSONbored
JSONbored deleted the fix-miner-package-checker branch July 6, 2026 08:55
JSONbored added a commit that referenced this pull request Jul 6, 2026
#3778 widened scripts/check-miner-package.mjs's ALLOWED regex to accept one
level of subdirectory under lib/, to accommodate the calibration module's
nested lib/calibration/{index,types}.{js,d.ts} layout from #3704. #3772
(merged minutes earlier, independently fixing the same main-red CI break)
took the opposite approach: it flattened that module to lib/calibration.js +
lib/calibration-types.js instead, matching every other module in the package.

With the nested directory gone, #3778's widening is dead weight -- it
permanently weakens a security-relevant pack-safety allowlist (the only
guard against an arbitrary nested file sneaking into the published npm
package) for zero remaining benefit. Restore the strict flat-only pattern
and turn the now-obsolete "accepts a subdirectory" test into a rejection
test, so a future nested lib/ file is caught here instead of requiring
another regex widening.
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.

fix(miner): check-miner-package.mjs rejects lib/ subdirectory modules, breaking main CI

1 participant