Bound the prose: log lines and exception messages - #26
Open
VSN2015 wants to merge 1 commit into
Open
Conversation
Owner
Author
Code review — #26 Bound the proseVerdict: mergeable with fixes. The count cap is correct and leaves every structured channel intact, but the PR's own guarantee ("one request cannot write a megabyte of log") is defeated by a single long key name, and Verified
Strengths
Important
Minor
|
VSN2015
commented
Sep 5, 2026
| # write a megabyte of them. The machine-readable channels — a violation's | ||
| # `details` and the instrumentation payload — stay complete; only the | ||
| # sentence is bounded. | ||
| PROSE_LIST_LIMIT = 10 |
Owner
Author
There was a problem hiding this comment.
PROSE_LIST_LIMIT = 10 is an ideal threshold for human-readable error summaries and log warnings.
| # See PROSE_LIST_LIMIT. `unknown: :error` on a request carrying 50,000 | ||
| # undeclared keys used to produce a 50,000-item sentence — a megabyte of | ||
| # log line, or of exception message handed to every error tracker. | ||
| def permittable_prose_list(items) |
Owner
Author
There was a problem hiding this comment.
Formatting with "\#{shown}, and \#{items.length - PROSE_LIST_LIMIT} more" keeps the message concise while details retains the complete set of parameters for machine consumers.
The unknown: :log warn line joined every undeclared key, and the
violation summary behind InvalidParameters#message — also used for the
monitor-mode warn line — joined every violation.
50,000 undeclared keys, unknown: :log
before: one 1,088,000-byte logger.warn
after: one 261-byte logger.warn
The same request under unknown: :error produced a 1 MB exception
message, which is what an error tracker receives and indexes. And
unknown: :log is the mode the rollout documentation recommends, so
this sat on the recommended path rather than in an exotic corner.
A log line and an exception message are PROSE, written for a person.
They now list at most ten names and count the rest ("..., and 49990
more").
What deliberately does NOT change: the machine-readable channels stay
complete. InvalidParameters#details still names every offender, and so
does the invalid_parameters.permittable payload — nothing should
silently drop data a consumer might be reading, and a dashboard
counting rejections needs the whole list. Only the sentence is
bounded.
The one visible change is the message / problem detail string when
there are more than ten violations, which no ordinary contract reaches;
a spec pins that a single-violation message is byte-for-byte what it
was.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
VSN2015
force-pushed
the
fix/bound-human-readable-prose
branch
from
September 11, 2026 21:38
2acaf0d to
0383829
Compare
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.
The bug
The
unknown: :logwarn line joined every undeclared key, and the violation summary behindInvalidParameters#message— also used for the monitor-mode warn line — joined every violation.50,000 undeclared keys,
unknown: :log:logger.warnlogger.warnThe same request under
unknown: :errorproduced a 1 MB exception message — which is what your error tracker receives, indexes and bills you for.And
unknown: :logis the mode the rollout documentation recommends ("the rollout-friendly middle ground"), so this sat on the recommended path, not in an exotic corner.The fix
A log line and an exception message are prose, written for a person. They now list at most ten names and count the rest:
What deliberately does not change
The machine-readable channels stay complete:
InvalidParameters#detailsstill names every offender.invalid_parameters.permittableinstrumentation payload still carries every violation.Nothing should silently drop data a consumer might be reading, and a dashboard counting rejections needs the whole list. Only the sentence is bounded — a spec asserts
details.length == 5_000while the message is under 400 bytes.The one visible change
The
messagestring (and the problem-detailsdetailunder #19) when there are more than ten violations — which no ordinary contract reaches, since it needs more violations than a contract usually has fields. A spec pins that a single-violation message is byte-for-byte what it was:Verification
detailsalongside a bounded message, the monitor-mode line, and an ordinary message unchanged