Skip to content

core: reuse unchanged CLI results for date boundaries and vector statistics #2964

Closed

Description

@schlessera

Context

Part of #1849. Source-verified finding from the 2026-10-25 multi-agent test-value audit at c670449d3bf1b0639e50ce554d728961f4313add. Broad inventory screening was followed by detailed inspection of this finding; this is not a claim of exhaustive manual review or measured CI savings.

Classification: Confirmed redundant invocations; low implementation risk.

Evidence and exact tests

  • The search helper always creates a real process (runCli, packages/core/tests/cli-harness.ts:152-164; search, packages/core/tests/search-dates.test.ts:78-83). The indexed fixture is established once (beforeAll, packages/core/tests/search-dates.test.ts:61-74) and is not edited by the following reader cases.
  • In each of the full-text and filter-only lanes, --updated-since includes its own date and --updated-since excludes the day before issue the same query (packages/core/tests/search-dates.test.ts:89-94). One result supplies both assertions.
  • --updated-before includes its own date, --updated-before includes a timestamp on its own date, and --updated-before excludes the day after likewise issue one identical query three times (packages/core/tests/search-dates.test.ts:95-103).
  • The --deadline-from inclusion/exclusion pair repeats one query (packages/core/tests/search-dates.test.ts:104-109), as does the --deadline-to pair (packages/core/tests/search-dates.test.ts:110-115).
  • Consequently, this block can change from 22 to 12 CLI query launches while keeping every boundary assertion and both lanes. Do not collapse the two lanes: they reach distinct query construction/execution, even though filters are shared.
  • A separate exact duplicate is a full table reports the count and a coverage that is not null (packages/core/tests/cli-vector-stats.test.ts:145-150). Its stats(embedded) call repeats the unchanged embedded fixture already examined by reports the exact count the fixture staged (packages/core/tests/cli-vector-stats.test.ts:110-118). The latter's embeddingCoverage === 1 is stronger than non-null, and its literal CORPUS_VECTORS === 28 is stronger than positive. The fixture is staged once (packages/core/tests/cli-vector-stats.test.ts:41-54); the absent-table operation affects a different root. This is one safely removable additional stats launch.

Production ownership

CLI flag mapping is in searchCommand (packages/core/src/cli/commands/search.ts:63-80). Date comparisons are owned by DATE_FILTERS and buildFilters (packages/core/src/lib/search-engine.ts:102-107, 135-180, especially 171-175). Filter-only results use the query starting at packages/core/src/lib/search-engine.ts:221; full-text construction starts at ftsSearchInSnapshot, packages/core/src/lib/search-engine.ts:415. Date ordering additionally reaches sortByDate, packages/core/src/lib/search-engine.ts:1118-1133.

Independent value to keep

Both lanes, all four flag spellings, inclusive/exclusive boundaries, timestamp-on-day evidence, offset and invalid stored dates, deadline missingness, sort-before-limit, and the MCP cases at packages/core/tests/search-dates.test.ts:236-262. Keep the vector fixture's nonzero independent count, no-table vs empty-table distinction (packages/core/tests/cli-vector-stats.test.ts:130-143), and native SQLite extension failure evidence (159-175). The historical swallowed-count control is not interchangeable with a generic zero-vector smoke.

Safe plan and acceptance criteria

For each unchanged lane/query, execute it once and assert all relevant included/excluded documents together, preferably as a table of query options and labeled expectations. Delete only the weaker duplicated full-vector CLI test, or attach its label to the stronger retained case. Avoid file-global cached results that hide fixture changes. All existing behavioral assertions must have an explicit retained location; minimum reduction is 11 CLI launches. Additional repeated offset/malformed-date queries in the same file are a follow-on lead, not included in this conservative count.

Focused verification/mutation proposal

Run rtk bun run test ./packages/core/tests/search-dates.test.ts ./packages/core/tests/cli-vector-stats.test.ts. In an isolated implementation checkout, change one date operator from inclusive to strict; the matching retained inclusion assertion must fail. Remove the predicate; the matching exclusion assertion must fail. Restore, then break vector-extension loading only on the stats read connection; the retained nonzero vector assertion must fail rather than an unrelated module load.

Measured cost evidence

Four existing updated-since cases passed at 138.36, 136.63, 140.80 and 129.66 ms (545.45 ms summed case time). This only measures those four baseline cases, not the other candidate queries, and does not establish whole-CI savings.

Scope

Coalesce repeated identical read commands per immutable fixture/lane and retain the stronger nonzero vector-stat assertion.

Out of scope

Changing product behavior, public contracts, required proof gates, offline guards, runtime pins or unrelated tests. Every distinct native, security, lifecycle and adapter obligation identified above remains. This issue does not authorize deleting the surviving owner named by another audit issue.

Acceptance criteria

  • Remove at least 11 redundant CLI launches without dropping the full-text or filter-only lane, any date boundary, timestamp/sort invariant or vector-extension failure control.
  • The retained vector CLI case still pins the independent nonzero count and exact coverage; absent and empty tables remain distinct controls.
  • Record an assertion-to-owner mapping for every moved or removed case, including shared-helper obligations; do not count matching test names as proof of equivalence.
  • Run the proposed focused production mutation(s), observe failure on the intended assertion, restore, and record passing focused proof. A module-load error is not a behavioral receipt.
  • Any performance claim separates scenario/body cost, setup and total elapsed time and uses comparable observations; structural counts alone are not a speedup.

Verification

bun run test ./packages/core/tests/search-dates.test.ts ./packages/core/tests/cli-vector-stats.test.ts
bun run check:pr --base origin/main

Preserve the existing offline/keyless harness. Browser/native commands require the documented real runtime and OS-offline prerequisites; missing prerequisites are not passing or skipped proof. The mutation proposals and retained boundary checks are detailed above.

Contract impact

No integration-contract or product-behavior change is selected. This is test/proof maintenance; retain the current CLI/MCP/wire/schema/frontmatter envelopes. No release-content change is selected.

Activity

  1. added
    type: testCoverage, harness or proof work with no behaviour change.
    area: corepackages/core: the brain CLI, indexer, hybrid search, config, taxonomy, skills.
    on Oct 25, 2026
  2. added
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Oct 25, 2026
  3. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    2026-10-26 triage at main c670449d3bf1b0639e50ce554d728961f4313add: verified the cited current test/production boundary and native #1849 parent. The scope names the retained proof, exclusions, checkable acceptance criteria, focused verification and mutation requirements; no unresolved design, decision, access or reproduction prerequisite prevents starting this test-maintenance task. Set priority p2 for wanted, unscheduled work and add agent-ready. Keep native/browser/SDK qualification required by the brief as implementation proof; this source/readiness review supplies no completed repair, post-change equivalence or measured CI saving.

  4. added this to the 0.44.0 milestone on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: corepackages/core: the brain CLI, indexer, hybrid search, config, taxonomy, skills.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: testCoverage, harness or proof work with no behaviour change.

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions