fix(retrieval): keep final release in Oxford-comma version lists - #234
Open
detail-app[bot] wants to merge 1 commit into
Open
detail-app[bot] wants to merge 1 commit into
detail-app[bot] wants to merge 1 commit into
Conversation
The shorthand comparison-chain regex consumed exactly one connector per step, so an Oxford-comma enumeration ending in ", and <digit>" put two connectors in sequence; the comma matched, the next token was "and" not a digit, and the chain returned — silently dropping the final requested release (e.g. "Java SE 21, 25, and 26" extracted as [21, 25]). - widen the comma connector alternative to optionally span ", and" in one lookingAt() step so the final release is collected before the chain ends - single-connector chains (/, vs, +, &, bare and) stay untouched: the optional group only fires after a comma
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Detail bug report: View on Detail
Closes #221
Bug
QueryVersionExtractor.extractVersionNumbersparses Java release tokens from learner queries for version-evidence retrieval, source-record labelling, and guided-lesson docSet scoping. Its shorthand comparison-chain regex consumed exactly one connector perlookingAt()step, so an Oxford-comma enumeration ending in, and <digit>put two connectors in sequence: the comma matched, the next token wasand(not a digit), and the chain returned — silently dropping the final requested release.extractVersionNumbers("Java SE 21, 25, and 26")returned[21, 25], dropping26— one of the three indexed Oracle Java releases.Java 21, 22 and 25) and the all-comma form (Java 21, 22, 25) already parsed correctly.docVersions=[release]retrieval constraint and itsrequestedVersions="..."request-anchor label across all three callers (RetrievalService,ChatService,GuidedLearningService), none of which re-derive versions downstream.Fix
Widen the comma connector alternative in
SHORTHAND_VERSION_PATTERN(QueryVersionExtractor.java:17-19) to optionally span, andin a single step:"^\\s*(?:,(?:\\s*and\\b)?|and\\b|vs(?:\\.|\\b)|versus\\b|\\+|/|&)\\s*(\\d{1,3})\\b"The optional
(?:\\s*and\\b)?group only fires after a comma, so single-connector chains (/,vs,vs.,versus,+,&, bareand) are untouched. TheisPlausibleJavaRelease(>= 8)guard still absorbs low-count tails (Java 21, and 2 examplesends the chain at2), matching the existing lone-andbehavior.Testing
extractsOxfordCommaEnumerationWithoutDroppingFinalRelease) pinning the Oxford-comma form, a longer 4-release chain, and the two adjacent forms (all-comma, non-Oxfordand) that must remain unchanged.QueryVersionExtractorTestsuite (7/7), plus the three downstream consumer suites —RetrievalServiceTest(40),ChatServiceTest(7),GuidedLearningServiceCitationTest(11) — all pass with no outcome changes.make test(18 shell contract tests + full unit suite),make build(frontend production build +gradlew build -x test), andmake lint(ast-grep Java rules, Ruby SSOT checker, frontend oxlint/eslint/svelte-check, backend SpotBugs/PMD) — all green.extractVersionNumbers("Java SE 21, 25, and 26")now returns[21, 25, 26], andDocsSourceRegistry.javaApiDocumentationSourcesForReleases(...)now resolves26:java/java26-complete(previously absent).Automatic Fixes PRs can be configured here.