[PR #4021] fix(sqlite): normalize index table identifiers using ASCII folding #5995

Open
opened 2026-10-31 01:11:02 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4021
Author: @vishalsatle
Created: 10/15/2026
Status: 🔄 Open

Base: main ← Head: fix/sqlite-index-dependent-folding


📝 Commits (1)

  • 7b1e712 fix(sqlite): normalize index table identifiers using ASCII folding

📊 Changes

2 files changed (+18 additions, -8 deletions)

View changed files

📝 src/sqlite/SqliteDatabaseInspection.ts (+11 -7)
📝 tests/boundary/sqlite/sqliteDatabaseInspection.test.ts (+7 -1)

📄 Description

Summary

Indexes could end up associated with the wrong table name when the casing differed, in both selected_table and inventory scopes.

Problem and expected behavior

When an index was declared like CREATE INDEX users_email ON users(email) for table Users, SQLite resolves it via ASCII case folding and stores users in sqlite_schema.tbl_name. In both selected_table and inventory scopes, SqliteDatabaseInspection.ts previously exposed that stored tbl_name directly without attributing it to the canonical table name Users.

Change and scope

  • Renamed triggerTable to dependentTable in SqliteDatabaseInspection.ts so it can be reused for both indexes and triggers.
  • Resolved the index's table name using the current byte-aware sqliteIdentifierBytesKey.
  • Added a regression test covering both selected_table and inventory scopes.
  • Dropped the unrelated SAZ and test-project edits; the diff now only touches SqliteDatabaseInspection.ts and its boundary test.

Validation performed

  • npx vitest run tests/boundary/sqlite/sqliteDatabaseInspection.test.ts — 33 passed, 1 skipped
  • npm run check:fast — passed (typecheck and lint clean)

Author readiness

Human owner: @vishalsatle

  • 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.

🔄 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/4021 **Author:** [@vishalsatle](https://github.com/vishalsatle) **Created:** 10/15/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/sqlite-index-dependent-folding` --- ### 📝 Commits (1) - [`7b1e712`](https://github.com/morluto/rea/commit/7b1e7129f500ab8a6f48dced72262cc896586a66) fix(sqlite): normalize index table identifiers using ASCII folding ### 📊 Changes **2 files changed** (+18 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/sqlite/SqliteDatabaseInspection.ts` (+11 -7) 📝 `tests/boundary/sqlite/sqliteDatabaseInspection.test.ts` (+7 -1) </details> ### 📄 Description ## Summary Indexes could end up associated with the wrong table name when the casing differed, in both `selected_table` and `inventory` scopes. ## Problem and expected behavior When an index was declared like `CREATE INDEX users_email ON users(email)` for table `Users`, SQLite resolves it via ASCII case folding and stores `users` in `sqlite_schema.tbl_name`. In both `selected_table` and `inventory` scopes, `SqliteDatabaseInspection.ts` previously exposed that stored `tbl_name` directly without attributing it to the canonical table name `Users`. ## Change and scope - Renamed `triggerTable` to `dependentTable` in `SqliteDatabaseInspection.ts` so it can be reused for both indexes and triggers. - Resolved the index's table name using the current byte-aware `sqliteIdentifierBytesKey`. - Added a regression test covering both `selected_table` and `inventory` scopes. - Dropped the unrelated SAZ and test-project edits; the diff now only touches `SqliteDatabaseInspection.ts` and its boundary test. ## Validation performed - `npx vitest run tests/boundary/sqlite/sqliteDatabaseInspection.test.ts` — 33 passed, 1 skipped - `npm run check:fast` — passed (typecheck and lint clean) ## Author readiness Human owner: @vishalsatle - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#5995
No description provided.