Skip to content

Pin the negation of '~or' in SQLite search (DID-matlab#237) - #107

Merged
stevevanhooser merged 1 commit into
mainfrom
claude/did-negated-or
Oct 24, 2026
Merged

stevevanhooser merged 1 commit into
mainfrom
claude/did-negated-or

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Companion to VH-Lab/DID-matlab#238, which fixes VH-Lab/DID-matlab#237. Merge that PR first, with a merge commit, so the hash recorded here stays on DID-matlab main.

What changes

No Python code changes. SQLiteDB._search_doc_ids already negates a ~or (universe - matched, where the universe is the candidates when the search is restricted to them), and _base_id_lookup_values doesn't treat a ~or as a base.id lookup. MATLAB was the one that disagreed.

  • tests/test_negated_or.py has the same cases as MATLAB's new did.unittest.TestNegatedOr: a top-level ~or, a ~or nested in an OR, a ~or inside an AND (restricted candidate path, and the test checks that path never lists the whole branch), and a ~or of base.id lookups. Each search is compared with field_search, both with and without the search indexes. I checked that all four tests fail when the negation in _search_doc_ids is disabled.
  • Bridge YAML (database): matlab_last_sync_hash changes from e4e02dc to 2c9d8fa7 (the DID-matlab#238 commit that touches database.m). A decision_log note says why no Python file changed.

Pre-existing issue in the bridge YAML (not fixed here)

The database entry has two decision_log: keys, at about lines 49 and 967. YAML keeps the last one, so the first block is never parsed. That first block holds the DID-matlab #229 / 0de9cf2 / #233 / #235-merge notes. I put my note in the effective (second) block, because test_bridge_contract's moved-hash check reads that one. Merging the two blocks is probably worth a separate small PR.

Checks run locally

  • black --check src tests: clean
  • ruff check src tests: clean
  • pytest: 845 passed, 10 skipped, 1 xfailed
  • bin/check_bridge_coverage.py --check file/hash/status/drift/member/missing against an unshallowed DID-matlab checkout of claude/did-negated-or: 0 problems each

Generated by Claude Code

DID-matlab's search_doc_ids searched a '~or' as a plain 'or'; DID-matlab
2c9d8fa7 fixes that. SQLiteDB._search_doc_ids already took the complement,
so no Python code changes. tests/test_negated_or.py mirrors MATLAB's new
did.unittest.TestNegatedOr, and the database bridge entry moves to
2c9d8fa7 with a decision_log note saying why nothing is ported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MroTijyNKsCMqFHpXFbpc
@stevevanhooser
stevevanhooser merged commit 6609e84 into main Oct 24, 2026
7 checks passed
@stevevanhooser
stevevanhooser deleted the claude/did-negated-or branch October 24, 2026 20:51
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.

SQLite search ignores the negation of '~or' and searches it as a plain 'or'

2 participants