Repository navigation
The file-write test fails when a code_files insert keeps the round's cached file rows - #1739
Merged
Merged
Conversation
…cached file rows `test_a_file_write_ends_the_no_file_row_answer` read the path before it wrote the row. A per-path read answered from the round removes the cached rows it returns, so the insert had nothing left to drop, and the test passed with `code_files` removed from the tables whose insert drops a cache. The test now writes before the first read. With the cache dropped, the read writes the buffered row and asks the repository; with it kept, the read is answered from the prefetch with no statement and no write, and the test fails. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #1728
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
Not required.
Why
test_a_file_write_ends_the_no_file_row_answeris named for one behaviour: acode_filesinsert drops the round's cachedlive_files_for_pathrows, so the next read of that path asks the repository. The test passed without that behaviour.It read
logo.pngonce before the insert. A per-path read answered from the round removes the cached rows it returns, so the entry was already gone when the insert ran and the insert's drop had nothing to drop. The second read missed whatever the insert did. The test only showed that a read of a buffered path writes the buffer first.The test now writes before the first read, as
test_a_chunk_write_ends_the_no_live_chunk_answerdoes. With the drop in place the read misses, writes the buffered row and calls the repository. Without it the read is answered from the prefetch with no statement and no write, and both assertions fail.Scope and risk
One test in
tests/unit/test_code_round_reads_backfill_statements.py. No server code changes:RoundReads.insert_rowsalready drops the cached file rows, and this test now holds it to that.Compatibility, rollout and rollback
Tests
python -m pytest tests/unit/test_code_round_reads_backfill_statements.py -q"code_files": self._filesdeleted from the table-to-cache map inRoundReads.insert_rows: 22 passed.test_a_file_write_ends_the_no_file_row_answer:live_files_for_path:logo.pngis not among the repository calls), 21 passed.main: 22 passed.ruff format --checkandruff checkpass on the file.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. Checked by running the test file against the module with and without the cache drop, as listed under Tests.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py). None are affected.main; no merged migration is edited. No migration.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version. No plugin file changes.npm --prefix frontend run build) and its tests pass, iffrontend/changed. Not changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code
Note
Low Risk
Single unit test change only; no production code modified.
Overview
Fixes
test_a_file_write_ends_the_no_file_row_answerso it actually checks that acode_filesinsert invalidatesRoundReads' per-path file cache and forces the nextlive_files_for_pathto hit the repository.The test now inserts before the first read (matching
test_a_chunk_write_ends_the_no_live_chunk_answer). Previously, an eager read consumed cached prefetch rows, so the insert had nothing to drop and the assertion did not prove cache invalidation.Assertions now require
live_files_for_path:logo.pngamong repository calls after the buffered write, instead of comparing empty before/after snapshots.Reviewed by Cursor Bugbot for commit 9459dad. Bugbot is set up for automated code reviews on this repo. Configure here.