-
Notifications
You must be signed in to change notification settings - Fork 1.5k
test(coderd): guard chat history writes in test databases #29243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
mafredri
wants to merge
6
commits into
main
Choose a base branch
from
test/chat-store-write-guard
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6697f8a
test(coderd): guard chat history writes in test databases
mafredri 5387935
test(coderd): seed every chat fixture through dbgen
mafredri ef0434a
test(coderd): lock the chat guard's allocation set
mafredri e784d9b
test(coderd): prove the chat guard reports at cleanup
mafredri 6326a0a
test(coderd/database/dbtestutil): drive every guarded writer to a rejβ¦
mafredri fb2006d
test(coderd/database/dbtestutil): split the nested InTx case into itsβ¦
mafredri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test(coderd/database/dbtestutil): drive every guarded writer to a rejβ¦
β¦ection The completeness test proved an override exists per writer query but not that it rejects; only two of the thirteen were ever driven to the guard error. A table now calls each writer on the root handle and the completeness test requires the table to name every override, so a future override that drops the check fails a test instead of passing silently. A nested InTx case covers the one branch that shares the outer allocation set. Also widen the writer query pattern to ONLY and MERGE INTO forms, and rename require, mark, covered and rejections to say what they hold.
- Loading branch information
commit 6326a0aade8b8eeeb79a462d38663eaca4190236
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3 [CRF-4] The cleanup failure message names the problem and where to look but drops the fix, and this is the one message the developer actually reads. (Leorio P3, Gon Note)
The returned error from
addprescribes the treatment ("write history through chatstate.ChatMachine.Update or CreateChat, or dbgen in tests"); this cleanup message says "the call site is the assertion that received this error, otherwise search for callers of ..." and stops. That first clause is also wrong for this path: if an assertion had received the error, the test would have failed there and this line would not fire. When it fires, no assertion received the error, so the clause sends the reader looking for something that does not exist. Give the cleanup message the same content the returned error carries: name the method, the chat, anddbgen.ChatMessage/dbgen.ChatQueuedMessage(orchatstate.ChatMachine.Update/CreateChat) as the fix. Gon separately noted the two messages are maintained independently and will drift.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping the text. The cleanup sentence was proposed during implementation and accepted by the orchestrator together with the decision not to capture call stacks. Its second clause, "otherwise search for callers of ", is the instruction for the dropped-error path; the first clause covers the case where the error was asserted on and the cleanup still runs (the assertion failed the test first, and the cleanup line points back at it). The fix text lives in the returned error so the two messages carry different information rather than duplicate it. Leaving open for the human reviewer.