Skip to content

docs(db): add reproducible SQLite coupling inventory - #8262

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
xiaoyaner0201:docs/sqlite-coupling-inventory
Jul 23, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
xiaoyaner0201:docs/sqlite-coupling-inventory

Conversation

@xiaoyaner0201

@xiaoyaner0201 xiaoyaner0201 commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Publishes the measured SQLite coupling inventory requested in #8075 as a separate artifact from the persistence ADR in #8261.

Changes

  • Adds a deterministic audit script that scans tracked non-test source and migration SQL.
  • Masks comments and literal contents for adapter/direct-singleton call-syntax counts while retaining raw-text SQL dialect signals.
  • Refuses to audit a dirty tracked source corpus and reports both the audit-tool revision and a corpus SHA-256.
  • Includes every adapter-surface matching path in JSON output.
  • Adds a fixture-based regression test for false positives, JSON shape, and dirty-tree rejection.
  • Records methodology, limitations, high-coupling areas, and recommended cut lines.

Snapshot highlights

At the recorded source revision and corpus digest:

  • 45 tracked non-test files outside src/lib/db/ contain direct getDbInstance() call syntax after comments/literals are masked.
  • 52 files outside src/lib/db/ contain .prepare() call syntax.
  • 211 tracked non-test files import the localDb compatibility barrel.
  • 129 migration SQL files are in scope.

These are lexical review leads, not claims that every match is a defect or distinct SQL statement. The document also calls out the lightweight masker's limitations, including excluded template-literal expressions and regex-literal edge cases.

Verification

  • node scripts/check/audit-sqlite-coupling.mjs
  • node scripts/check/audit-sqlite-coupling.mjs --json
  • node --test scripts/check/audit-sqlite-coupling.test.mjs
  • node --check scripts/check/audit-sqlite-coupling.mjs
  • node scripts/check/check-fabricated-docs.mjs
  • node scripts/check/check-doc-links.mjs
  • node scripts/check/check-public-creds.mjs
  • npx prettier --check docs/architecture/sqlite-coupling-inventory.md scripts/check/audit-sqlite-coupling.mjs scripts/check/audit-sqlite-coupling.test.mjs
  • git diff --check
  • Semgrep Cloud

Scope

No runtime, schema, migration, dependency, or configuration changes. Relates to #8075 and is intentionally independent of #8261 so evidence and decisions can be reviewed separately.

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks, @xiaoyaner0201! 🙏 Merged — the SQLite coupling inventory doc plus the audit-sqlite-coupling check script (with its test). Nice tooling to keep the coupling visible.

@diegosouzapw
diegosouzapw merged commit fbb8d45 into cheaper-inference:release/v3.8.49 Jul 23, 2026
3 checks passed
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…ce#8262)

Co-authored-by: 千乘妍 (Xiaoyaner) <xiaoyaner0201@users.noreply.github.com>
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…ce#8262)

Co-authored-by: 千乘妍 (Xiaoyaner) <xiaoyaner0201@users.noreply.github.com>
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.

2 participants