Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/wrangler/src/__tests__/d1/splitter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,27 @@ describe("splitSqlQuery()", () => {
`);
});

it("should treat lowercase end as a compound statement terminator", ({
expect,
}) => {
expect(
splitSqlQuery(`
CREATE TRIGGER IF NOT EXISTS update_trigger AFTER UPDATE ON items
BEGIN
DELETE FROM updates WHERE item_id=old.id;
end;
SELECT 1;`)
).toMatchInlineSnapshot(`
[
"CREATE TRIGGER IF NOT EXISTS update_trigger AFTER UPDATE ON items
BEGIN
DELETE FROM updates WHERE item_id=old.id;
end",
"SELECT 1",
]
`);
});

it("should handle compound statements for CASEs", ({ expect }) => {
expect(
splitSqlQuery(`
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/d1/splitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,5 @@ function isCompoundStatementStart(str: string) {
* Returns true if the `str` ends with a compound statement `END` marker.
*/
function isCompoundStatementEnd(str: string) {
return /\sEND[;\s]$/.test(str);
return /\sEND[;\s]$/i.test(str);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Bug fix to a published package ships without a changeset, so users never get the release note

The behavior fix to D1 statement splitting (/\sEND[;\s]$/i at packages/wrangler/src/d1/splitter.ts:169) is added without any accompanying changeset entry, so the fix will not trigger a release or appear in the changelog.
Impact: Users won't see the fix documented and it may not be published.

Repository rule requiring changesets for published package changes

AGENTS.md states "All changes to published packages require a changeset" and CONTRIBUTING.md requires a changeset for every non-trivial change. The PR touches packages/wrangler/src/d1/splitter.ts (a published package's source) but .changeset/ only contains README.md, config.json, and an unrelated dependabot-update-15072.md. A patch changeset for wrangler describing the user-facing fix should be added.

Prompt for agents
Add a patch changeset for the wrangler package describing this user-facing bug fix: D1 SQL files using a lowercase 'end;' to close a compound statement (e.g. triggers) were previously split incorrectly. Follow .changeset/README.md rules: no conventional-commit prefix in the title, focus on user impact, no h1/h2/h3 headers.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

}