Skip to content

Commit c6c59f1

Browse files
os-zhuangclaude
andauthored
feat(spec)!: remove the dead AuditConfig cluster from @objectstack/spec/system (#1878) (#3593)
The entire system/audit.zod.ts module — AuditConfigSchema, AuditStorageConfig, AuditRetentionPolicy, AuditEventFilter, SuspiciousActivityRule, DEFAULT_SUSPICIOUS_ACTIVITY_RULES, and the AuditEvent* shape schemas — had ZERO consumers repo-wide. The live audit path (plugin-audit) imports none of it: capture is unconditional via engine hooks (compliance ledger), the row shape is owned by plugin-audit's sys_audit_log object, retention rides the object lifecycle `audit` category with per-org settings overrides, and the authoring surface is object/field trackHistory. AuditConfigSchema.enabled even advertised turning the compliance ledger OFF — a semantic the platform deliberately rejects. Same ADR-0056 D8 family as the compliance.zod / masking.zod / RLSAuditConfig / PolicySchema removals. - Delete system/audit.zod.ts + audit.test.ts; drop the export from system/index.ts with a removal note (house pattern). - Drop the 11 manifest ratchet keys; regenerate JSON schemas, reference docs (references/system/audit.mdx removed by regen), and the API surface (21 exports, pure removal). - Fix the stale security-context.zod.ts module doc (audit joins the already removed compliance/masking bullets) and drop the PROTOCOL_MAP.md row (protocol-map gate caught the dangling link). - Annotate the 2026-07 security recheck doc: loose-end #1 done (verified scope = whole module, not just AuditRetentionPolicy); #2 done via #3557. - Changeset (minor per launch-window policy) carries the dead-knob → live- surface migration table. Verified: 6679 spec tests green, tsc clean, check:docs/api-surface/skill-refs/ react-blocks in sync, downstream-contract typecheck clean (gate not pinning any Audit export). Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 0bab8bb commit c6c59f1

13 files changed

Lines changed: 77 additions & 1613 deletions
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
"@objectstack/spec": minor
3+
---
4+
5+
feat(spec)!: remove the dead `AuditConfig` cluster from `@objectstack/spec/system` (#1878 recheck loose-end)
6+
7+
The entire `system/audit.zod.ts` module — `AuditConfigSchema`,
8+
`AuditStorageConfigSchema`, `AuditRetentionPolicySchema`,
9+
`AuditEventFilterSchema`, `SuspiciousActivityRuleSchema`,
10+
`DEFAULT_SUSPICIOUS_ACTIVITY_RULES`, and the `AuditEvent` /
11+
`AuditEventActor` / `AuditEventTarget` / `AuditEventChange` /
12+
`AuditEventType` / `AuditEventSeverity` shape schemas (plus all their
13+
type exports) — is removed. Verified zero consumers repo-wide: the live
14+
audit path (`plugin-audit`) imports none of it, defines its own
15+
`sys_audit_log` row shape, and captures **unconditionally** via engine
16+
hooks, so `AuditConfigSchema.enabled: false` advertised a semantic
17+
(turning the compliance ledger off) the platform deliberately rejects.
18+
Same ADR-0056 D8 family as the earlier `compliance.zod` / `masking.zod` /
19+
`RLSAuditConfig` / `PolicySchema` removals: security/compliance-shaped
20+
config must never merely look live.
21+
22+
**Migration — every dead knob maps to a live surface (or is deliberately
23+
not configurable):**
24+
25+
| Removed (never enforced) | Live replacement |
26+
| --- | --- |
27+
| `AuditConfigSchema.enabled` | none — audit capture is **always on** (compliance ledger; `object.zod` `trackHistory` contract) |
28+
| `eventTypes` / `excludeEventTypes` / `minimumSeverity` / `AuditEventFilterSchema` | none today — if event filtering ships it lands as an `audit` **settings** namespace (ADR-0069 pattern), not app metadata |
29+
| which fields/objects are summarized + History tab UI | object-level + field-level **`trackHistory`** (live, enforced by plugin-audit) |
30+
| `AuditRetentionPolicySchema` / `storage` | object **`lifecycle`** `audit` category (retain → archive → delete) + per-org settings overrides (ADR-0057) |
31+
| `SuspiciousActivityRuleSchema` / `DEFAULT_SUSPICIOUS_ACTIVITY_RULES` | none — no detection engine exists; security monitoring is org-operations tooling, not app-package metadata |
32+
| `AuditEvent*` shape schemas | the `sys_audit_log` object definition in `plugin-audit` is the row-shape source of truth |
33+
34+
No first-party, example, or downstream-contract code imported any of
35+
these symbols; `defineStack` never accepted an `audit` key, so no stack
36+
config changes. Docs page `references/system/audit.mdx` is removed by
37+
regeneration; the security-context module doc now marks audit alongside
38+
the previously removed compliance/masking subsystems.

content/docs/references/system/audit.mdx

Lines changed: 0 additions & 269 deletions
This file was deleted.

content/docs/references/system/index.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ This section contains all protocol schemas for the system layer of ObjectStack.
77

88
<Cards>
99
<Card href="/docs/references/system/app-install" title="App Install" description="Source: packages/spec/src/system/app-install.zod.ts" />
10-
<Card href="/docs/references/system/audit" title="Audit" description="Source: packages/spec/src/system/audit.zod.ts" />
1110
<Card href="/docs/references/system/auth-config" title="Auth Config" description="Source: packages/spec/src/system/auth-config.zod.ts" />
1211
<Card href="/docs/references/system/book" title="Book" description="Source: packages/spec/src/system/book.zod.ts" />
1312
<Card href="/docs/references/system/cache" title="Cache" description="Source: packages/spec/src/system/cache.zod.ts" />

content/docs/references/system/meta.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"translation",
3030
"worker",
3131
"---Observability---",
32-
"audit",
3332
"logging",
3433
"metrics",
3534
"tracing",

content/docs/references/system/security-context.mdx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@ Unified Security Context Protocol
99

1010
Provides a central governance layer that correlates and unifies
1111

12-
the four independent security subsystems:
12+
the four independent security subsystems it was designed against. Three of
1313

14-
- **Audit** (audit.zod.ts): Event logging and suspicious activity detection
14+
the four have since been REMOVED per ADR-0056 D8 (declared-but-never-enforced;
15+
16+
see system/index.ts notes) — only encryption survives, marked experimental:
17+
18+
- **Audit** (audit.zod.ts — REMOVED): the live audit path is plugin-audit's
19+
20+
always-on capture + object/field `trackHistory` + lifecycle `audit` retention
1521

1622
- **Encryption** (encryption.zod.ts): Field-level encryption and key management
1723

18-
- **Compliance** (compliance.zod.ts): Regulatory framework enforcement (GDPR/HIPAA/SOX/PCI-DSS)
24+
- **Compliance** (compliance.zod.ts — REMOVED): GDPR/HIPAA/SOX/PCI-DSS configs
1925

20-
- **Masking** (masking.zod.ts): PII data masking and tokenization
26+
- **Masking** (masking.zod.ts — REMOVED): PII data masking and tokenization
2127

2228
This schema enforces cross-cutting security policies, ensuring compliance
2329

docs/audits/2026-07-security-props-liveness-recheck.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,20 @@ enterprise/cloud-enforced (agent `access`).
5353

5454
## Genuine remaining loose ends (actionable)
5555

56-
1. **Prune `AuditRetentionPolicySchema`** (`packages/spec/src/system/audit.zod.ts`)
57-
— a real parsed-only/dead spec schema with no runtime consumer; retention is
58-
enforced on the `lifecycle` surface. Prune (or wire-rename to `lifecycle`).
59-
2. **SharingRule dead recipient types**`owner`-type rules and `group`/`guest`
60-
recipients are skipped by the bootstrap while criteria-type rules enforce.
61-
Enforce-or-prune the dead subset so authored rules don't silently no-op.
56+
1. ~~**Prune `AuditRetentionPolicySchema`**~~**✅ Done (2026-07-27)**, and the
57+
verified scope was larger: the **entire `audit.zod.ts` module** (AuditConfig /
58+
AuditStorageConfig / AuditRetentionPolicy / AuditEventFilter /
59+
SuspiciousActivityRule + the AuditEvent* shape schemas) had zero consumers —
60+
the live audit path (plugin-audit) captures unconditionally via engine hooks
61+
and defines its own `sys_audit_log` row shape, and `AuditConfigSchema.enabled`
62+
contradicted the always-on compliance-ledger contract. Whole module removed;
63+
the enforced authoring surface is object/field `trackHistory` + the object
64+
`lifecycle` `audit` category, with per-org overrides in settings.
65+
2. ~~**SharingRule dead recipient types**~~**✅ Done (#3557)**: recipients
66+
reconciled against the live identity model — `group` wired as `team`,
67+
`business_unit` added, and the unenforceable `guest` recipient + `owner`-type
68+
rules removed from the authoring surface (authored rules no longer silently
69+
no-op).
6270
3. **Per-org / per-user IP allow-list** — global-only today; per-org
6371
`sys_organization.allowed_ip_ranges` is unimplemented (tracked **#2571**).
6472
4. **Doc / ledger drift** (non-code-behavior):

packages/spec/PROTOCOL_MAP.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ This document serves as the **Grand Map** of the ObjectStack specification. It l
136136
| [`auth-config.zod.ts`](src/system/auth-config.zod.ts) | | **Auth Configuration**. SSO, OIDC, SAML settings. |
137137
| [`http-server.zod.ts`](src/system/http-server.zod.ts) | | **HTTP Server**. Server port, CORS, and middleware settings. |
138138
| [`logging.zod.ts`](src/system/logging.zod.ts) | | **Logging**. Log levels and output formats. |
139-
| [`audit.zod.ts`](src/system/audit.zod.ts) | | **Audit Trail**. Audit logging configuration. |
140139
| [`cache.zod.ts`](src/system/cache.zod.ts) | | **Caching**. Redis/Memory cache strategies. |
141140
| [`metrics.zod.ts`](src/system/metrics.zod.ts) | | **Observability**. Prometheus/OpenTelemetry metrics. |
142141
| [`tracing.zod.ts`](src/system/tracing.zod.ts) | | **Tracing**. Distributed tracing configuration. |

packages/spec/api-surface.json

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -610,24 +610,6 @@
610610
"AppTranslationBundleSchema (const)",
611611
"AudienceBook (interface)",
612612
"AudienceCaller (interface)",
613-
"AuditConfig (type)",
614-
"AuditConfigSchema (const)",
615-
"AuditEvent (type)",
616-
"AuditEventActor (type)",
617-
"AuditEventActorSchema (const)",
618-
"AuditEventChange (type)",
619-
"AuditEventChangeSchema (const)",
620-
"AuditEventFilter (type)",
621-
"AuditEventFilterSchema (const)",
622-
"AuditEventSchema (const)",
623-
"AuditEventSeverity (type)",
624-
"AuditEventTarget (type)",
625-
"AuditEventTargetSchema (const)",
626-
"AuditEventType (type)",
627-
"AuditRetentionPolicy (type)",
628-
"AuditRetentionPolicySchema (const)",
629-
"AuditStorageConfig (type)",
630-
"AuditStorageConfigSchema (const)",
631613
"AuthConfig (type)",
632614
"AuthConfigSchema (const)",
633615
"AuthPluginConfig (type)",
@@ -732,7 +714,6 @@
732714
"CursorStyleSchema (const)",
733715
"CursorUpdate (type)",
734716
"CursorUpdateSchema (const)",
735-
"DEFAULT_SUSPICIOUS_ACTIVITY_RULES (const)",
736717
"DashboardLike (interface)",
737718
"DataClassification (type)",
738719
"DataClassificationPolicy (type)",
@@ -1174,8 +1155,6 @@
11741155
"SupplierSecurityPolicySchema (const)",
11751156
"SupplierSecurityRequirement (type)",
11761157
"SupplierSecurityRequirementSchema (const)",
1177-
"SuspiciousActivityRule (type)",
1178-
"SuspiciousActivityRuleSchema (const)",
11791158
"SystemFieldName (type)",
11801159
"SystemObjectName (type)",
11811160
"SystemUserId (type)",

packages/spec/json-schema.manifest.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,16 +1263,6 @@
12631263
"system/AppInstallResult",
12641264
"system/AppManifest",
12651265
"system/AppTranslationBundle",
1266-
"system/AuditConfig",
1267-
"system/AuditEvent",
1268-
"system/AuditEventActor",
1269-
"system/AuditEventChange",
1270-
"system/AuditEventFilter",
1271-
"system/AuditEventSeverity",
1272-
"system/AuditEventTarget",
1273-
"system/AuditEventType",
1274-
"system/AuditRetentionPolicy",
1275-
"system/AuditStorageConfig",
12761266
"system/AuthConfig",
12771267
"system/AuthPluginConfig",
12781268
"system/AuthProviderConfig",
@@ -1533,7 +1523,6 @@
15331523
"system/SupplierSecurityAssessment",
15341524
"system/SupplierSecurityPolicy",
15351525
"system/SupplierSecurityRequirement",
1536-
"system/SuspiciousActivityRule",
15371526
"system/Task",
15381527
"system/TaskExecutionResult",
15391528
"system/TaskPriority",

0 commit comments

Comments
 (0)