Repository navigation
fix(templates): preserve error response headers in publish chains - #1135
Merged
felipefreitag merged 1 commit intoOct 15, 2026
Merged
Conversation
Return the failed create or duplicate request headers when publish is chained. Cover HTTP errors, transport failures, and successful publish response headers through the public template methods.
felipefreitag
approved these changes
Oct 15, 2026
commit: |
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.
Chaining
templates.create(...).publish()ortemplates.duplicate(...).publish()currently keeps the initial request's error but replaces its response headers withnull. For example, a 429 losesRetry-After, and a validation error loses its request ID. This preserves the headers of that same failed request, consistent with #713. The publish request is still skipped after an initial failure.Tests cover both public methods, transport failures with no headers, and successful chains returning the publish response's headers. The two HTTP-error regressions fail before the fix and pass afterward.
Validation: 560 tests pass (4 existing TODOs); typecheck, build and Biome pass. Also verified both methods through the built ESM package with mocked fetch. No live API calls or email sends were used.
AI assistance: implemented and tested with Codex, with a separate review of the plan and diff. All reproduction data is synthetic.
Summary by cubic
Fixes template publish chains so a failed
create()orduplicate()request keeps its response headers when.publish()is called after it. The error was already preserved, but headers were replaced withnull, dropping useful metadata likeRetry-Afteron a 429 or the request ID on a validation error. The publish request is still skipped after an initial failure.Adds tests for both public methods, transport failures (where headers are absent), and successful chains returning the publish response's headers.
Written for commit 2cee5ba. Summary will update on new commits.