Skip to content

fix: reject trailing tokens in lucene parser#40

Draft
mchurichi wants to merge 2 commits intomainfrom
codex/locate-and-fix-important-bugs
Draft

fix: reject trailing tokens in lucene parser#40
mchurichi wants to merge 2 commits intomainfrom
codex/locate-and-fix-important-bugs

Conversation

@mchurichi
Copy link
Owner

Motivation

  • The Lucene-style Parse function could silently accept malformed queries with trailing tokens (e.g. level:ERROR) or (level:ERROR) bar) because it did not verify the parser consumed the entire input.
  • Ensure query parsing fails fast on unexpected trailing input to avoid surprising matches and keep parser behavior strict and predictable.

Description

  • Added a post-parse validation in Parse to call skipWhitespace() and return an error if any unconsumed input remains (pkg/query/lucene.go).
  • Expanded TestParse in pkg/query/lucene_test.go with cases for dangling ) and trailing tokens to guard against regressions.
  • Committed the change with the Conventional Commit title fix: reject trailing tokens in lucene parser.

Testing

  • Added unit test cases in pkg/query/lucene_test.go exercising the new failure paths but could not run them to completion in this environment due to missing go/mise toolchain resolution; test execution was attempted with mise exec -- go test ./pkg/query and mise exec -- go test ./... and both failed because the environment could not resolve the pinned toolchain (network/tool resolution errors).
  • The change is covered by the new unit tests which should pass when run in a normal developer or CI environment with a working Go toolchain using go test ./pkg/query.

Codex Task

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Release Label Suggestion

Suggested label: release:patch
If merged now, estimated next tag: v0.4.2
Why: Conventional prefix in title/header: fix (source: PR title)

You can change this by updating PR labels before merge.

Allowed labels (exactly one required):

  • release:patch
  • release:minor
  • release:major
  • skip-release

@mchurichi mchurichi added the release:patch Bumps patch version label Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex release:patch Bumps patch version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant