Skip to content

normalize,compatibility_shim: make sure non-printf-style message will have no args - #87

Closed
kennytm wants to merge 3 commits into
masterfrom
kennytm/fix-86
Closed

kennytm wants to merge 3 commits into
masterfrom
kennytm/fix-86

Conversation

@kennytm

@kennytm kennytm commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

fix #86

@kennytm kennytm changed the title normalize: make FastGenWithCause() & GenWithStackByCause() take no args normalize,compatibility_shim: make sure non-printf-style message will have no args Oct 27, 2026
@kennytm

kennytm commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

PTAL @crazycs520

breaking change, but imo the existing usages broken by this are wrong anyway as explained in #86.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the changes to literal error-message handling and JSON-decoding state reset.

No open issues 🎉

What changed in this PR

Addresses #86 by keeping cause-derived and JSON-decoded error messages literal, preventing stale arguments from formatting them.

Changes:

  • Removes arguments from FastGenWithCause and GenWithStackByCause, directing template formatting to the existing ByArgs methods.
  • Clears formatting arguments and other local state after successful JSON unmarshalling.
  • Updates tests for literal percent sequences, redaction, state reset, and preservation of existing errors on invalid JSON.
File Description
normalize.go Makes cause-based generators argument-free and clears arguments when copying cause text.
normalize_test.go Updates cause-generation tests for literal messages and the revised API.
compatible_shim.go Clears stale local state after successful JSON decoding.
compatible_shim_test.go Adds state-reset, literal-message round-trip, and invalid-input tests.

Review effort: Balanced

@kennytm

kennytm commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

separating this into 2 PRs.

@kennytm kennytm closed this Nov 12, 2026
@kennytm
kennytm deleted the kennytm/fix-86 branch November 12, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FastGenWithCause() and GenWithStackByCause() should not take arguments

2 participants