Skip to content

feat: enhance string literal extraction and documentation matching#26

Merged
oarisur merged 1 commit into
mainfrom
drift-detection-fix
May 27, 2026
Merged

feat: enhance string literal extraction and documentation matching#26
oarisur merged 1 commit into
mainfrom
drift-detection-fix

Conversation

@oarisur
Copy link
Copy Markdown
Owner

@oarisur oarisur commented May 27, 2026

  • Added a new function extractStringLiterals in diff-parser.ts to capture meaningful string literals from changed lines, filtering out common non-architectural strings.
  • Updated parsePRFiles to include extracted string literals alongside changed symbols.
  • Introduced a regex in doc-extractor.ts to capture quoted string values from documentation, aiding in matching diffs that change string literals.
  • Modified findCandidateSections to incorporate changed literals from the diff for improved section scoring.
  • Increased the threshold for candidate section matching in drift-detector.ts from 3 to 6 to refine detection accuracy.
  • Updated ChangedFile interface in types.ts to include changedLiterals for better data structure representation.

- Added a new function `extractStringLiterals` in `diff-parser.ts` to capture meaningful string literals from changed lines, filtering out common non-architectural strings.
- Updated `parsePRFiles` to include extracted string literals alongside changed symbols.
- Introduced a regex in `doc-extractor.ts` to capture quoted string values from documentation, aiding in matching diffs that change string literals.
- Modified `findCandidateSections` to incorporate changed literals from the diff for improved section scoring.
- Increased the threshold for candidate section matching in `drift-detector.ts` from 3 to 6 to refine detection accuracy.
- Updated `ChangedFile` interface in `types.ts` to include `changedLiterals` for better data structure representation.
@github-actions
Copy link
Copy Markdown

🧠 Knowledge Diff — Rationale Drift Detected

I found 2 documentation drift issue(s) in this PR. The code changed, but the docs didn't keep up.


🔴 __tests__/fixtures/diffs.tsREADME.mdConfiguration

Definite contradiction: The documentation states the default OpenAI model is gpt-4o, but the code has changed it to gpt-4o-mini.

Doc still says:
"gpt-4o / claude-3-5-sonnet-20241022 / gemini-2.5-flash"

Suggested update:

- `gpt-4o` / `claude-3-5-sonnet-20241022` / `gemini-2.5-flash`
+ `gpt-4o-mini` / `claude-3-5-sonnet-20241022` / `gemini-2.5-flash`

🔴 dist/index.jsREADME.mdWhat It Does

Definite contradiction: The documentation states that Knowledge Diff reads 'what functions changed, what lines were added/removed' from the code diff. However, the code now explicitly extracts 'meaningful string literal values' from changed lines, which is a new type of information being processed.

Doc still says:
"what functions changed, what lines were added/removed"

Suggested update:

- what functions changed, what lines were added/removed
+ what functions, string literals, and lines were added/removed

No drift detected in 10 other changed file(s).

📝 Auto-patch available: I've opened PR #27 with suggested doc updates — review and merge when ready.

🧠 knowledge-diff • 27 candidate pair(s) checked

@oarisur oarisur merged commit e0cd7d8 into main May 27, 2026
@oarisur oarisur deleted the drift-detection-fix branch May 27, 2026 09:48
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