mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-21 04:10:47 +02:00
fix(gstack2): treat hard runtime failure as not-ready in capability readiness
A capability whose binary launches while the managed runtime hard-fails (e.g. skill-API mismatch) was reported as `degraded`/ok:true/exit 0, diverging from plain `gstack doctor` (ok:false/exit 1) for the identical report. Split the branch so runtime `warn` stays `degraded` and runtime `fail` maps to `failed`, and add a regression test for the runtime-fail + capability-pass case. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
d240b0fa6a
commit
52a6101706
+2
-1
@@ -247,7 +247,8 @@ export function capabilityReadiness(report, capability, options = {}) {
|
||||
const runtimeCheck = report.checks.find((check) => check.id === "managed-runtime");
|
||||
let status;
|
||||
if (capabilityCheck?.status === "pass" && runtimeCheck?.status === "pass") status = "ready";
|
||||
else if (capabilityCheck?.status === "pass") status = "degraded";
|
||||
else if (capabilityCheck?.status === "pass" && runtimeCheck?.status === "warn") status = "degraded";
|
||||
else if (capabilityCheck?.status === "pass") status = "failed";
|
||||
else if (capabilityCheck?.status === "fail") status = "failed";
|
||||
else status = "unavailable";
|
||||
|
||||
|
||||
@@ -52,11 +52,18 @@ describe("capability readiness", () => {
|
||||
{ id: "managed-runtime", status: "pass", message: "active" },
|
||||
{ id: "capability:diagram", status: "fail", message: "launcher metadata missing" },
|
||||
]), "diagram");
|
||||
// A hard runtime failure under a launchable capability is not a warning:
|
||||
// it must not report ok:true, matching plain `gstack doctor`'s exit code.
|
||||
const runtimeFailed = capabilityReadiness(report([
|
||||
{ id: "managed-runtime", status: "fail", message: "incompatible skill API" },
|
||||
{ id: "capability:browser", status: "pass", message: "launched" },
|
||||
]), "browser");
|
||||
|
||||
expect(ready).toMatchObject({ ok: true, readiness: { status: "ready" } });
|
||||
expect(degraded).toMatchObject({ ok: true, readiness: { status: "degraded" } });
|
||||
expect(failed).toMatchObject({ ok: false, readiness: { status: "failed" } });
|
||||
expect(failed.consent.install.status).toBe("required-after-preview");
|
||||
expect(runtimeFailed).toMatchObject({ ok: false, readiness: { status: "failed" } });
|
||||
});
|
||||
|
||||
test("reports physical iOS as unsupported without turning off pure judgment", () => {
|
||||
|
||||
Reference in New Issue
Block a user