Skip to content

chore(miner): scaffold calibration module types (#2332)#3704

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
Lang-bt:chore/miner-calibration-scaffold-2332
Jul 6, 2026
Merged

chore(miner): scaffold calibration module types (#2332)#3704
JSONbored merged 1 commit into
JSONbored:mainfrom
Lang-bt:chore/miner-calibration-scaffold-2332

Conversation

@Lang-bt

@Lang-bt Lang-bt commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add packages/gittensory-miner/lib/calibration/ with shared PredictedVerdictRecord, ObservedOutcomeRecord, CalibrationRow, and CalibrationReport shapes (field names mirror GateEvalRow / GateEvalReport in src/review/parity.ts).
  • Export runtime type guards and a barrel entry point; wire both modules into the miner package build script.
  • Add test/unit/miner-calibration-types.test.ts with minimal fixtures so the directory lands with coverage.

Closes #2332

Test plan

  • npm test -- test/unit/miner-calibration-types.test.ts
  • npm run build --workspace @jsonbored/gittensory-miner

Made with Cursor

@Lang-bt
Lang-bt requested a review from JSONbored as a code owner July 6, 2026 05:04
@superagent-security

Copy link
Copy Markdown
Contributor

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

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

loopover-orb Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-06 06:48:11 UTC

6 files · 1 AI reviewer · no blockers · readiness 80/100 · CI pending · blocked

⏸️ Suggested Action - Manual Review

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

Review summary
This is a pure types-only scaffold for a future miner calibration module: it adds JS runtime type guards, matching .d.ts declarations, a barrel index, wires the two new files into the package's `node --check` build script, and adds a fixture-based unit test. The runtime guards in types.js correctly mirror the .d.ts shapes field-for-field, the build script edit is a simple additive `&&` chain consistent with the existing pattern, and the test exercises both accept and reject paths for every exported guard. Nothing here wires into any real gate/signal logic yet, so there's no reachable behavioral risk in this diff.

Nits — 6 non-blocking
  • The reported 'depth 5' nesting in types.js:22 is just a multi-line `&&` boolean expression inside a single return statement, not actual control-flow nesting — not worth restructuring.
  • isCalibrationRow doesn't cross-validate that `decided` roughly equals the sum of the confusion-matrix counts, but that's reasonable to defer since this is scaffolding, not the aggregation logic.
  • Consider a short module-level comment (or link back to chore(miner-selfimprove): scaffold packages/gittensory-miner calibration module directory + shared types #2332) in index.js noting this barrel is intentionally minimal until report/ledger/metrics land, so future readers don't wonder why it's so bare.
  • When the real calibration report/ledger logic lands, add a test asserting `decided === wouldMerge - mergeFalse + wouldClose - closeFalse + hold` (or whatever the intended invariant is) rather than only shape validation.
  • Since field names intentionally mirror `GateEvalRow`/`GateEvalReport` in src/review/parity.ts, a one-line JSDoc cross-reference there (or here) would help keep the two in sync as either evolves.
  • 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 #2332
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: 0 registered-repo PR(s), 0 merged, 0 issue(s).
Contributor context ❌ No public Gittensor match Lang-bt; not a blocker.
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: Lang-bt
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: JavaScript, Python
  • Contributor context: Public profile only; not a blocker.
  • 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

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
9929 1 9928 7
View the top 1 failed test(s) by shortest run time
test/unit/check-miner-package.test.ts > check-miner-package script > passes on the real miner workspace package
Stack Traces | 1.42s run time
AssertionError: expected 1 to be +0 // Object.is equality

- Expected
+ Received

- 0
+ 1

 ❯ test/unit/check-miner-package.test.ts:20:27

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Add shared PredictedVerdictRecord, ObservedOutcomeRecord, CalibrationRow,
and CalibrationReport shapes under packages/gittensory-miner/lib/calibration
with runtime validators and unit tests. No calibration logic yet.

Co-authored-by: Cursor <cursoragent@cursor.com>
@JSONbored
JSONbored merged commit b4efca9 into JSONbored:main Jul 6, 2026
3 checks passed
JSONbored added a commit that referenced this pull request Jul 6, 2026
…ouched

test/unit/check-miner-package.test.ts and test/unit/miner-calibration-types.test.ts
are self-contained w.r.t. root src/** (same trust boundary as the existing
mcpCliHarness filter), yet ran unconditionally on every PR that touched ANY
backend path -- virtually all of them, since test/** alone qualifies. Every
such PR paid for a real npm pack --dry-run of packages/gittensory-miner, and a
miner-only breakage (#3704's nested lib/calibration/ directory) blocked every
subsequent unrelated PR's CI instead of staying contained to PRs that actually
touch the package.

Add a minerTestHarness paths-filter output and a SKIP_MINER_TEST_HARNESS
exclude branch in the "Test with coverage" step, mirroring the existing
SKIP_MCP_CLI_HARNESS pattern exactly. Push events are unaffected -- the full
suite always runs on main to keep the coverage baseline solid.
JSONbored added a commit that referenced this pull request Jul 6, 2026
…3778)

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
JSONbored added a commit that referenced this pull request Jul 6, 2026
…ouched (#3775)

test/unit/check-miner-package.test.ts and test/unit/miner-calibration-types.test.ts
are self-contained w.r.t. root src/** (same trust boundary as the existing
mcpCliHarness filter), yet ran unconditionally on every PR that touched ANY
backend path -- virtually all of them, since test/** alone qualifies. Every
such PR paid for a real npm pack --dry-run of packages/gittensory-miner, and a
miner-only breakage (#3704's nested lib/calibration/ directory) blocked every
subsequent unrelated PR's CI instead of staying contained to PRs that actually
touch the package.

Add a minerTestHarness paths-filter output and a SKIP_MINER_TEST_HARNESS
exclude branch in the "Test with coverage" step, mirroring the existing
SKIP_MCP_CLI_HARNESS pattern exactly. Push events are unaffected -- the full
suite always runs on main to keep the coverage baseline solid.
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

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

Development

Successfully merging this pull request may close these issues.

chore(miner-selfimprove): scaffold packages/gittensory-miner calibration module directory + shared types

3 participants