Skip to content

test(compile): name each SQL test cache miss when a delta comparison fails - #1405

Merged
kvlonge merged 3 commits into
mainfrom
fix/sql-test-cache-miss-diagnostics
Nov 10, 2026
Merged

kvlonge merged 3 commits into
mainfrom
fix/sql-test-cache-miss-diagnostics

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Why

The seeded delta-compile series in test_compile_delta.py sometimes fails in CI because one compile of a delta/full pair re-plans SQL tests and the other does not, from the same copied project. It has not reproduced locally, and the failure only shows the extra "SQL test planning START" line, so there is nothing to diagnose it from.

Changes

  • A warm compile's SQL test artifact cache-miss debug line also names each missed record by the first 12 characters of its key and its reason, for example identity_changed=1 (records d11ac5013d79:identity_changed).
  • A cache file that exists but yields no records (unreadable, cut short, malformed or empty) now logs "(the cache file held no usable records)" instead of nothing.
  • When a delta/full comparison fails, the series appends what each side's compile logged about the SQL test cache, read from that invocation's logs/<date>/<run>/diagnostics.jsonl. Record keys and reason labels only; no SQL text or environment.

The hit/miss decision is unchanged. No DuckShop edge case: this adds diagnostics only and changes no project shape, data value or lifecycle behaviour.

Verification

  • test_sql_test_cache_misses.py (resized, rewritten and cut-short caches) and the delta compile series unit tests pass on the rebuilt extension.
  • A real sqb compile without --debug writes the miss to <project>/logs/<date>/<run>/diagnostics.jsonl and not to stderr, which is where the series reads it.
  • Static checks pass locally (ruff, ty, fensu, cargo fmt, workspace clippy). The control-client check runs in CI, because the local sqb predates the current OpenAPI contract.

…fails

The seeded delta-compile series in test_compile_delta.py sometimes fails in
CI because one compile of a delta/full pair re-plans SQL tests and the other
does not, from the same copied project. It has not reproduced locally, and
the failure text only shows the extra "SQL test planning  START" line.

- A warm compile's cache-miss debug line now also names each missed record
  by its key's first 12 characters and its reason, for example
  "identity_changed=1 (records d11ac5013d79:identity_changed)".
- A cache file that exists but yields no records (unreadable, cut short,
  malformed or simply empty) was silent; it now logs "(the cache file held
  no usable records)".
- When a delta/full comparison fails, the series appends what each side's
  compile logged about the SQL test cache, so the CI log says which side
  missed, which records and why. These are synthetic test-project metadata
  only: record keys and reason labels, with no SQL text or environment.

The hit/miss decision itself is unchanged: an artifact whose mtime differs
from its record is already compared by digest before it counts as a miss.
@kvlonge kvlonge added the full-verify Run the full Verify matrix on this pull request label Nov 10, 2026
@kvlonge
kvlonge enabled auto-merge (squash) November 10, 2026 21:06
@kvlonge
kvlonge merged commit e8b4ff6 into main Nov 10, 2026
48 checks passed
@kvlonge
kvlonge deleted the fix/sql-test-cache-miss-diagnostics branch November 10, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-verify Run the full Verify matrix on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant