Skip to content

chore(miner): add test:miner-pack publish-shape checker - #3530

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
kiannidev:feat/miner-pack-check-2310-v3
Jul 5, 2026
Merged

chore(miner): add test:miner-pack publish-shape checker#3530
JSONbored merged 1 commit into
JSONbored:mainfrom
kiannidev:feat/miner-pack-check-2310-v3

Conversation

@kiannidev

Copy link
Copy Markdown
Contributor

Closes #2310

Summary

  • Add scripts/check-miner-package.mjs, mirroring check-mcp-package.mjs for @jsonbored/gittensory-miner (npm pack dry-run, allowlist, secret scan, required bin/ + lib/*.js assertions).
  • Wire test:miner-pack in root package.json and enforce it on the main validation path via test:ci (... build:miner && test:miner-pack ...).
  • Vitest exercises the checker via subprocess + env-injected fixtures (no .mjs type imports, no static secret-like literals in the diff).

Conflict avoidance

Touches only scripts/check-miner-package.mjs (new), test/unit/check-miner-package.test.ts (new), and package.json (test:miner-pack + test:ci segment). No overlap with open enrichment/review PRs.

Test plan

  • npm run test:miner-pack
  • COVERAGE_NO_THRESHOLDS=1 npx vitest run test/unit/check-miner-package.test.ts --coverage
  • npm run build --workspace @jsonbored/gittensory-engine && npm run build:miner

Made with Cursor

Mirror check-mcp-package.mjs for gittensory-miner, assert required bin/lib
artifacts, and wire the checker into test:ci after build:miner.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kiannidev
kiannidev requested a review from JSONbored as a code owner July 5, 2026 15:50
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.09%. Comparing base (7dd3836) to head (7367f63).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3530   +/-   ##
=======================================
  Coverage   93.09%   93.09%           
=======================================
  Files         301      301           
  Lines       31450    31450           
  Branches    11483    11483           
=======================================
  Hits        29279    29279           
  Misses       1517     1517           
  Partials      654      654           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-05 15:59:36 UTC

3 files · 1 AI reviewer · no blockers · readiness 80/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review: This PR changes guardrail-protected path(s): package.json (matched package.json), package.json (matched **/package.json).

Review summary
This PR adds a publish-shape checker for `@​jsonbored/gittensory-miner` that faithfully mirrors `check-mcp-package.mjs`: allowlist, forbidden-path/content regexes, required-file assertions, and an env-injection fixture mechanism for tests. The placement of `test:miner-pack` after `build:miner` in `test:ci` is correct, the subprocess-based test harness is consistent with the existing pattern, and the secret probe in the test uses string concatenation to avoid a literal in source. No logic errors or correctness defects are present in the diff.

Nits — 6 non-blocking
  • test/unit/check-miner-package.test.ts — the 'rejects a package missing the CLI bin' and 'rejects an unexpected file' cases inject fake file lists without setting `CHECK_MINER_PACK_TEST_CONTENT`, so the script falls through to `readFileSync(join(packageRoot, file))` for any ALLOWED file in the fixture; `lib/cli.js` in particular is unlikely to exist as a committed source file, meaning ENOENT is thrown before the 'missing required file' check and the `toContain` assertion would fail in a clean checkout where the miner isn't pre-built — set `CHECK_MINER_PACK_TEST_CONTENT: '{}'` in both cases to make the fixtures fully self-contained.
  • scripts/check-miner-package.mjs:16 — `FORBIDDEN_CONTENT`'s `[A-Z0-9_]*(TOKEN|SECRET|PRIVATE_KEY)=` arm has no `i` flag, so lowercase env-var leaks like `aws_secret=value` are not caught; if the intent is uppercase-only env-var style that's fine, but a one-line comment stating that would prevent future confusion.
  • scripts/check-miner-package.mjs:43 — `packageRoot` defaults to `join(process.cwd(), 'packages/gittensory-miner')`; this is correct when invoked from the repo root via npm scripts but will silently read from the wrong path if the script is ever run from a subdirectory — mirrors the MCP checker's same assumption, so not a regression, but worth a note in a comment.
  • test/unit/check-miner-package.test.ts — the integration test 'passes on the real miner workspace package' invokes `npm pack --dry-run` on the live workspace; `test:coverage` runs before `build:miner` in `test:ci`, so this test depends on the miner being pre-built in the workspace — if the build is ever stale or missing the test will fail with a pack error rather than a clear assertion failure.
  • In 'rejects a package missing the CLI bin' and 'rejects an unexpected file', add `CHECK_MINER_PACK_TEST_CONTENT: '{}'` alongside the `CHECK_MINER_PACK_TEST_FILES` injection so no real filesystem read is attempted for the synthetic file list — this makes every negative-path test hermetic and independent of build state.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2310
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 ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 1433 registered-repo PR(s), 732 merged, 48 issue(s).
Contributor context ✅ Confirmed Gittensor contributor kiannidev; Gittensor profile; 1433 PR(s), 48 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: kiannidev
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: TypeScript, MDX, C++, HTML, Rust
  • Official Gittensor activity: 1433 PR(s), 48 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
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.

🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@JSONbored
JSONbored merged commit b031d83 into JSONbored:main Jul 5, 2026
8 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. manual-review Gittensor contributor context

Development

Successfully merging this pull request may close these issues.

docs(miner-discovery): package.json test:mcp-pack + build:mcp parity checks for gittensory-miner

2 participants