test(engine): make goal-model's computeLaneFit coverage visible to Codecov - #8437
Conversation
…decov `packages/loopover-engine/src/goal-model.ts`'s `computeLaneFit` (and its hand-rolled `compileGlobMatcher`) is live, load-bearing lane-fit logic consumed by `miner-goal-lane-fit.ts` and `opportunity-metadata.ts`, fully exercised by the engine package's own `node --test` suite. But that runner is not part of the root vitest run Codecov reads `codecov/patch` from, so the module reports as ~0% covered despite being genuinely tested (same blind spot as JSONbored#6250). Add a root-level vitest twin that imports `computeLaneFit` via the engine barrel and re-exercises all four precedence rules plus every glob-matcher branch (`*` single-segment, bare `**`, `**/` optional prefix, `?`, literal regex metachar, backslash normalization, case-insensitivity, empty pattern, empty path). Mirrors the sibling twin `test/unit/calibration-dashboard.test.ts`. Brings the source to 100% line and 100% of every reachable branch; the only two uncovered arms are the defensive `?? ""` fallbacks on index reads (`ch`/`path`, typed `string | undefined` only because of `noUncheckedIndexedAccess`), which cannot fire at runtime without a type-violating input or a source change the issue forbids. Also document the root mirror in the engine package README, next to the existing Codecov-mirror note added for JSONbored#8349 — the same doc touch the merged twin PR for JSONbored#8349 used, and it keeps this a full-coverage CI run (a root-`test/**`-only diff is treated as a scoped, coverage-artifact-free run whose shard blobs never reach the merge step). Closes JSONbored#8344
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8437 +/- ##
===========================================
+ Coverage 59.67% 92.44% +32.76%
===========================================
Files 791 791
Lines 79293 79294 +1
Branches 23950 23950
===========================================
+ Hits 47322 73305 +25983
+ Misses 28227 4858 -23369
+ Partials 3744 1131 -2613
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-24 13:31:29 UTC
Review summary Nits — 5 non-blocking
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.
|
Closes #8344
Summary
packages/loopover-engine/src/goal-model.ts'scomputeLaneFit(and its hand-rolledcompileGlobMatcher) is live, load-bearing lane-fit logic — consumed byminer-goal-lane-fit.tsandopportunity-metadata.ts'scomputeMetadataLaneFit, re-exported from the engine barrel — and is fully exercised by the engine package's ownnode --testsuite (packages/loopover-engine/test/goal-model.test.ts). But that runner is not part of the rootvitestrun Codecov readscodecov/patchfrom, so the module reports as ~0% covered in Codecov's eyes despite being genuinely tested. Same blind spot as fix(ci): review-enrichment's real node:test coverage is invisible to Codecov (83 of 83 files effectively unmeasured) #6250.test/unit/goal-model.test.ts, importingcomputeLaneFitvia the engine barrel (../../packages/loopover-engine/src/index) and re-exercising every scenario the package suite covers — mirroring the sibling twintest/unit/calibration-dashboard.test.ts.packages/loopover-engine/src/**orpackages/loopover-engine/test/**.Covered, per the issue's requirements: all four
computeLaneFitprecedence rules (hard veto on a blocked path and independently a blocked label; neutral0.5when neitherwantedPathsnorpreferredLabelsis configured;0when a dimension is configured but none match; partial credit — one active matching →1, two active with one →0.5, both →1), and the glob matcher (*single-segment / does-not-cross-/asserted both ways, bare**crossing/,**/optional prefix with zero and one-plus segments,?match and non-match, a literal regex metacharacter matched literally, backslash normalization, path and label case-insensitivity, empty-pattern and empty-path guards).Why the README change (please read before grading scope)
A pure
test/**-only diff that touches nopackages/loopover-engine/**path is classified by CI as a scoped, coverage-artifact-free run: each test shard runsvitest --changed=origin/main --coverage.all=false, produces an emptycoverage/lcov.info(no changedsrc/**), and therefore skips uploading its coverage blob ("scoped run passed but exercised no src/** files -- skipping coverage artifacts for this shard"). With zerocoverage-blob-shard-*artifacts, thevalidate-tests-mergejob then fails withENOENT … all-blob-reports, which failsvalidateand auto-closes the PR — exactly what happened to my first attempt at this pattern.The merged twin PR for #8349 (
test/unit/reviewer-consensus-calibration.test.ts) avoided this by also adding a one-paragraph note topackages/loopover-engine/README.md. Touching an engine-package path flips CI onto the full-coverage run, whose shards upload real blobs and letvalidate-tests-mergepass. This PR follows that established, merged precedent: the README note is genuinely useful (it documents why the root mirror exists) and it keeps CI on the full-coverage path. It adds zerosrc/**production lines, socodecov/patchstill has nothing on this diff to grade.Coverage note (honest)
npm run test:coveragereportsgoal-model.tsat 100% statements, functions, and lines, and 100% of every reachable branch (46/48 = 95.83% raw). The two uncovered arms are the defensive?? ""fallbacks on index reads —String(path ?? "")(line 31, in thenormalizePathForMatchhelper) and/…/.test(ch ?? "")(line 62, incompileGlobMatcher). Bothch(a bounded string index) andpathare typedstring | undefinedonly because the repo setsnoUncheckedIndexedAccess: true; at runtime the?? ""right arm cannot fire without a type-violating input, and reaching it would require editinggoal-model.ts— which this test-only issue forbids. Every legitimately reachable branch is covered and the source is left untouched.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.md; does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #8344.Validation
git diff --check— clean.npm run actionlint— N/A: no workflow / composite-action changes.npm run typecheck— green (after building@loopover/engine, as the roottest:cisequence does before typecheck).npm run test:coveragelocally — the new file passes (20 tests) with the coverage described above.npm run test:workers— N/A: no worker code changed.npm run build:mcp/npm run test:mcp-pack— N/A: no MCP changes.npm run ui:openapi:check/npm run ui:lint/npm run ui:typecheck/npm run ui:build— N/A: no UI, API, or OpenAPI surface changed.npm audit --audit-level=moderate— not run locally (sandbox audit endpoint returns a lockfile 400); no dependency changes, so it cannot affect the audit. CI runs it against a clean install.If any required check was skipped, explain why:
Safety
CHANGELOG.mdnot edited (not a release-prep PR).Notes
computeLaneFitfrom the engine barrel, not a relative path into the source file, matching every existing sibling root-level engine test.goal-model.tswas changed, and its ownnode --testsuite was left untouched, as the issue requires.