Skip to content

feat(miner): deterministic objective-anchor scoring for replayed plans - #3141

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
dhgoal:feat/miner-replay-objective-anchor
Jul 4, 2026
Merged

feat(miner): deterministic objective-anchor scoring for replayed plans#3141
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
dhgoal:feat/miner-replay-objective-anchor

Conversation

@dhgoal

@dhgoal dhgoal commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the deterministic structural half of the historical-replay calibration score (Closes #3012).

New module packages/gittensory-miner/lib/replay-objective-anchor.js compares what the miner's replayed plan/PR targeted against what the revealed post-T history actually changed, and returns a reproducible [0, 1] objective-anchor score plus a full audit breakdown. There is no LLM call in its path — given the same two feature sets it is byte-for-byte reproducible.

  • extractReplayTargetFeatures(plan) — structural features of the replayed plan/PR: the sorted, de-duplicated set of modules touched (a path's directory) and its change kind (explicit changeKind wins, else classified from the Conventional-Commit title).
  • extractRevealedFeatures(history) — the same for the revealed post-T history (a list of commits/PRs; a single object is tolerated): modules unioned, change kinds collected into a set.
  • scoreObjectiveAnchor(replay, revealed)MODULE_OVERLAP_WEIGHT * jaccard(modules) + CHANGE_KIND_WEIGHT * kindMatch (weights 0.7/0.3, summing to 1). Disjoint modules + unmatched kind floor at 0; both-empty divides-by-zero-safely to 0 — a zero-overlap comparison is a score floor, not an error.
  • computeObjectiveAnchor({ replayPlan, revealedHistory }) — one-shot entry point returning the score together with both extracted feature sets, so a low score is auditable after the fact without re-running extraction.

Change kinds collapse onto a frozen vocabulary (feature/fix/refactor/docs/test/chore/perf/build/ci/style/other); an unknown prefix degrades to other rather than throwing.

Pure, self-contained, additive — a new foundation module alongside opportunity-ranker. No existing module, CLI surface, or dependency changes; no src/** touched.

Scope

Validation

  • npm run build --workspace @jsonbored/gittensory-miner (node --check, incl. the new module)
  • npm run typecheck
  • git diff --check; command-reference:check + docs:drift-check clean
  • 20 unit tests: full overlap → 1, zero overlap → 0 (no throw), partial-module-path overlap (Jaccard), module/kind contribution split, both-empty floor, malformed-input normalization, byte-for-byte determinism, and the computeObjectiveAnchor end-to-end audit shape.

Safety

  • Deterministic — no clock, no randomness, no network, no model call. No secrets/wallets/hotkeys/trust/reward terms; the score is a structural module/change-kind comparison and exposes no internal scoring, reward, or trust state.

Adds the structural half of the historical-replay calibration score: it
compares the modules and change-kind a replayed plan/PR targeted against what
the revealed post-T history actually changed, returning a reproducible [0, 1]
score with a full audit breakdown and no LLM call in its path.

Closes JSONbored#3012
@dhgoal
dhgoal requested a review from JSONbored as a code owner July 4, 2026 16:19
@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:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 4, 2026
@loopover-orb

loopover-orb Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-04 16:25:13 UTC

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

⏸️ Suggested Action - Manual Review

Review summary
This adds a self-contained objective-anchor scorer for replay calibration, with deterministic extraction, scoring, audit breakdowns, TypeScript declarations, package build coverage, and focused unit tests. The core Jaccard/module weighting path is coherent, handles malformed inputs defensively, and the tests exercise the meaningful scoring edges including empty sets, partial overlap, explicit kind precedence, and reproducibility. I do not see a reachable correctness defect in the visible diff.

Nits — 4 non-blocking
  • nit: packages/gittensory-miner/lib/replay-objective-anchor.js:52 treats a directory-shaped path like `src/a/` as module `src` after trimming the trailing slash, so either document that `pathsTouched` must be file paths or normalize directory inputs deliberately.
  • nit: packages/gittensory-miner/lib/replay-objective-anchor.js:135 only accepts already-normalized lowercase `changeKind` values in `scoreObjectiveAnchor`, while extraction accepts case-insensitive explicit kinds; consider reusing the same normalization so the public scoring function is less surprising when called directly.
  • packages/gittensory-miner/lib/replay-objective-anchor.js:52: add a test or comment pinning the file-path-only contract for `pathsTouched`, or change `pathToModule` to preserve directory inputs intentionally.
  • packages/gittensory-miner/lib/replay-objective-anchor.js:135: factor explicit-kind normalization into a helper used by both `resolveChangeKind` and `scoreObjectiveAnchor` to keep the public API behavior consistent.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #3012
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: 51 registered-repo PR(s), 30 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor dhgoal; Gittensor profile; 51 PR(s), 0 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: dhgoal
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 51 PR(s), 0 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

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.09%. Comparing base (fecae8c) to head (c839f7b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3141   +/-   ##
=======================================
  Coverage   96.09%   96.09%           
=======================================
  Files         265      265           
  Lines       29088    29088           
  Branches    10595    10595           
=======================================
  Hits        27951    27951           
  Misses        493      493           
  Partials      644      644           
🚀 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 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.

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

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

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(miner): objective-anchor scoring for replayed plans against revealed history

1 participant