Skip to content

fix: preserve Unicode marks in FTS queries#37

Merged
steipete merged 1 commit into
mainfrom
fix/fts-unicode-marks
Jun 19, 2026
Merged

fix: preserve Unicode marks in FTS queries#37
steipete merged 1 commit into
mainfrom
fix/fts-unicode-marks

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • preserve Unicode combining marks while building safe quoted FTS5 token queries
  • document the empty-string sentinel when user input has no searchable tokens
  • exercise the public helper against a real temporary SQLite FTS5 store

Root cause

PR #35 kept only Unicode letters, digits, and underscores. Decomposed graphemes therefore split at combining marks, so the generated query no longer matched SQLite's token for the original text.

Validation

  • GOWORK=off go test -count=1 ./store -run '^TestFTS5Helpers$' -v
  • GOWORK=off go test -count=1 ./...
  • GOWORK=off go test -count=1 -race ./...
  • GOWORK=off go mod tidy plus clean module diff
  • GOWORK=off go vet ./...
  • deadcode and vulnerability checks matching CI
  • staticcheck ./store/...
  • gosec on ./store/...
  • Git history and working-tree secret scans
  • autoreview: no accepted/actionable findings
  • public model-identifier gate: PASS

The SQLite proof covers punctuation, quote/operator-shaped input, precomposed and decomposed Unicode, multiple scripts, empty/all-punctuation input, and unchanged legacy helper behavior. It uses only a temporary database.

@clawsweeper

clawsweeper Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed June 19, 2026, 8:39 AM ET / 12:39 UTC.

Summary
The PR updates the shared store FTS5 token query helper to preserve Unicode combining marks and expands its temp SQLite coverage.

Reproducibility: yes. Source inspection of current main shows combining marks are not retained by FTS5TokenQuery, and the PR adds a focused decomposed-Unicode SQLite regression case.

Review metrics: 2 noteworthy metrics.

  • Changed files: 3 files affected. The functional change is small, but one touched file is release-owned and now conflicts.
  • Current merge conflicts: 1 file conflicts. Maintainers need to know the merge blocker is isolated to CHANGELOG.md, not the store implementation.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted terminal output or logs showing the focused SQLite FTS helper test after the fix.
  • Remove the CHANGELOG.md edit and rebase or update the branch against current main.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body lists validation commands and CI-style test coverage, but it does not include after-fix terminal output, logs, screenshots, recordings, or linked artifacts from a real run. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The PR is currently conflicting against current main in CHANGELOG.md; the functional store files merge cleanly in git merge-tree.
  • [P1] The only after-fix proof in the PR body is validation/test description and CI, so the external-PR real behavior proof gate still needs redacted terminal output, logs, or an equivalent artifact.

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow store helper fix after removing the release-owned changelog conflict and adding contributor-supplied real behavior proof.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Needs contributor-supplied real behavior proof and a small conflict cleanup before maintainers can merge; automation should not repair the branch before the proof gate is satisfied.

Security
Cleared: No concrete security or supply-chain concern found; the diff changes no dependencies, workflows, secrets, install scripts, or broad execution paths.

Review findings

  • [P3] Remove the release-owned changelog edit — CHANGELOG.md:5
Review details

Best possible solution:

Land the narrow store helper fix after removing the release-owned changelog conflict and adding contributor-supplied real behavior proof.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection of current main shows combining marks are not retained by FTS5TokenQuery, and the PR adds a focused decomposed-Unicode SQLite regression case.

Is this the best way to solve the issue?

Yes for the functional code path. Adding unicode.IsMark and testing through a temp FTS5 table is the narrow maintainable fix, but the changelog conflict and missing proof should be resolved first.

Full review comments:

  • [P3] Remove the release-owned changelog edit — CHANGELOG.md:5
    CHANGELOG.md is release-owned for normal PRs, and this added line is also the only current-main merge conflict from git merge-tree. Please drop the entry and leave release notes to the release process.
    Confidence: 0.91

Overall correctness: patch is correct
Overall confidence: 0.82

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against e74b0c4130c9.

Label changes

Label changes:

  • add P2: This is a normal limited-blast-radius bug fix for shared FTS query behavior.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 🛠️ actively grinding: The PR author has acted after the latest ClawSweeper review and work remains. Needs real behavior proof before merge: The PR body lists validation commands and CI-style test coverage, but it does not include after-fix terminal output, logs, screenshots, recordings, or linked artifacts from a real run. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This is a normal limited-blast-radius bug fix for shared FTS query behavior.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 🛠️ actively grinding: The PR author has acted after the latest ClawSweeper review and work remains. Needs real behavior proof before merge: The PR body lists validation commands and CI-style test coverage, but it does not include after-fix terminal output, logs, screenshots, recordings, or linked artifacts from a real run. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

What I checked:

  • Current main still drops Unicode marks: At current main, FTS5TokenQuery keeps letters, digits, and _, but not Unicode marks, so decomposed graphemes are split before being quoted. (store/fts.go:50, e74b0c4130c9)
  • PR adds the narrow functional fix: The head commit adds unicode.IsMark(r) to the token predicate and documents the empty-query sentinel. (store/fts.go:51, 3ff8e9ed206b)
  • PR adds real temp SQLite regression coverage: The test inserts precomposed, decomposed, multi-script, punctuation, and operator-shaped inputs into a temporary FTS5 table and queries through the public helper. (store/store_test.go:169, 3ff8e9ed206b)
  • Current merge conflict is release-note only: git merge-tree shows store/fts.go and store/store_test.go merge cleanly, while CHANGELOG.md conflicts against current main. (CHANGELOG.md:5, 3ff8e9ed206b)
  • GitHub reports the same mergeability blocker: gh pr view reports mergeable: CONFLICTING and mergeStateStatus: DIRTY; the visible check rollup is otherwise successful. (3ff8e9ed206b)
  • Feature history points to the prior helper PR: git blame and git log -S tie the existing token helper to the merged helper commit from the related PR. (store/fts.go:37, 9a636444e780)

Likely related people:

  • steipete: Git blame and git log -S FTS5TokenQuery show the FTS5 token helper was introduced in commit 9a63644, and adjacent store query work landed in e74b0c4. (role: introduced helper and recent store contributor; confidence: high; commits: 9a636444e780, e74b0c4130c9, 3ff7edef8b33; files: store/fts.go, store/store_test.go, store/query.go)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ff8e9ed20

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread store/fts.go
}
for _, r := range value {
if unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' {
if unicode.IsLetter(r) || unicode.IsDigit(r) || unicode.IsMark(r) || r == '_' {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid starting FTS tokens with standalone marks

When a mark follows a character that this helper discards, this predicate starts a new token from the mark. For inputs like hello ❤️ or a leading combining mark before a word, FTS5TokenQuery now emits an extra quoted mark term under implicit AND (for example, "hello" "️"), but SQLite's default FTS5 tokenizer does not index standalone marks, so otherwise matching documents are filtered out instead of ignoring the non-searchable character. Only preserve marks when they are attached to an existing token/base character.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the fix/fts-unicode-marks branch from 3ff8e9e to 5ed6342 Compare June 19, 2026 12:37
@steipete
steipete merged commit 797628a into main Jun 19, 2026
6 checks passed
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant