Rename the retained history limit diagnostic

This commit is contained in:
2026-10-27 15:18:57 +00:00
parent 1ce147c9f6
commit 24ab623cb2
8 changed files with 9 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
# Pre-v1 Public API Cleanup Implementation Plan
Status: in progress; Stages 1–7 are complete and Stages 8–11 are pending.
Status: in progress; Stages 1–8 are complete and Stages 9–11 are pending.
Baseline: `07e4ae5d9236935389e81b207d4a8f00543fafce`.
Audience: a Luna coding agent executing the stages sequentially.
@@ -326,7 +326,7 @@ and spelling without attribution/precedence changes.
## Stage 8 — Rename The History Diagnostic And Remove The Unused Code
Status: pending. Implements N3 and D8.
Status: complete. Implements N3 and D8.
1. Replace root/engine `CodeExplainLimitExceeded` with
`CodeHistoryLimitExceeded = "history.limit_exceeded"`. Update every producer,

View File

@@ -274,7 +274,7 @@ func hasHistoryLimitDiagnostic(t *testing.T, err error) bool {
t.Fatalf("error type = %T, want *LoadError", err)
}
for _, diagnostic := range loadErr.Diagnostics() {
if diagnostic.Code == CodeExplainLimitExceeded {
if diagnostic.Code == CodeHistoryLimitExceeded {
return true
}
}

View File

@@ -422,7 +422,7 @@ func TestHistoryNodeBudgetCountsSharedInheritanceRootsOnce(t *testing.T) {
func TestInheritanceExpansionEnforcesRetainedHistoryBudget(t *testing.T) {
input := parseCompositionDocument(t, "source-1", "parent: {value: original}\nchild: {extends: parent, value: replacement}\n")
if _, diagnostics := expandInheritanceWithBudgets(input, nil, defaultProjectionLimits(), 2); len(diagnostics) != 1 || diagnostics[0].Code != CodeExplainLimitExceeded {
if _, diagnostics := expandInheritanceWithBudgets(input, nil, defaultProjectionLimits(), 2); len(diagnostics) != 1 || diagnostics[0].Code != CodeHistoryLimitExceeded {
t.Fatalf("retained history limit = %#v", diagnostics)
}
if _, diagnostics := expandInheritanceWithBudgets(input, nil, defaultProjectionLimits(), 100); len(diagnostics) != 0 {

View File

@@ -382,7 +382,7 @@ func inheritanceBudgetDiagnostic(path Path, location document.Location) Diagnost
func inheritanceHistoryBudgetDiagnostic(path Path, location document.Location) Diagnostic {
primary := publicLocation(location)
return Diagnostic{
Code: CodeExplainLimitExceeded, Severity: SeverityError, Path: path,
Code: CodeHistoryLimitExceeded, Severity: SeverityError, Path: path,
Message: "retained inheritance history exceeds the node limit", Primary: &primary,
}
}

View File

@@ -315,7 +315,7 @@ func executeLoadRequest[T any](request loadRequest[T], secrets SecretBinding, lo
counter := newRetainedNodeCounter(historyLimit)
inspection, admitted := prepareInspectionHistory(resolved, counter)
if !admitted {
accumulator.add(Diagnostic{Code: CodeExplainLimitExceeded, Severity: SeverityError, Message: "retained configuration history exceeds the node limit"})
accumulator.add(Diagnostic{Code: CodeHistoryLimitExceeded, Severity: SeverityError, Message: "retained configuration history exceeds the node limit"})
return nil, accumulator.loadError()
}
// Detach resolver-borrowed values before reference mutation or validation.

View File

@@ -93,7 +93,6 @@ const (
CodeDecodeArrayLength Code = "decode.array_length"
CodeOptionsInvalid Code = "options.invalid"
CodeOptionsUnavailable Code = "options.unavailable"
CodeImportDisabled Code = "import.disabled"
CodeImportInvalid Code = "import.invalid"
@@ -163,7 +162,7 @@ const (
CodeOverrideVersion Code = "override.version"
CodeOverrideLimitExceeded Code = "override.limit_exceeded"
CodeExplainLimitExceeded Code = "explain.limit_exceeded"
CodeHistoryLimitExceeded Code = "history.limit_exceeded"
CodeInheritanceInvalid Code = "inheritance.invalid"
CodeInheritanceMissing Code = "inheritance.missing"

View File

@@ -94,7 +94,6 @@ const (
CodeDecodeArrayLength Code = "decode.array_length"
CodeOptionsInvalid Code = "options.invalid"
CodeOptionsUnavailable Code = "options.unavailable"
CodeImportDisabled Code = "import.disabled"
CodeImportInvalid Code = "import.invalid"
@@ -164,7 +163,7 @@ const (
CodeOverrideVersion Code = "override.version"
CodeOverrideLimitExceeded Code = "override.limit_exceeded"
CodeExplainLimitExceeded Code = "explain.limit_exceeded"
CodeHistoryLimitExceeded Code = "history.limit_exceeded"
CodeInheritanceInvalid Code = "inheritance.invalid"
CodeInheritanceMissing Code = "inheritance.missing"

View File

@@ -26,6 +26,7 @@ func TestOverlayPublicValues(t *testing.T) {
CodeOverlayDirective: "overlay.directive",
CodeOverlayVersion: "overlay.version",
CodeOverlayLimitExceeded: "overlay.limit_exceeded",
CodeHistoryLimitExceeded: "history.limit_exceeded",
} {
if string(code) != value {
t.Errorf("code = %q, want %q", code, value)