fix(adminui): bound the diagnostics marker payload on both the endpoint and the circuit (D-a review r1)
I-1 - a non-C# paste produced thousands of Roslyn markers. The Problems-list report sent them all as one JS->.NET message, which could exceed the 1 MB hub limit and kill the circuit. The JS now sends at most MaxReportedMarkers (200) markers, errors first, each message cut to 300 chars, plus the total. ScriptProblemReport.FromEditor clamps again on arrival, and the Problems list shows "showing N of Total" / "+N more". The diagnostics endpoint also bounds its response: Distinct, errors first, MaxDiagnosticMarkers (1000), messages cut to 1000 chars. An error is always kept, so editor-accepts == publish-accepts. M-1 - drop the per-instance compilation lineage; analyses derive from BaseCompilation. M-2 - the VirtualTag modal clears its problems (and editor ref) on close and on a script reload. M-5 - an over-limit text is announced at blur (OnSyncRefused), not only at Save. Refs #745 Claude-Session: https://claude.ai/code/session_01Ub9hGmYLQvn9XETzw7CMsT
This commit is contained in:
@@ -5,12 +5,13 @@
|
||||
ScriptProblems (unit-tested). *@
|
||||
|
||||
@{
|
||||
var ordered = ScriptProblems.Order(Markers);
|
||||
var report = Report ?? ScriptProblemReport.Empty;
|
||||
var ordered = ScriptProblems.Order(report.Markers);
|
||||
}
|
||||
<div class="script-problems mt-2 small" role="region" aria-label="Problems">
|
||||
<div class="d-flex align-items-center gap-2 text-muted mb-1">
|
||||
<span class="fw-semibold">Problems</span>
|
||||
<span>@ScriptProblems.Summary(ordered)</span>
|
||||
<span>@ScriptProblems.Summary(report with { Markers = ordered })</span>
|
||||
</div>
|
||||
@if (ordered.Count > 0)
|
||||
{
|
||||
@@ -29,18 +30,20 @@
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@if (ordered.Count > MaxRows)
|
||||
@if (report.Total > Math.Min(ordered.Count, MaxRows))
|
||||
{
|
||||
<div class="text-muted mt-1">… and @(ordered.Count - MaxRows) more</div>
|
||||
@* The editor reports at most ScriptEditorLimits.MaxReportedMarkers problems (one circuit message); the
|
||||
rest are still squiggled in the editor. *@
|
||||
<div class="text-muted mt-1">+@(report.Total - Math.Min(ordered.Count, MaxRows)) more — fix the problems above, or scroll the editor to see them all.</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private const int MaxRows = 200;
|
||||
private const int MaxRows = ScriptEditorLimits.MaxReportedMarkers;
|
||||
|
||||
/// <summary>The markers the editor last reported (null before the first diagnostics pass).</summary>
|
||||
[Parameter] public IReadOnlyList<DiagnosticMarker>? Markers { get; set; }
|
||||
/// <summary>The report the editor last sent (null before the first diagnostics pass).</summary>
|
||||
[Parameter] public ScriptProblemReport? Report { get; set; }
|
||||
|
||||
/// <summary>Raised when the author picks a problem; wire it to <c>MonacoEditor.RevealLineAsync</c>.</summary>
|
||||
[Parameter] public EventCallback<DiagnosticMarker> OnSelect { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user