fix(http): let the package classify command 401/403/429 and keep re-login first (03-02)
These statuses skipped the package classifier and always became MAYBE_APPLIED, so an expired session ended in "contact support" or the unknown-result screen. The descriptor gains optional classifyStatus, the reference create declares NOT_APPLIED, and AUTH_REQUIRED keeps reauth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
dfb1b9e0ee
commit
2afee67150
@@ -5,6 +5,7 @@ import {
|
||||
createFailure,
|
||||
kindForStatus,
|
||||
normalizeUnknownFailure,
|
||||
withFailureEffect,
|
||||
} from "../../src/contracts/errors.ts";
|
||||
import { DIAGNOSTIC_EVENT_REGISTRY } from "../../src/contracts/diagnostics.ts";
|
||||
import { TELEMETRY_REGISTRY } from "../../src/contracts/telemetry.ts";
|
||||
@@ -51,6 +52,19 @@ describe("frontend failure classification", () => {
|
||||
expect(kindForStatus(status)).toBe(kind);
|
||||
});
|
||||
|
||||
it("keeps re-login first for an auth failure whose effect is unknown (D-2)", () => {
|
||||
expect(
|
||||
createFailure("AUTH_REQUIRED", "CREATE", 0, { effect: "MAYBE_APPLIED" }),
|
||||
).toMatchObject({ action: "reauth", retryable: false });
|
||||
expect(
|
||||
withFailureEffect(createFailure("AUTH_REQUIRED", "CREATE", 0), "MAYBE_APPLIED"),
|
||||
).toMatchObject({ action: "reauth", retryable: false });
|
||||
// Every other kind still sends an unknown effect to support.
|
||||
expect(
|
||||
createFailure("FORBIDDEN", "CREATE", 0, { effect: "MAYBE_APPLIED" }),
|
||||
).toMatchObject({ action: "contact-support" });
|
||||
});
|
||||
|
||||
it("projects only allowlisted safe fields", () => {
|
||||
const untrustedDetails = {
|
||||
code: "TEMPORARY",
|
||||
|
||||
Reference in New Issue
Block a user