Surface parser token review explicitly

This commit is contained in:
2026-03-15 15:33:19 +01:00
parent 47b72419ad
commit 74a9436c92
14 changed files with 355 additions and 41 deletions

View File

@@ -74,7 +74,7 @@
"effects": [],
"branches": []
}</pre>
<p class="panel-copy">Use this to retrieve the full editable result graph for one critical-table cell, including nested branches and normalized effects.</p>
<p class="panel-copy">Use this to retrieve the full editable result graph for one critical-table cell, including nested branches, normalized effects, and review notes for unresolved quick-parse tokens.</p>
</section>
<section class="panel">
@@ -95,7 +95,7 @@
"branches": []
}
}</pre>
<p class="panel-copy">Re-runs the shared single-cell parser, merges the generated result with the current override state, and returns the refreshed editor payload without saving changes.</p>
<p class="panel-copy">Re-runs the shared single-cell parser, merges the generated result with the current override state, and returns the refreshed editor payload without saving changes. Unknown or partially parsed tokens are surfaced explicitly in the returned review data.</p>
</section>
<section class="panel">

View File

@@ -255,6 +255,25 @@
}
</div>
</div>
@if (Model.GeneratedState.TokenReviewItems.Count > 0)
{
<div class="critical-editor-card nested">
<div class="critical-editor-card-header">
<div>
<strong>Token Review</strong>
<p class="muted critical-editor-inline-copy">These tokens were unknown or only partially understood during generation and need manual review.</p>
</div>
</div>
<div class="critical-editor-validation-list">
@foreach (var issue in Model.GeneratedState.TokenReviewItems)
{
<p class="critical-editor-validation-item">@issue.ReviewText</p>
}
</div>
</div>
}
}
</div>
</details>
@@ -621,6 +640,11 @@
items.Add("Current card matches the fresh generation");
}
if (model.GeneratedState.TokenReviewItems.Count > 0)
{
items.Add($"{model.GeneratedState.TokenReviewItems.Count} token review item{(model.GeneratedState.TokenReviewItems.Count == 1 ? string.Empty : "s")}");
}
if (model.GeneratedState.ValidationMessages.Count > 0)
{
items.Add($"{model.GeneratedState.ValidationMessages.Count} parser note{(model.GeneratedState.ValidationMessages.Count == 1 ? string.Empty : "s")}");

View File

@@ -6,4 +6,5 @@ public sealed record CriticalCellComparisonState(
string DescriptionText,
IReadOnlyList<CriticalEffectLookupResponse> Effects,
IReadOnlyList<CriticalBranchLookupResponse> Branches,
IReadOnlyList<string> ValidationMessages);
IReadOnlyList<string> ValidationMessages,
IReadOnlyList<CriticalTokenReviewItem> TokenReviewItems);

View File

@@ -0,0 +1,9 @@
using System.Collections.Generic;
namespace RolemasterDb.App.Features;
public sealed record CriticalTokenReviewItem(
string Scope,
string? ConditionText,
string Token,
string ReviewText);

View File

@@ -535,7 +535,17 @@ public sealed class LookupService(IDbContextFactory<RolemasterDbContext> dbConte
.OrderBy(branch => branch.SortOrder)
.Select(CreateBranchLookupResponse)
.ToList(),
content.ValidationErrors.ToList());
content.ValidationErrors.ToList(),
content.TokenReviewIssues
.Select(CreateTokenReviewItem)
.ToList());
private static CriticalTokenReviewItem CreateTokenReviewItem(SharedParsing.CriticalTokenReviewIssue issue) =>
new(
issue.Scope,
issue.ConditionText,
issue.Token,
issue.ReviewText);
private static CriticalEffectEditorItem CreateEffectEditorItem(CriticalEffect effect, string originKey) =>
new(