You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
packages/loopover-engine/src/goal-model.ts exports computeLaneFit: the pure lane-fit scorer that compiles
a repo's MinerGoalSpec path/label preferences into a single [0, 1] score, per the precedence rules
documented in the function's own doc comment (hard veto on blockedPaths/blockedLabels → 0; neutral 0.5
when no preferences are configured; 0 when preferences are configured but none match; otherwise matchedDimensions / activeDimensions). It also contains a hand-rolled glob matcher
(compileGlobMatcher) supporting *, a bare **, a ** immediately followed by /, and ?. This is live,
load-bearing logic — it's consumed by miner-goal-lane-fit.ts and opportunity-metadata.ts's computeMetadataLaneFit, and re-exported from the engine's public barrel.
It already has a full, passing test suite at packages/loopover-engine/test/goal-model.test.ts (14
scenarios, node --test). But — same failure mode as #6250 (review-enrichment's node:test suite being
invisible to Codecov) — that suite is not part of the root vitest run Codecov reads codecov/patch from.
No file under root test/** currently exercises computeLaneFit directly (test/integration/miner-discovery-pipeline.test.ts
exercises it only indirectly, composed through the full discovery ranker, and its own header comment
explicitly says dedicated unit coverage belongs in "goal-model.test.ts" — which exists, but only as the
engine package's node:test file, not a root-level vitest one). packages/loopover-engine/src/**/*.ts is
already listed in vitest.config.ts's coverage.include, so this is a per-file coverage gap, not a wiring
gap — computeLaneFit and compileGlobMatcher report as effectively 0% covered in Codecov today despite
being one of the largest branch surfaces in the package (~29 branches across the precedence rules and the
glob compiler).
⚠️ Read this before starting. This issue is test-coverage-only. Do NOT modify packages/loopover-engine/src/goal-model.ts itself, and do NOT modify packages/loopover-engine/test/goal-model.test.ts. The only new artifact this issue calls for is one new
root-level vitest file. A PR that changes the source module's behavior does not satisfy this issue.
Requirements
Create test/unit/goal-model.test.ts using describe/it/expect from vitest, importing computeLaneFit
(and any supporting types) from "../../packages/loopover-engine/src/index" — the barrel — matching the
existing sibling pattern in test/unit/calibration-dashboard.test.ts.
Cover, at minimum, every scenario already exercised in packages/loopover-engine/test/goal-model.test.ts
(read it for the exact fixtures/assertions to mirror), including all four precedence rules from computeLaneFit's own doc comment:
Hard veto on a blocked path, and independently on a blocked label, each returning 0 even when a
wanted/preferred match is also present.
Neutral 0.5 when neither wantedPaths nor preferredLabels is configured.
0 when at least one preference dimension is configured but none match.
Partial credit: one active dimension matching → 1; two active dimensions with only one matching → 0.5; two active dimensions both matching → 1.
The glob matcher (compileGlobMatcher, reached only through computeLaneFit's path matching): a plain * (single-segment wildcard, must not cross /), a bare ** (crosses /), **/ as an optional
directory prefix (zero or more leading segments), ? (single non-/ char), a pattern containing a
literal regex-metacharacter (e.g. .), Windows-style backslash paths normalized before matching, and
case-insensitivity.
Every ??, ternary, and boolean short-circuit in computeLaneFit and compileGlobMatcher must have both
its taken and not-taken branch exercised.
Deliverables
New file test/unit/goal-model.test.ts (vitest, imports via the engine barrel).
No changes to any file under packages/loopover-engine/src/** or packages/loopover-engine/test/**.
Test Coverage Requirements
packages/loopover-engine/src/goal-model.ts is inside coverage.include in vitest.config.ts and therefore
IS subject to the 99% Codecov codecov/patch branch-counted gate — today it reports ~0% because nothing
under root test/** exercises it directly. After this PR, npm run test:coverage (run unsharded locally)
should show packages/loopover-engine/src/goal-model.ts at or near 100% line/branch coverage, including both
arms of every documented precedence rule and every glob-matcher branch.
Expected Outcome
goal-model.ts's already-real, already-tested lane-fit scoring and glob-matching logic becomes visible to
Codecov, so a future PR that changes this file's precedence rules or glob semantics is actually gated on real
coverage instead of a blind spot.
Links & Resources
packages/loopover-engine/src/goal-model.ts (module under test — do not modify)
packages/loopover-engine/test/goal-model.test.ts (the existing node:test suite to mirror scenarios from)
test/integration/miner-discovery-pipeline.test.ts (composes computeLaneFit indirectly; its own header
comment already flags dedicated unit coverage as belonging in a goal-model.test.ts-shaped file)
test/unit/calibration-dashboard.test.ts (existing root-level vitest test following the exact pattern this
issue asks for)
vitest.config.ts (coverage.include, confirms packages/loopover-engine/src/**/*.ts is already tracked)
Context
packages/loopover-engine/src/goal-model.tsexportscomputeLaneFit: the pure lane-fit scorer that compilesa repo's
MinerGoalSpecpath/label preferences into a single[0, 1]score, per the precedence rulesdocumented in the function's own doc comment (hard veto on
blockedPaths/blockedLabels→ 0; neutral 0.5when no preferences are configured; 0 when preferences are configured but none match; otherwise
matchedDimensions / activeDimensions). It also contains a hand-rolled glob matcher(
compileGlobMatcher) supporting*, a bare**, a**immediately followed by/, and?. This is live,load-bearing logic — it's consumed by
miner-goal-lane-fit.tsandopportunity-metadata.ts'scomputeMetadataLaneFit, and re-exported from the engine's public barrel.It already has a full, passing test suite at
packages/loopover-engine/test/goal-model.test.ts(14scenarios,
node --test). But — same failure mode as #6250 (review-enrichment's node:test suite beinginvisible to Codecov) — that suite is not part of the root
vitestrun Codecov readscodecov/patchfrom.No file under root
test/**currently exercisescomputeLaneFitdirectly (test/integration/miner-discovery-pipeline.test.tsexercises it only indirectly, composed through the full discovery ranker, and its own header comment
explicitly says dedicated unit coverage belongs in "
goal-model.test.ts" — which exists, but only as theengine package's node:test file, not a root-level vitest one).
packages/loopover-engine/src/**/*.tsisalready listed in
vitest.config.ts'scoverage.include, so this is a per-file coverage gap, not a wiringgap —
computeLaneFitandcompileGlobMatcherreport as effectively 0% covered in Codecov today despitebeing one of the largest branch surfaces in the package (~29 branches across the precedence rules and the
glob compiler).
Requirements
test/unit/goal-model.test.tsusingdescribe/it/expectfromvitest, importingcomputeLaneFit(and any supporting types) from
"../../packages/loopover-engine/src/index"— the barrel — matching theexisting sibling pattern in
test/unit/calibration-dashboard.test.ts.packages/loopover-engine/test/goal-model.test.ts(read it for the exact fixtures/assertions to mirror), including all four precedence rules from
computeLaneFit's own doc comment:0even when awanted/preferred match is also present.
0.5when neitherwantedPathsnorpreferredLabelsis configured.0when at least one preference dimension is configured but none match.1; two active dimensions with only one matching →0.5; two active dimensions both matching →1.compileGlobMatcher, reached only throughcomputeLaneFit's path matching): a plain*(single-segment wildcard, must not cross/), a bare**(crosses/),**/as an optionaldirectory prefix (zero or more leading segments),
?(single non-/char), a pattern containing aliteral regex-metacharacter (e.g.
.), Windows-style backslash paths normalized before matching, andcase-insensitivity.
??, ternary, and boolean short-circuit incomputeLaneFitandcompileGlobMatchermust have bothits taken and not-taken branch exercised.
Deliverables
test/unit/goal-model.test.ts(vitest, imports via the engine barrel).packages/loopover-engine/src/**orpackages/loopover-engine/test/**.Test Coverage Requirements
packages/loopover-engine/src/goal-model.tsis insidecoverage.includeinvitest.config.tsand thereforeIS subject to the 99% Codecov
codecov/patchbranch-counted gate — today it reports ~0% because nothingunder root
test/**exercises it directly. After this PR,npm run test:coverage(run unsharded locally)should show
packages/loopover-engine/src/goal-model.tsat or near 100% line/branch coverage, including botharms of every documented precedence rule and every glob-matcher branch.
Expected Outcome
goal-model.ts's already-real, already-tested lane-fit scoring and glob-matching logic becomes visible toCodecov, so a future PR that changes this file's precedence rules or glob semantics is actually gated on real
coverage instead of a blind spot.
Links & Resources
packages/loopover-engine/src/goal-model.ts(module under test — do not modify)packages/loopover-engine/test/goal-model.test.ts(the existing node:test suite to mirror scenarios from)test/integration/miner-discovery-pipeline.test.ts(composescomputeLaneFitindirectly; its own headercomment already flags dedicated unit coverage as belonging in a
goal-model.test.ts-shaped file)test/unit/calibration-dashboard.test.ts(existing root-level vitest test following the exact pattern thisissue asks for)
vitest.config.ts(coverage.include, confirmspackages/loopover-engine/src/**/*.tsis already tracked)review-enrichment)