refactor: rename denial records to access decisions

- rename governance.access_denials table, indexes and API types via migration 00061
- expose /api/access/decisions and decisions payload; keep audit auth unchanged
- rename UI store, page and route from denials to decisions
This commit is contained in:
sam committed 2026-11-23 02:03:35 +11:00
1 parent 60d9b6b7aa
commit 062336db91
23 files changed
+187 -172

No files matched your search

@@ -13,13 +13,13 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@
import { Section } from "@/components/ui/section";
import { Spinner } from "@/components/ui/spinner";
import { Timestamp } from "@/components/ui/timestamp";
import { useDenialsStore } from "@/stores/denials";
import { denialResource, type Denial } from "./denials";
import { useDecisionsStore } from "@/stores/decisions";
import { decisionResource, type AccessDecision } from "./decisions";
const store = useDenialsStore();
const { denials, filters, more, loading, error } = storeToRefs(store);
const store = useDecisionsStore();
const { decisions, filters, more, loading, error } = storeToRefs(store);
const columns: DataTableColumn<Denial>[] = [
const columns: DataTableColumn<AccessDecision>[] = [
{ id: "at", label: "When", fixed: true, width: "9rem", sort: (d) => d.at },
{ id: "principal", label: "Principal", fixed: true, width: "auto", class: "whitespace-normal" },
{ id: "outcome", label: "Outcome", width: "7rem" },
@@ -60,18 +60,18 @@ onMounted(() => void store.load());
<Button type="button" variant="outline" size="sm" :disabled="loading" @click="store.clear()">Clear</Button>
</form>
<div class="flex flex-col gap-3">
<p v-if="loading && !denials.length" class="flex items-center gap-2 text-label text-fg-muted">
<p v-if="loading && !decisions.length" class="flex items-center gap-2 text-label text-fg-muted">
<Spinner />Loading decisions…
</p>
<Empty v-else-if="!error && !denials.length">
<Empty v-else-if="!error && !decisions.length">
<EmptyHeader><EmptyTitle>No decisions recorded</EmptyTitle></EmptyHeader>
</Empty>
<DataTable
v-else-if="!error || denials.length"
v-else-if="!error || decisions.length"
:columns="columns"
:rows="denials"
:rows="decisions"
:row-key="(d) => `${d.at}:${d.principal}:${d.action}:${d.kind}:${d.resource}:${d.outcome}`"
storage-key="denials"
storage-key="decisions"
>
<template #empty>
<Empty><EmptyHeader><EmptyTitle>No decisions recorded</EmptyTitle></EmptyHeader></Empty>
@@ -82,7 +82,7 @@ onMounted(() => void store.load());
</template>
<template #cell-action="{ row }"><span class="font-mono text-caption">{{ row.action }}</span></template>
<template #cell-principal="{ row }"><span class="font-mono text-caption">{{ row.principal }}</span></template>
<template #cell-resource="{ row }"><span class="font-mono text-caption">{{ denialResource(row) }}</span></template>
<template #cell-resource="{ row }"><span class="font-mono text-caption">{{ decisionResource(row) }}</span></template>
<template #cell-level="{ row }"><Badge variant="idle">{{ row.level }}</Badge></template>
<template #cell-policies="{ row }">
<span class="font-mono text-caption text-fg-muted">{{ row.policies.join(", ") || "–" }}</span>
@@ -1,6 +1,6 @@
/** Access decisions as the dashboard reads them from /api/access/denials:
/** Access decisions as the dashboard reads them from /api/access/decisions:
* one recorded outcome, coalesced per minute into a count. */
export interface Denial {
export interface AccessDecision {
principal: string;
org: string;
action: string;
@@ -13,13 +13,13 @@ export interface Denial {
count: number;
}
export interface DenialsResponse {
denials: Denial[];
export interface AccessDecisionsResponse {
decisions: AccessDecision[];
/** Whether older decisions match beyond this page. */
more: boolean;
}
/** The resource column: the kind and id together, or just the kind. */
export function denialResource(d: Denial): string {
export function decisionResource(d: AccessDecision): string {
return d.resource ? `${d.kind}/${d.resource}` : d.kind;
}
+1 -1
View File
@@ -105,7 +105,7 @@ export const useAuditStore = defineStore("audit", () => {
/** Merges a fresh page one into the loaded feed: an id already on screen
* keeps its place, replaced when the server now sends different content (a
* coalesced denial count, say). An unseen id is returned so the page can
* coalesced access decision count, for example). An unseen id is returned so the page can
* prepend it or hold it behind the new-events button. */
function mergePageOne(incoming: AuditRecord[]): AuditRecord[] {
const positions = new Map(records.value.map((record, index) => [recordKey(record), index]));
+1 -1
View File
@@ -91,7 +91,7 @@ export function suggestionsForRoute(route: SuggestionRoute): string[] {
return [
"Which model is Archie using right now?",
"How do I connect a new repository?",
"Show recent access denials",
"Show recent access decisions",
];
default:
return [
+1 -1
View File
@@ -1,5 +1,5 @@
export const stores = {
denials: {
decisions: {
unavailable: "Decision records are unavailable.",
},
settings: {
+2 -2
View File
@@ -360,8 +360,8 @@ export const api = {
systemHealth: () => request<SystemHealth>("/api/system/health"),
bootstrap: () => request<Bootstrap>("/api/system/bootstrap"),
policies: <T = unknown>() => request<T>("/api/access/policies"),
denials: <T = unknown>(params: QueryParams = {}) =>
request<T>("/api/access/denials" + qs(params)),
decisions: <T = unknown>(params: QueryParams = {}) =>
request<T>("/api/access/decisions" + qs(params)),
putPolicy: (policy: unknown) =>
request<{ version: number }>("/api/access/policies", { method: "PUT", body: policy }),
deletePolicy: (policy: unknown) =>
+1 -1
View File
@@ -35,7 +35,7 @@ const orgSpecs: NavSpec[] = [
sections: [
{
label: "People & access",
paths: ["/org/members", "/org/approvals", "/org/agents", "/org/workspaces", "/org/policies", "/org/denials", "/org/audit"],
paths: ["/org/members", "/org/approvals", "/org/agents", "/org/workspaces", "/org/policies", "/org/decisions", "/org/audit"],
},
{
label: "Agents",
+5 -5
View File
@@ -8,7 +8,7 @@ const MemoryPage = () => import("@/memory/MemoryPage.vue");
const SharedMemoryPage = () => import("@/memory/SharedMemoryPage.vue");
const LogsPage = () => import("@/logs/LogsPage.vue");
const AuditPage = () => import("@/audit/AuditPage.vue");
const DenialsPage = () => import("@/audit/DenialsPage.vue");
const DecisionsPage = () => import("@/audit/DecisionsPage.vue");
const OrgShell = () => import("@/org/OrgShell.vue");
const OrgOverviewPage = () => import("@/org/OrgOverviewPage.vue");
const OrgMembersPage = () => import("@/org/OrgMembersPage.vue");
@@ -280,11 +280,11 @@ export const routes: RouteRecordRaw[] = [
},
},
{
path: "denials",
name: "org-denials",
component: DenialsPage,
path: "decisions",
name: "org-decisions",
component: DecisionsPage,
meta: {
section: "org_denials",
section: "org_decisions",
label: "Access decisions",
navPath: "/org",
description: "Access requests the policy chain allowed or refused, newest first.",
@@ -1,7 +1,7 @@
import { defineStore } from "pinia";
import { reactive, ref } from "vue";
import type { Denial, DenialsResponse } from "@/audit/denials";
import type { AccessDecision, AccessDecisionsResponse } from "@/audit/decisions";
import { errors } from "@/copy/errors";
import { ApiError, api, describeError } from "@/lib/api";
@@ -9,7 +9,7 @@ const PAGE = 100;
/** What narrows the list; an empty field matches everything. `since` and
* `until` are datetime-local values, read in the browser's time zone. */
export interface DenialFilters {
export interface DecisionFilters {
principal: string;
action: string;
kind: string;
@@ -19,14 +19,14 @@ export interface DenialFilters {
until: string;
}
const noFilters = (): DenialFilters => ({ principal: "", action: "", kind: "", outcome: "any", since: "", until: "" });
const noFilters = (): DecisionFilters => ({ principal: "", action: "", kind: "", outcome: "any", since: "", until: "" });
const toISO = (local: string): string => (local ? new Date(local).toISOString() : "");
/** The caller's org's recorded access decisions, newest first, a page at a time. */
export const useDenialsStore = defineStore("denials", () => {
const denials = ref<Denial[]>([]);
const filters = reactive<DenialFilters>(noFilters());
export const useDecisionsStore = defineStore("decisions", () => {
const decisions = ref<AccessDecision[]>([]);
const filters = reactive<DecisionFilters>(noFilters());
const more = ref(false);
const loading = ref(false);
const error = ref("");
@@ -38,7 +38,7 @@ export const useDenialsStore = defineStore("denials", () => {
const mine = ++attempt;
loading.value = true;
try {
const response = await api.denials<DenialsResponse>({
const response = await api.decisions<AccessDecisionsResponse>({
principal: filters.principal.trim(),
action: filters.action.trim(),
kind: filters.kind.trim(),
@@ -46,16 +46,16 @@ export const useDenialsStore = defineStore("denials", () => {
since: toISO(filters.since),
until: toISO(filters.until),
limit: PAGE,
offset: next ? denials.value.length : 0,
offset: next ? decisions.value.length : 0,
});
if (mine !== attempt) return;
denials.value = next ? [...denials.value, ...(response.denials ?? [])] : (response.denials ?? []);
decisions.value = next ? [...decisions.value, ...(response.decisions ?? [])] : (response.decisions ?? []);
more.value = response.more;
error.value = "";
} catch (err) {
if (mine !== attempt) return;
error.value = err instanceof ApiError && err.status === 503
? errors.stores.denials.unavailable
? errors.stores.decisions.unavailable
: describeError(err, errors.common.unknown);
} finally {
if (mine === attempt) loading.value = false;
@@ -67,5 +67,5 @@ export const useDenialsStore = defineStore("denials", () => {
void load();
}
return { denials, filters, more, loading, error, load, clear };
return { decisions, filters, more, loading, error, load, clear };
});