Revert "Merge pull request 'Complete Housekeeping migration and /ase cutover' (#52) from codex/housekeeping-complete into main"
CI / check (push) Successful in 27s
CI / release (push) Skipped
CI / deploy (push) Successful in 43s

This reverts commit 488b6e57c4, reversing
changes made to b506b4499a.
This commit is contained in:
Simo committed 2026-08-30 21:31:34 +02:00
1 parent 488b6e57c4
commit b1ddda66ff
802 files changed
+61370 -76659

No files matched your search

@@ -13,7 +13,6 @@ import {
type HousekeepingSearchResult,
type HousekeepingWidgetDefinition,
type HousekeepingWorkItem,
mapUnknownError,
ok,
} from ".";
@@ -26,32 +25,18 @@ const workItem = {
domain: "people",
capability,
severity: "warning",
priority: "high",
ageMs: 60_000,
state: "open",
occurredAt: "2026-08-24T12:00:00.000Z",
titleKey: "pages.housekeeping.items.ticket",
context: { ticketId: "42" },
href: "/ase/people/tickets/42",
href: "/admin-next/people/tickets/42",
freshness: "fresh",
actions: [
{
id: "people.ticket.open",
labelKey: "pages.housekeeping.items.ticket.open",
commandId: "people.ticket.open",
capability,
},
],
} satisfies HousekeepingWorkItem;
const searchResult = {
id: "user-42",
domain: "people",
type: "entity",
title: "operator",
description: "A Housekeeping operator",
href: "/ase/people/users/42",
capability,
href: "/admin-next/people/users/42",
} satisfies HousekeepingSearchResult;
const searchProvider: HousekeepingSearchProvider = {
@@ -102,7 +87,7 @@ const manifest: HousekeepingDomainManifest = {
labelKey: "pages.housekeeping.domains.people.title",
descriptionKey: "pages.housekeeping.domains.people.description",
iconId: "users",
canonicalHref: "/ase/people",
previewHref: "/admin-next/people",
capability,
routes: [],
searchProviders: [searchProvider],
@@ -111,68 +96,19 @@ const manifest: HousekeepingDomainManifest = {
};
describe("housekeeping foundation contracts", () => {
it("preserves correlation IDs for successful results", () => {
it("creates typed success and error results", () => {
expect(ok({ count: 2 }, "corr-1")).toEqual({
ok: true,
data: { count: 2 },
correlationId: "corr-1",
});
});
it.each([
"UNAUTHENTICATED",
"FORBIDDEN",
"VALIDATION",
"NOT_FOUND",
"CONFLICT",
"RATE_LIMITED",
"DEPENDENCY_UNAVAILABLE",
"TIMEOUT",
"INTERNAL",
] as const)("returns the approved %s error contract", (code) => {
expect(
fail(code, `errors.housekeeping.${code.toLowerCase()}`, "corr-2", {
name: ["errors.validation.required"],
}),
).toEqual({
expect(fail("CAPABILITY_DENIED", "corr-2")).toEqual({
ok: false,
error: {
code,
messageKey: `errors.housekeeping.${code.toLowerCase()}`,
fieldErrors: { name: ["errors.validation.required"] },
},
error: { code: "CAPABILITY_DENIED" },
correlationId: "corr-2",
});
});
it("preserves a supplied correlation ID when mapping an unknown error", () => {
expect(
mapUnknownError(new Error("database password exposed"), "corr-unknown"),
).toEqual({
ok: false,
error: {
code: "INTERNAL",
messageKey: "errors.housekeeping.internal",
},
correlationId: "corr-unknown",
});
});
it("generates a correlation ID when mapping an unknown error without one", () => {
const result = mapUnknownError(new Error("database password exposed"));
expect(result).toMatchObject({
ok: false,
error: {
code: "INTERNAL",
messageKey: "errors.housekeeping.internal",
},
});
expect(result.correlationId).toMatch(
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
);
});
it("rejects empty capability requirements", () => {
expect(() => anyCapability()).toThrow("capability requirement is empty");
expect(() => allCapabilities()).toThrow("capability requirement is empty");
@@ -4,11 +4,10 @@ import type { HousekeepingInboxSource } from "./inbox";
import type { HousekeepingSearchProvider } from "./search";
import type { HousekeepingWidgetDefinition } from "./widget";
export type CanonicalHousekeepingHref = "/ase" | `/ase/${string}`;
export interface HousekeepingRouteDefinition {
id: string;
labelKey: string;
href: CanonicalHousekeepingHref;
href: string;
capability: CapabilityRequirement;
matchPrefixes?: readonly string[];
}
@@ -18,7 +17,7 @@ export interface HousekeepingDomainManifest {
labelKey: string;
descriptionKey: string;
iconId: "inbox" | "users" | "file-text" | "gem" | "hotel" | "settings";
canonicalHref: CanonicalHousekeepingHref;
previewHref: `/admin-next/${HousekeepingDomainId}`;
capability: CapabilityRequirement;
routes: readonly HousekeepingRouteDefinition[];
searchProviders: readonly HousekeepingSearchProvider[];
@@ -3,25 +3,12 @@ import type {
CapabilityRequirement,
HousekeepingCapabilityContext,
} from "./capability";
import type { CanonicalHousekeepingHref } from "./domain";
import type { HousekeepingResult } from "./result";
export type HousekeepingWorkItemSeverity = "info" | "warning" | "critical";
export type HousekeepingWorkItemFreshness = "fresh" | "stale";
export type HousekeepingWorkItemPriority =
| "low"
| "normal"
| "high"
| "critical";
export type HousekeepingInboxSourceAvailability = "available" | "unavailable";
export interface HousekeepingWorkItemAction {
id: string;
labelKey: string;
commandId: string;
capability: CapabilityRequirement;
}
export interface HousekeepingWorkItem {
sourceId: string;
itemId: string;
@@ -29,15 +16,11 @@ export interface HousekeepingWorkItem {
domain: HousekeepingDomainId;
capability: CapabilityRequirement;
severity: HousekeepingWorkItemSeverity;
priority: HousekeepingWorkItemPriority;
ageMs: number;
state: string;
occurredAt: string;
titleKey: string;
context?: Readonly<Record<string, unknown>>;
href: CanonicalHousekeepingHref;
href: string;
freshness: HousekeepingWorkItemFreshness;
actions: readonly HousekeepingWorkItemAction[];
}
export interface HousekeepingInboxSourceResult {
@@ -1,4 +1,3 @@
export { createCorrelationId } from "../correlation";
export {
allCapabilities,
anyCapability,
@@ -8,7 +7,6 @@ export {
} from "./capability";
export type { HousekeepingCommand } from "./command";
export type {
CanonicalHousekeepingHref,
HousekeepingDomainManifest,
HousekeepingRouteDefinition,
} from "./domain";
@@ -17,26 +15,20 @@ export type {
HousekeepingInboxSourceAvailability,
HousekeepingInboxSourceResult,
HousekeepingWorkItem,
HousekeepingWorkItemAction,
HousekeepingWorkItemFreshness,
HousekeepingWorkItemPriority,
HousekeepingWorkItemSeverity,
} from "./inbox";
export type { HousekeepingQuery } from "./query";
export {
fail,
type HousekeepingError,
type HousekeepingErrorCode,
type HousekeepingPartialCompletion,
type HousekeepingResult,
mapUnknownError,
ok,
} from "./result";
export type {
HousekeepingSearchInput,
HousekeepingSearchProvider,
HousekeepingSearchResult,
HousekeepingSearchResultType,
} from "./search";
export type {
HousekeepingWidgetDefinition,
@@ -1,70 +1,28 @@
import { createCorrelationId } from "../correlation";
export type HousekeepingErrorCode =
| "UNAUTHENTICATED"
| "FORBIDDEN"
| "VALIDATION"
| "VALIDATION_FAILED"
| "AUTHENTICATION_REQUIRED"
| "CAPABILITY_DENIED"
| "NOT_FOUND"
| "CONFLICT"
| "RATE_LIMITED"
| "DEPENDENCY_UNAVAILABLE"
| "TIMEOUT"
| "INTERNAL";
export interface HousekeepingError {
code: HousekeepingErrorCode;
messageKey: string;
fieldErrors?: Readonly<Record<string, readonly string[]>>;
}
export interface HousekeepingPartialCompletion {
readonly status: "partial";
readonly external: "not-required" | "completed" | "failed";
readonly audit: "persisted" | "unavailable";
}
| "PARTIAL_RESULT"
| "INTERNAL_ERROR";
export type HousekeepingResult<T> =
| { ok: true; data: T; correlationId: string }
| {
ok: true;
data: T;
ok: false;
error: { code: HousekeepingErrorCode };
correlationId: string;
completion?: HousekeepingPartialCompletion;
}
| { ok: false; error: HousekeepingError; correlationId: string };
};
export function ok<T>(
data: T,
correlationId: string,
completion?: HousekeepingPartialCompletion,
): HousekeepingResult<T> {
return {
ok: true,
data,
correlationId,
...(completion === undefined ? {} : { completion }),
};
export function ok<T>(data: T, correlationId: string): HousekeepingResult<T> {
return { ok: true, data, correlationId };
}
export function fail(
code: HousekeepingErrorCode,
messageKey: string,
correlationId: string,
fieldErrors?: Readonly<Record<string, readonly string[]>>,
): HousekeepingResult<never> {
return {
ok: false,
error: {
code,
messageKey,
...(fieldErrors === undefined ? {} : { fieldErrors }),
},
correlationId,
};
}
export function mapUnknownError(
_error: unknown,
correlationId = createCorrelationId(),
): HousekeepingResult<never> {
return fail("INTERNAL", "errors.housekeeping.internal", correlationId);
return { ok: false, error: { code }, correlationId };
}
@@ -3,7 +3,6 @@ import type {
CapabilityRequirement,
HousekeepingCapabilityContext,
} from "./capability";
import type { CanonicalHousekeepingHref } from "./domain";
import type { HousekeepingResult } from "./result";
export interface HousekeepingSearchInput {
@@ -11,16 +10,11 @@ export interface HousekeepingSearchInput {
limit: number;
}
export type HousekeepingSearchResultType = "navigation" | "entity" | "command";
export interface HousekeepingSearchResult {
id: string;
domain: HousekeepingDomainId;
type: HousekeepingSearchResultType;
title: string;
description?: string;
href: CanonicalHousekeepingHref;
capability: CapabilityRequirement;
href: string;
}
export interface HousekeepingSearchProvider {
@@ -14,6 +14,5 @@ export interface HousekeepingWidgetDefinition {
kind: HousekeepingWidgetKind;
load(
context: HousekeepingCapabilityContext,
signal: AbortSignal,
): Promise<HousekeepingResult<unknown>>;
}