fix(crush): JSON keeps structural errors, not the bare word "error" - #10
Merged
Merged
Conversation
The JSON crusher kept every row matching the broad looksError substring,
so an array of Go signatures — `func H(ctx context.Context) error` — pinned
all 400 rows and compressed 0%. The "error return type" is not an error.
Split the floor: looksHardError (new, in relevance.go) matches STRUCTURAL
signals only — uppercase log levels, `error:`/`panic:`/`error[E0433]`,
line-start level keywords, `{"level":"error"}` / `level=fatal`, k8s failure
states (CrashLoopBackOff, OOMKilled, …), case-sensitive because loggers
emit uppercase levels. The JSON crusher's absolute keep is now
MustKeep + looksHardError; the broad looksError is demoted to a soft
ranking boost. Middle rows collapse by lineSig signature to one
representative per shape (the highest-scoring member), and the distinct
set is kept to an adaptive budget (adaptiveKeepCount, jsonMinKeep 3 /
jsonMaxKeep 40) — headroom-parity with the search/adaptive path.
Regression tests (crush/json_regression_test.go): a 400-row array of
error-returning Go signatures now compresses (37581 -> 965 bytes, was
passthrough), and a genuine {"level":"FATAL"} row still survives verbatim
while its INFO siblings collapse. Full suite green. No release tagged.
🔎 Grype — no fixable vulnerabilities ✅ |
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.
Bug
The JSON crusher's absolute keep used the broad
looksErrorsubstring, so an array where every row merely mentions "error" — e.g. Go signaturesfunc Handle(ctx context.Context) error— pinned every row and compressed 0%. Anerrorreturn type is not an error.Fix
looksHardError(new,relevance.go) matches only structural error signals: uppercase log levels,error:/panic:/error[E0433], line-start level keywords,{"level":"error"}/level=fatal, and k8s failure states (CrashLoopBackOff,OOMKilled, …). Case-sensitive by design — loggers emit uppercase levels.looksErrorstays as the broad soft-ranking signal.MustKeep + looksHardError(notlooksError). Middle rows collapse bylineSigsignature to one representative per shape (highest-scoring member), and the distinct set is kept to an adaptive budget (adaptiveKeepCount,jsonMinKeep 3/jsonMaxKeep 40) — parity with the search/adaptive path.Tests (
crush/json_regression_test.go){"level":"FATAL"}row still survives verbatim while itsINFOsiblings collapse.make checkclean.Targeting a v0.4.1 patch release.