Skip to content

feat(miner): leakage-safe task generation for historical replay - #3146

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

feat(miner): leakage-safe task generation for historical replay#3146
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
dhgoal:feat/miner-replay-task-generation

Conversation

@dhgoal

@dhgoal dhgoal commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements leakage-safe task generation for the historical-replay calibration harness (Closes #3011).

New module packages/gittensory-miner/lib/replay-task-generation.js selects calibration-worthy freeze points, scrubs forward references out of the frozen context, tags each point's recency pool, and returns the frozen snapshot and the revealed post-T ground truth as separate bundles. Every function is pure and deterministic — no clock, no randomness, no IO — so a given (candidate, context) always yields an identical task.

  • selectFreezePoint(candidate, thresholds) — a freeze point is eligible only with enough real history on both sides of T (minPriorCommits / minRevealedCommits); each unmet threshold is reported as a reason.
  • detectForwardReferences / scrubForwardReferences(text, context) — classify and remove references that resolve only to post-T state:
    • scrubbable (self-delimited, replaced with a fixed placeholder): #N and GitHub issues/pull deep-links with N > knownIssueMax, and raw/URL commit SHAs not in the pre-T knownCommitShas set;
    • unscrubbable (detected but left in place): a bare integer that exactly matches a known post-T issue number — a bare number can't be blanket-removed without destroying legitimate pre-T numbers, so its presence must fail the freeze point rather than be silently mangled. (A plain decimal is never misread as a SHA — SHAs must carry a hex letter.)
  • lintFrozenContext(texts, context) — the check that rejects a freeze-point candidate if any text still carries an unscrubbable forward reference after scrubbing.
  • classifyRecencyPool(candidate, { modelCutoffIso }) — records the recent/older pool provenance (ISO-8601 sorts lexicographically, so no clock is needed) for later pool-sliced scoring.
  • generateReplayTask(candidate, context, options) — one-shot: select → lint → scrub, returning frozen and revealed as separate top-level bundles (never merged, so the replay pipeline never holds both at once); ineligible or un-scrubbable candidates are rejected without producing a task.

Pure, self-contained, additive — a new foundation module alongside replay-objective-anchor. 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
  • 17 unit tests: forward-ref detection (scrubbable vs unscrubbable, pre-T kept, decimal-not-a-SHA), scrubbing + placeholder + residual, lint pass/fail, freeze-point selection thresholds, recency-pool split + defaults, and generateReplayTask eligible (frozen/revealed separation asserted) / selection-reject / unscrubbable-reject / determinism.

Safety

  • Deterministic — no clock, no randomness, no network, no IO. No secrets/wallets/hotkeys/trust/reward terms; the module scrubs GitHub issue/PR/commit references and applies threshold selection, exposing no internal scoring, reward, or trust state.

Adds freeze-point selection, forward-reference scrubbing (issue/PR/commit
references that resolve only to post-T state), recency-pool provenance, and a
one-shot generator that returns the frozen snapshot and the revealed post-T
ground truth as separate bundles so a replay run never holds both at once. All
pure and deterministic.

Closes JSONbored#3011
@dhgoal
dhgoal requested a review from JSONbored as a code owner July 4, 2026 16:44
@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:47:27 UTC

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

⏸️ Suggested Action - Manual Review

Review summary
The new replay task generation module is coherent: it selects freeze points, separates frozen/revealed bundles, scrubs self-delimited forward references, and rejects residual bare post-T issue numbers. The tests exercise the main pure paths and the package build script now syntax-checks the new module. I do not see a reachable correctness defect in the provided diff, but there are a few edge-case hardening points worth tightening before this becomes a production calibration primitive.

Nits — 5 non-blocking
  • nit: packages/gittensory-miner/lib/replay-task-generation.js:90 treats any unknown 7-40 hex token with a letter as a commit SHA, so ordinary hex identifiers in frozen prose can be over-redacted unless the caller only feeds commit-shaped fields.
  • nit: packages/gittensory-miner/lib/replay-task-generation.js:149 accepts negative threshold values because it only checks Number.isInteger, which makes a malformed threshold silently easier to satisfy instead of degrading to 0 or rejecting the candidate.
  • nit: packages/gittensory-miner/lib/replay-task-generation.js:167 relies on raw lexicographic comparison of whatever strings the caller provides; that is fine for normalized ISO-8601 UTC strings, but mixed offsets or date-only strings can classify unexpectedly.
  • packages/gittensory-miner/lib/replay-task-generation.js:90: consider requiring stronger SHA context for raw-token scrubbing, or document that the input text fields are known to contain commit prose where unknown hex tokens should be treated as leakage.
  • packages/gittensory-miner/lib/replay-task-generation.js:149: clamp threshold defaults with `Number.isInteger(value) && value >= 0 ? value : 0` to match the candidate count handling and avoid malformed negative thresholds.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #3011
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 (66262ce) to head (d667723).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3146   +/-   ##
=======================================
  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 2e8f932 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): leakage-safe task generation from real historical outcomes

1 participant