feat(push): handle deleting custom types that still have documents#187
Open
jomifepe wants to merge 6 commits into
Open
feat(push): handle deleting custom types that still have documents#187jomifepe wants to merge 6 commits into
jomifepe wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 86370a7. Configure here.
|
|
||
| constructor(response: Response, body: unknown) { | ||
| super(response); | ||
| this.body = body; |
There was a problem hiding this comment.
BadRequestError body property is set but never read
Low Severity
The body property on BadRequestError is assigned in the constructor but never read anywhere in the codebase. The isDocumentsInUseError function — the only consumer of BadRequestError — calls error.text() (re-reading the response) instead of accessing error.body. This makes body dead code that adds confusion about the intended API.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 86370a7. Configure here.
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.


Summary
BadRequestError+ stable checks on the response body).POST …/core/documents/search(Editor parity:customTypes+limit: 0), enforce the 200 bulk-delete limit, then callDELETE …/core/documentswithcustomtype_idsbefore retrying type deletion.--delete-pagesopts in to cascading deletion of associated pages whenpushwould otherwise stop with an error;--forcealone does not enable that path (it still only skips dirty-repo checks and the “would delete remote models” guard).https://{repository}.{host}/builder/working?customTypes={id}.Note
Medium Risk
Adds automated bulk deletion of documents during
prismic pushwhen removing a custom type, which is potentially destructive and depends on new API calls and 400-error detection; guarded by an explicit--delete-pagesflag and a hard 200-document limit.Overview
prismic pushnow detects when a custom type deletion fails because it still has associated documents, and surfaces clearer guidance (including a deep link to the filtered working view).When this condition is hit, it queries the document total via
POST core/documents/search, enforces a 200-document bulk-delete cap, and—only with--delete-pages—cascades by callingDELETE core/documentsbefore retrying the type deletion.The request layer now throws a dedicated
BadRequestErroron HTTP 400 to support stable detection of the “documents in use” failure mode.Reviewed by Cursor Bugbot for commit 86370a7. Bugbot is set up for automated code reviews on this repo. Configure here.