fix(web): make the diagnostic manifest describe the archived sections #8085
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.48) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 515 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.374
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8085"
general
weight: 0.35
yuluo-yx
Fixes #8023
<!--
Thank you for proposing a pull request. This template will guide you through the essential steps necessary for a pull request.
-->
Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.---
Problem
DiagnosticBundleWriterserialisedmanifest.jsonbefore applying the archive-wide section budget, then cut section bytes withmaxTotalByteswithout updating the already-written manifest. For a small configured total:OKwith its originalsizeBytes;manifest.jsonitself was not counted againstmaxTotalBytes, althoughDiagnosticProperties#getMaxTotalBytesdocuments the value as the maximum total uncompressed bundle size.Changes
shenyu-web/.../diagnostics/DiagnosticBundleWriter.javamaxSectionBytes, render the manifest from that plan, trim the plan untilmanifest.jsonplus all sections fitmaxTotalBytes, and re-plan until the plan and the manifest agree (a trimmed section changes its own summary).TRUNCATEDwith reasontotal budget truncated; sections that receive no allowance areSKIPPEDwith reasontotal budget exhaustedand an empty entry. Neither is ever reportedOK. Every section keeps its deterministic entry name, so the manifest remains a complete index.maxSectionByteskeeps that reason when the total budget cuts it further (section size cap; total budget truncated).IllegalStateExceptionnaming the configured value instead of silently exceeding the advertised bound.DiagnosticManifest.java: addwithSections(List<DiagnosticSection>)so the writer can describe the planned sections without mutating the collected manifest.DiagnosticProperties.java: document that the bound covers every uncompressed entry including the manifest, and what happens when it is smaller than the manifest.Validation
shenyu-webmodule, offline, with checkstyle enabled:Tests run: 25, Failures: 0, Errors: 0, Skipped: 0— all diagnostics tests, including the untouched service, redactor, digest-collector and endpoint tests.DiagnosticBundleWriterTest: 10 tests, up from 5. The five new ones cover total-budget truncation, full budget exhaustion across 8 sections, multibyte cuts, a complete bundle at exactly the budget, and a budget below the manifest.masterwriter, 3 of them fail —manifestDescribesTheArchivedContentAfterTotalBudgetTruncation,exhaustedTotalBudgetSkipsSectionsInsteadOfReportingOk,budgetSmallerThanTheManifestFailsExplicitly. They pass with the fix.clean installwas not run locally (the module was built and tested directly); CI covers the reactor build.Behaviour changes worth noting
TRUNCATED/SKIPPED, and itssizeBytesmatch the archived entry length. Consumers that treated every section as parseable JSON must checkstatus— which the format already required.max-total-bytescannot hold the manifest now fails bundle export withIllegalStateExceptionrather than returning an over-budget archive. The default is 4 MiB, so this only affects deliberately tiny values.Out of scope
Section collection timeout enforcement and the per-section cap semantics are unchanged; this PR only makes the archive and its manifest agree and enforces the documented total bound.