Skip to content

query: add COMMIT entry to corpus parity _FIELD_TO_KIND (#81) - #97

Merged
IceRhymers merged 1 commit into
integration/search-hardening-and-ci-integrityfrom
feat/81-parity-commit-field-kind
Jul 24, 2026
Merged

query: add COMMIT entry to corpus parity _FIELD_TO_KIND (#81)#97
IceRhymers merged 1 commit into
integration/search-hardening-and-ci-integrityfrom
feat/81-parity-commit-field-kind

Conversation

@IceRhymers

Copy link
Copy Markdown
Owner

Refs #81

What & why

tests/unit/test_query_corpus_parity.py's _FIELD_TO_KIND map was missing a "commit": TokenKind.COMMIT entry, even though app/query/parser.py supports commit: as a first-class field. Any commit: corpus entry added to the shared Python/TS parity corpus would trigger a latent KeyError('commit') in test_safe_entries_tokenize_to_the_corpus_atoms — this closes that gap and proves it with a real corpus entry rather than leaving it as a theoretical hole.

Changes

  • tests/unit/test_query_corpus_parity.py — add "commit": TokenKind.COMMIT, to _FIELD_TO_KIND, positioned after "branch" to match parser.py's _FIELD_KINDS ordering.
  • webui/frontend/src/utils/queryModel.corpus.json — append two safe commit: entries (lowercase hex hashes, to stay valid under Python's hash-lowering + hex-validation and TS's raw-case, any-bareword acceptance):
    • commit:abc1234 (single atom)
    • repo:acme commit:abc1234 foo (three atoms, exercises commit: alongside other fields)

Test-only change; no production code touched.

TDD proof

  • Step A (corpus entries added, map entry not yet added): make testKeyError: 'commit' in test_safe_entries_tokenize_to_the_corpus_atoms[commit:abc1234] and [repo:acme commit:abc1234 foo] — 2 failed / 1059 passed. Reproduces the issue.
  • Step B (map entry added): parity suite alone → 88 passed (84 baseline + 2 new cases × 2 parametrized test functions).
  • Step C: make webui-test → TS recognize() classifies both new entries safe with identical atoms — 209 passed (209), 12 files.

Test plan (actual output)

  • make lint — pass: ruff check clean, ruff format --check (130 files already formatted), mypy app indexer webui — no issues in 35 source files.
  • make test — pass: 1061 passed, 237 deselected (parity suite alone: 88 passed).
  • make webui-test — pass: Test Files 12 passed (12), Tests 209 passed (209).
  • make test-integration — N/A: test-only change, no DB surface touched. Integration coverage (ci-lakebase.yml) is Lakebase-only and unprovisioned repo-wide; deferred to CI, not silently skipped.

Acceptance mapping

  • AC1 (map entry exists & correct): _FIELD_TO_KIND["commit"] present, ordering matches parser.py's _FIELD_KINDS.
  • AC2 (safe commit: atom exercised through atom-matching path): Step A red (KeyError) → Step B green is the proof.
  • AC3 (parity holds cross-language): make webui-test green on the same corpus; atom offsets independently hand-verified.
  • AC4 (no scope creep): diff touches exactly the 2 files above; app/, indexer/, non-corpus webui/src untouched.

Review

Independent code-reviewer pass (separate context, not self-review) against the plan's acceptance criteria: 0 findings (CRITICAL/HIGH/MEDIUM/LOW), offsets independently recomputed and confirmed correct, scope confirmed to the 2 files above. APPROVE.

Integration sequencing

Branch off origin/integration/search-hardening-and-ci-integrity, base of this PR is that integration branch (not master) — child of umbrella draft PR #96, which stays open and untouched. No sequencing dependency on sibling issues #38/#75/#80; only shared-file conflict surface is queryModel.corpus.json, a trivial append.

Add "commit": TokenKind.COMMIT to the parity test's _FIELD_TO_KIND
map and two commit: corpus entries exercised by both the Python and
TS suites, closing the latent KeyError('commit') in the safe-atom
parity test.

Refs #81
@IceRhymers
IceRhymers force-pushed the feat/81-parity-commit-field-kind branch from bb6c75a to 658e6dd Compare July 24, 2026 06:44
@IceRhymers
IceRhymers merged commit e90cac0 into integration/search-hardening-and-ci-integrity Jul 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant