[PR #6791] [CLOSED] fix(analysis-view): case-insensitive search now matches Greek final sigma #7414

Closed
opened 2026-11-01 21:47:41 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6791
Author: @JingHao-Leon
Created: 10/23/2026
Status: ❌ Closed

Base: main ← Head: fix/greek-final-sigma-search


📝 Commits (1)

  • 5ae9302 fix(analysis-view): case-insensitive search now matches Greek final sigma

📊 Changes

2 files changed (+63 additions, -4 deletions)

View changed files

📝 src/domain/analysisView/environmentStateListQuery.test.ts (+49 -0)
📝 src/domain/analysisView/environmentStateListQuery.ts (+14 -4)

📄 Description

Summary

A case-insensitive search for Σ could not find a row named ΟΣ, even though the row's name contains that exact substring: Ο and ΟΣ found the row, Σ alone returned an empty page, and the query learner could not explain a recorded line either. Fixes #6750.

Problem and expected behavior

Smallest trigger: a row with name: "ΟΣ" and the query q=Σ. The violated invariant is the search contract — a case-insensitive substring search must find a row whose field contains the term as an exact substring ("ΟΣ".includes("Σ") is true on the raw strings).

Change and scope

Root cause: contains and searchFields folded both sides with plain toLowerCase, which is context-sensitive for Greek — a capital sigma at the end of a word lowercases to the final form ς (U+03C2), while the same letter standalone lowers to the medial σ (U+03C3). The folded haystack ends in ς and never matches a folded needle σ.

Fix: a shared caseFold helper (lowercase, then collapse ς→σ) applied to the term, the field values, and the fields searchFields reports. Position-independent for Greek; Latin and non-Greek text untouched (ς does not occur outside Greek text in practice). Scope: the two search functions in environmentStateListQuery.ts only; sort-key normalization (normalized) is untouched since it strips all non-ASCII already.

Contract and boundary impact

  • Semantic owner and earliest changed stage: environmentStateListQuery — the search/contains stage before listing.
  • Contribution scope fit and linked maintainer decision: not applicable — ordinary fix within existing boundaries (issue #6750).
  • CLI and MCP/tool-catalog contract: unchanged — query grammar and parameters are the same; only matching now agrees with user expectations.
  • Provider, bridge, target-format, or platform compatibility: none affected.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged — search only selects rows.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated: three in environmentStateListQuery.test.ts — q=Ο, q=Σ, q=ΟΣ each return the row, and the learner explains the folded match.
  • Base reproduction: the issue's probe script fails on main (Σ → empty page, inert choice, learner null) and passes on this branch.
  • User-visible CLI/MCP output: search results via both adapters change for Greek final-sigma terms from "not found" to "found".
  • Remaining proof gaps: Wakaru-adjacent flows were not exercised — this change is in the shared query module, not the recovery path.

Validation performed

  • npm run test:local -- src/domain/analysisView/environmentStateListQuery.test.ts — 29 passing (26 existing + 3 new).
  • The issue's probe script (production evaluateQuery / lineChoices / learnQuery): before, q=Σ → empty page and learned: null; after, q=Σ → page ["1"] and the learner explains it.
  • npm run check:fast — clean.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable — domain-layer query change.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none needed; a hypothetical field intentionally distinguishing ς from σ would now match both spellings, and no such distinction exists in the codebase today.

Author readiness

Human owner: @JingHao-Leon

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

(Left unchecked for the human owner to review and tick, per the repository's AI-agent rule and the readiness check.)

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/6791 **Author:** [@JingHao-Leon](https://github.com/JingHao-Leon) **Created:** 10/23/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/greek-final-sigma-search` --- ### 📝 Commits (1) - [`5ae9302`](https://github.com/morluto/rea/commit/5ae9302bc2d317a309cb77048d38965b36b0ba98) fix(analysis-view): case-insensitive search now matches Greek final sigma ### 📊 Changes **2 files changed** (+63 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/analysisView/environmentStateListQuery.test.ts` (+49 -0) 📝 `src/domain/analysisView/environmentStateListQuery.ts` (+14 -4) </details> ### 📄 Description ## Summary A case-insensitive search for `Σ` could not find a row named `ΟΣ`, even though the row's name contains that exact substring: `Ο` and `ΟΣ` found the row, `Σ` alone returned an empty page, and the query learner could not explain a recorded line either. Fixes #6750. ## Problem and expected behavior Smallest trigger: a row with `name: "ΟΣ"` and the query `q=Σ`. The violated invariant is the search contract — a case-insensitive substring search must find a row whose field contains the term as an exact substring (`"ΟΣ".includes("Σ")` is true on the raw strings). ## Change and scope Root cause: `contains` and `searchFields` folded both sides with plain `toLowerCase`, which is context-sensitive for Greek — a capital sigma at the **end of a word** lowercases to the final form ς (U+03C2), while the same letter standalone lowers to the medial σ (U+03C3). The folded haystack ends in ς and never matches a folded needle σ. Fix: a shared `caseFold` helper (lowercase, then collapse ς→σ) applied to the term, the field values, and the fields `searchFields` reports. Position-independent for Greek; Latin and non-Greek text untouched (ς does not occur outside Greek text in practice). Scope: the two search functions in `environmentStateListQuery.ts` only; sort-key normalization (`normalized`) is untouched since it strips all non-ASCII already. ## Contract and boundary impact - Semantic owner and earliest changed stage: `environmentStateListQuery` — the search/`contains` stage before listing. - Contribution scope fit and linked maintainer decision: not applicable — ordinary fix within existing boundaries (issue #6750). - CLI and MCP/tool-catalog contract: unchanged — query grammar and parameters are the same; only matching now agrees with user expectations. - Provider, bridge, target-format, or platform compatibility: none affected. - Evidence, artifact, provenance, or reconstruction contract: unchanged — search only selects rows. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage - Tests added or updated: three in `environmentStateListQuery.test.ts` — `q=Ο`, `q=Σ`, `q=ΟΣ` each return the row, and the learner explains the folded match. - Base reproduction: the issue's probe script fails on main (Σ → empty page, inert choice, learner null) and passes on this branch. - User-visible CLI/MCP output: search results via both adapters change for Greek final-sigma terms from "not found" to "found". - Remaining proof gaps: Wakaru-adjacent flows were not exercised — this change is in the shared query module, not the recovery path. ## Validation performed - `npm run test:local -- src/domain/analysisView/environmentStateListQuery.test.ts` — 29 passing (26 existing + 3 new). - The issue's probe script (production `evaluateQuery` / `lineChoices` / `learnQuery`): before, `q=Σ` → empty page and `learned: null`; after, `q=Σ` → page `["1"]` and the learner explains it. - `npm run check:fast` — clean. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable — domain-layer query change. - Package or release metadata impact: none. - Security, privacy, process, or containment review: none needed; a hypothetical field intentionally distinguishing ς from σ would now match both spellings, and no such distinction exists in the codebase today. ## Author readiness Human owner: @JingHao-Leon - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. *(Left unchecked for the human owner to review and tick, per the repository's AI-agent rule and the readiness check.)* ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:47:41 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7414
No description provided.