feat(miner): capture bounded candidate context in eligibility-exclusion fired events#8556
feat(miner): capture bounded candidate context in eligibility-exclusion fired events#8556kai392 wants to merge 1 commit into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #8556 +/- ##
==========================================
- Coverage 92.50% 88.62% -3.89%
==========================================
Files 794 98 -696
Lines 79557 22952 -56605
Branches 24037 3957 -20080
==========================================
- Hits 73597 20341 -53256
+ Misses 4800 2433 -2367
+ Partials 1160 178 -982
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Eligibility-exclusion fired events recorded only ruleId/targetKey/outcome, so a later backtest had no way to reconstruct why a candidate was excluded. Adds bounded labels/assignees/owner metadata (50/25 entries, 200 chars each) with a truncated flag when a cap fires. Absent fields are omitted entirely so "not captured" stays distinguishable from "genuinely empty", and a candidate with no context reproduces the pre-change event shape exactly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
7f96136 to
46d3f97
Compare
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-24 20:46:52 UTC
Review summary Nits — 5 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
|
Investigating what's happening with codecov/patch showing 0%/99% on the past few PR closures. No need to reopen, will re-review shortly. |
|
Reopening: this PR was auto-closed on a phantom codecov/patch (0%/99%) failure — a CI bug (in-place package build output shadowing the .ts sources during the coverage run), not a problem with this PR. Fixed in #8564; updating the branch now to get a fresh run under the fixed workflow. |
JSONbored
left a comment
There was a problem hiding this comment.
Issue was solved already, closing.
|
Closing note: the original auto-close was the CI bug fixed in #8564, not a fault in this PR — but while that was being resolved, a competing implementation of #8544 (#8561) was reviewed and merged, and the issue is now closed. Standard one-shot competition outcome; the branch conflict with main is that landed change. #8543, #8320, and the other open calibration issues are still up for grabs. |
Fixes #8544
Root cause
recordEligibilityExclusionSignals(discover-cli.ts) recorded onlyruleId/targetKey/outcome, so a fired event preserved that a candidate was excluded but nothing about what it looked like. Thelabels/assignees/ownerfields are already present at runtime on the filter's excluded entries viaEligibilityExclusion<T>'s generic passthrough — they were simply dropped.Fix approach
Widened the parameter type so each entry's
candidatecarries the optional fields, and passed them straight through — no new computation at the call site, andcontribution-profile-filter.tsis untouched as the issue requires.buildCandidateContextMetadataapplies the exact caps: 50 labels, 25 assignees, 200 characters per string.truncated: trueis added only when a cap actually fires, and is omitted otherwise.Two deliberate details:
nulls, no empty-array placeholders. So "we captured nothing here" stays distinguishable from "this candidate genuinely had no labels". An explicitly empty array is preserved as[], which is different information, and there's a test pinning that distinction.metadatakey, reproducing the pre-change event shape byte-for-byte rather than emitting an empty object.Dry-run capture and the best-effort discipline (swallowed store-init and per-write failures) are unchanged — metadata construction is pure and adds no new failure path.
Coverage
Both arms of every cap, as specified: labels at 50 vs 51, assignees at 25 vs 26, string at 200 vs 201 chars, plus an over-long
owner, presence/omission of each field, the empty-vs-absent distinction, and the no-context path.Zero uncovered lines and zero uncovered branches across the diff. While verifying that I found one of my own dead branches — routing the single
ownervalue through the list helper left an unreachable?? ""fallback — so I clamped it directly instead of writing a test for an impossible path.Two things worth the reviewer's attention
1.
codecov/patchwill likely report0.00%here, and it is not a real coverage gap. CI'svalidate-testsjob runsBuild miner CLIbeforeTest with coverage, solib/*.jsexists and every root test imports the.jsspecifier — v8 attributes coverage to the built.jswhile this diff is on the.ts. Measured locally against the.ts(with the compiled output removed, reproducing CI's.js→.tsresolution), the patch is fully covered. This is the same attribution defect described by #8346/#8347/#8348. I applied the#8479root-vitest mirror precedent the issue points to — these tests already live in roottest/unit/— but that remedy fixes engine modules, which build to a separatedist/; the miner compiles.ts→.jsin place, so source and artifact share a path and no contributor-side import can separate them.2. Local suite note.
test/unit/miner-discover-cli.test.tshas 2 failures on my Windows checkout (discover --helpand the usage-error exit) — both subprocess-spawn CLI tests. The count is identical on unmodifiedec6f6e6f, verified by stashing this change and re-running, so they aren't introduced here. My 9 added tests pass; the file goes 70 → 79 passing.Validation
npm run typecheckclean;oxlintclean on all changed linesgit diff --check upstream/main HEADclean; branch cut from currentmain(ec6f6e6f)