feat(studio): improve compiler reliability and AI diagnostics
Preserve structured diagnostics, source attribution, phase outcomes and revision context through compiler, Studio, LSP, MCP and JavaFX. Add project service discovery and resilient VS Code reconnection. Correct all eight reproduced PBS production failures in expression context, sibling executable bindings and nominal owner identity. Consolidate specs, lessons, immutable baseline evidence and the maintained source-to-guest qualification runner. Validation: required Gradle gate recorded 724 tests, with 711 passed and 13 skipped. Full corpus passed 168 compilation observations and 108 guest runs (104 successes and four deliberate faults); supplemental controls passed 42 compilations and 16 guest runs. TypeScript compilation, two Node discovery tests and discussion validation passed.
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
package p.studio.api.diagnostic;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Map;
|
||||
import java.util.LinkedHashMap;
|
||||
import p.studio.utilities.json.ImmutableJson;
|
||||
import p.studio.utilities.json.DiagnosticPayloads;
|
||||
|
||||
public record StudioDiagnostic(String code, DiagnosticSeverity severity, String message) {
|
||||
public record StudioDiagnostic(String code, DiagnosticSeverity severity, String message, Map<String, Object> details) {
|
||||
public StudioDiagnostic(String code, DiagnosticSeverity severity, String message) { this(code, severity, message, Map.of()); }
|
||||
public StudioDiagnostic {
|
||||
Objects.requireNonNull(code, "code");
|
||||
Objects.requireNonNull(severity, "severity");
|
||||
@@ -10,5 +15,21 @@ public record StudioDiagnostic(String code, DiagnosticSeverity severity, String
|
||||
if (code.isBlank()) {
|
||||
throw new IllegalArgumentException("code must not be blank");
|
||||
}
|
||||
var complete = new LinkedHashMap<>(DiagnosticPayloads.issue(code, severity.name(), message));
|
||||
if (details != null) complete.putAll(details);
|
||||
if (!(complete.get("issueId") instanceof String identity) || identity.isBlank())
|
||||
complete.put("issueId", java.util.UUID.randomUUID().toString());
|
||||
details = ImmutableJson.object(complete);
|
||||
}
|
||||
|
||||
public static StudioDiagnostic fromMap(Map<String, Object> value) {
|
||||
return new StudioDiagnostic((String) value.get("code"), DiagnosticSeverity.valueOf((String) value.get("severity")),
|
||||
(String) value.get("message"), value);
|
||||
}
|
||||
|
||||
public Map<String, Object> toMap() {
|
||||
var value = new LinkedHashMap<>(details);
|
||||
value.put("code", code); value.put("severity", severity.name()); value.put("message", message);
|
||||
return ImmutableJson.object(value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user