Skip to content

fix(miner): flatten calibration module to match the flat lib/ convention#3772

Merged
JSONbored merged 1 commit into
mainfrom
fix/miner-package-flat-lib
Jul 6, 2026
Merged

fix(miner): flatten calibration module to match the flat lib/ convention#3772
JSONbored merged 1 commit into
mainfrom
fix/miner-package-flat-lib

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • packages/gittensory-miner/lib/calibration/{index,types}.{js,d.ts} (added by chore(miner): scaffold calibration module types (#2332) #3704) was the only nested directory under lib/ — every other module ships as a flat lib/<name>.(js|d.ts) file.
  • scripts/check-miner-package.mjs's pack-safety allowlist only accepts that flat one-segment shape, so the real npm pack --dry-run of this package has been failing test:miner-pack since chore(miner): scaffold calibration module types (#2332) #3704 merged — a required check, so validate-code/validate is currently red on main for every PR.
  • Fix: flatten to lib/calibration.js + lib/calibration-types.js, mirroring the existing <name>.js / <name>-cli.js / <name>-expiry.js pairing convention already used throughout lib/, rather than widening the pack-safety allowlist to accept nested paths.

No issue filed — this is a direct, currently-broken-main fix; small enough that this summary explains why.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused — one rename + two import-path updates, nothing else.
  • This follows CONTRIBUTING.md and does not touch site/, CNAME, or GitHub Pages.
  • No issue linked; the summary explains why (small, self-evident, unblocks main).

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage — not run in full; packages/** and test/** are excluded from codecov/patch (only src/** is measured), and the two directly affected test files were run directly (see below)
  • npm run test:workers — unaffected by this change (no Worker/D1 code touched)
  • npm run build:miner (was build:mcp in the template — this PR touches the miner package, not MCP)
  • npm run test:miner-pack — the exact check this PR fixes; now passes on the real workspace package
  • npm run ui:openapi:check / ui:lint / ui:typecheck / ui:build — unaffected, no UI/API surface touched
  • npm audit --audit-level=moderate
  • npx vitest run test/unit/check-miner-package.test.ts test/unit/miner-calibration-types.test.ts — 9/9 passed

If any required check was skipped, explain why:

  • UI/OpenAPI/MCP/Worker checks skipped: this PR only renames files inside packages/gittensory-miner/lib/ and updates two import paths — no UI, API, OpenAPI, Wrangler, or MCP surface is touched.

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.
  • No auth/cookie/CORS/GitHub App/Cloudflare/session changes.
  • No API/OpenAPI/MCP behavior changed.
  • No UI changes.

Notes

packages/gittensory-miner/lib/calibration/{index,types}.{js,d.ts} was the
only nested directory under lib/ — every other module is a flat
lib/<name>.(js|d.ts) file. scripts/check-miner-package.mjs's pack-safety
allowlist only accepts that flat one-segment shape, so the real npm pack
--dry-run of this package started failing test:miner-pack (a required CI
check) as soon as the nested files landed, breaking validate-code/validate
for every PR against main.

Flatten to lib/calibration.js + lib/calibration-types.js (mirroring the
existing <name>.js / <name>-cli.js / <name>-expiry.js pairing convention
elsewhere in lib/) instead of widening the pack-safety allowlist.
@superagent-security

Copy link
Copy Markdown
Contributor

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

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui 96836f5 Commit Preview URL

Branch Preview URL
Jul 06 2026, 08:34 AM

@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.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3772   +/-   ##
=======================================
  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 merged commit 2302554 into main Jul 6, 2026
12 checks passed
@JSONbored
JSONbored deleted the fix/miner-package-flat-lib branch July 6, 2026 08:51
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.

1 participant