diff --git a/.changeset/38154-trackhistory-comment-field-history-model.md b/.changeset/38154-trackhistory-comment-field-history-model.md new file mode 100644 index 00000000000..a1d3b3a4b53 --- /dev/null +++ b/.changeset/38154-trackhistory-comment-field-history-model.md @@ -0,0 +1,12 @@ +--- +'@objectstack/spec': patch +--- + +docs(spec): the system-module and security-context comments stop listing field `trackHistory` as part of the audit authoring surface + +Clause-②: no +Metadata-protocol: none + +Two source comments in `packages/spec/src/system` described the live audit path as "always-on capture + object/field `trackHistory`". A field's `trackHistory` only opts a media or structured-JSON type into old → new values on the record activity timeline, and its `false` turns nothing off; capture is always on whatever either flag says. The comments now name the object's `enable.trackHistory` as what opens the ledger's view on the record page (and the `history` verb), and say that field-change values on the activity stream are `fieldHistory`'s. The generated security-context reference page follows. + +Comments only: no schema, no accepted key and no refusal changes. Nothing to migrate. diff --git a/content/docs/concepts/metadata-driven.mdx b/content/docs/concepts/metadata-driven.mdx index ac017212d88..6a76a5fd525 100644 --- a/content/docs/concepts/metadata-driven.mdx +++ b/content/docs/concepts/metadata-driven.mdx @@ -484,7 +484,7 @@ export const Account = ObjectSchema.create({ fields: { /* ... */ }, enable: { - trackHistory: true, // Enable field history tracking + trackHistory: true, // Show the audit ledger's field changes on the record page searchable: true, // Include in global search apiEnabled: true, // Expose object via automatic APIs (REST) files: true, // Enable file attachments diff --git a/content/docs/data-modeling/field-types.mdx b/content/docs/data-modeling/field-types.mdx index 026a0d68289..691aa224950 100644 --- a/content/docs/data-modeling/field-types.mdx +++ b/content/docs/data-modeling/field-types.mdx @@ -1060,7 +1060,7 @@ These properties are available on **all** field types: | `defaultValue` | `any` | — | Default value for new records | | `group` | `string` | — | Field grouping / section | | `inlineHelpText` | `string` | — | Inline help tooltip | -| `trackHistory` | `boolean` | — | Render this field's value changes as entries on the record activity timeline | +| `trackHistory` | `boolean` | — | Opt a media or JSON field into old → new values on the record activity timeline; other fields show them already, and `false` does not hide them (that is `fieldHistory: false`) | | `requiredPermissions` | `string[]` | — | Capabilities required to read/edit this field (masked on read, denied on write) | | `dependsOn` | `string[]` | — | Fields whose values scope this field's options (lookup candidate query; select/radio option gating) | | `visibleWhen` | `Expression` | — | Show field only when predicate is true | diff --git a/content/docs/data-modeling/objects.mdx b/content/docs/data-modeling/objects.mdx index dcb7c5189cf..fd6cb1debea 100644 --- a/content/docs/data-modeling/objects.mdx +++ b/content/docs/data-modeling/objects.mdx @@ -78,7 +78,7 @@ Control which platform features are active for this object: ```typescript enable: { - trackHistory: true, // Field history tracking for audit + trackHistory: true, // Show the audit ledger's field changes on the record page searchable: true, // Include in global search index apiEnabled: true, // Expose object via automatic APIs (REST) apiMethods: ['get', 'list', 'create', 'update', 'delete', 'bulk'], @@ -91,7 +91,7 @@ enable: { | Flag | Default | Description | | :--- | :--- | :--- | -| `trackHistory` | `false` | Field history tracking for audit compliance | +| `trackHistory` | `false` | Show the compliance ledger's field changes on the record page and allow the `history` verb. Every write is recorded either way, and a changed field's old → new values show on the activity stream without it — that is `fieldHistory` | | `fieldHistory` | — (on) | Field-change values (`old → new`) on the activity stream; `false` turns them off for the object | | `searchable` | `true` | Index records for global search | | `apiEnabled` | `true` | Expose object via automatic APIs | diff --git a/content/docs/data-modeling/schema-design.mdx b/content/docs/data-modeling/schema-design.mdx index 27be9819da3..5414ad07cf1 100644 --- a/content/docs/data-modeling/schema-design.mdx +++ b/content/docs/data-modeling/schema-design.mdx @@ -65,7 +65,7 @@ Control which features are available for an object: ```typescript enable: { - trackHistory: true, // Track field changes over time + trackHistory: true, // Show the audit ledger's field changes on the record page searchable: true, // Include in global search apiEnabled: true, // Expose object via automatic APIs (REST) apiMethods: [ // Whitelist API operations — six primitives only; diff --git a/content/docs/protocol/objectql/index.mdx b/content/docs/protocol/objectql/index.mdx index 2500763151e..875b0c5d902 100644 --- a/content/docs/protocol/objectql/index.mdx +++ b/content/docs/protocol/objectql/index.mdx @@ -86,7 +86,7 @@ name: customer label: Customer icon: standard:account enable: - trackHistory: true # Track field history + trackHistory: true # Show the audit ledger's field changes searchable: true # Global search indexing apiEnabled: true # Expose object via automatic APIs fields: diff --git a/content/docs/protocol/objectql/schema.mdx b/content/docs/protocol/objectql/schema.mdx index cf4bfd0cb9f..c51526ecd2a 100644 --- a/content/docs/protocol/objectql/schema.mdx +++ b/content/docs/protocol/objectql/schema.mdx @@ -236,7 +236,7 @@ The `enable` object controls which features are active: ```yaml enable: # Data Management - trackHistory: true # Track field history (who changed what, when) + trackHistory: true # Show the audit ledger's field changes (who changed what, when) searchable: true # Index for global search # API & Integration apiEnabled: true # Generate REST endpoints @@ -251,11 +251,11 @@ enable: ``` **Performance Impact:** -- `trackHistory: true` adds write overhead (additional inserts to audit table) +- `trackHistory: true` adds no write overhead: the audit ledger records every write either way, and the flag only shows its field changes on the record page - `searchable: true` adds search indexes (storage overhead) **When to enable:** -- **trackHistory:** Regulated industries, compliance requirements +- **trackHistory:** Users must read who changed which field, and when, on the record page (regulated industries, compliance reviews) - **searchable:** User-facing search features ## Field Definition diff --git a/content/docs/references/system/security-context.mdx b/content/docs/references/system/security-context.mdx index ed080ef1680..d1f8e71f5d3 100644 --- a/content/docs/references/system/security-context.mdx +++ b/content/docs/references/system/security-context.mdx @@ -13,7 +13,8 @@ the four independent security subsystems it was designed against. Three of the four have since been REMOVED per ADR-0056 D8 (declared-but-never-enforced; see system/index.ts notes) — only encryption survives, marked experimental: - **Audit** (`audit.zod.ts` — REMOVED): the live audit path is plugin-audit's - always-on capture + object/field `trackHistory` + lifecycle `audit` retention + always-on capture (an object's `enable.trackHistory` shows its field + changes on the record page) + lifecycle `audit` retention - **Encryption** ([encryption.zod.ts](/docs/references/system/encryption)): Field-level encryption and key management - **Compliance** (`compliance.zod.ts` — REMOVED): GDPR/HIPAA/SOX/PCI-DSS configs - **Masking** (`masking.zod.ts` — REMOVED): PII data masking and tokenization diff --git a/packages/spec/src/system/index.ts b/packages/spec/src/system/index.ts index e6b0a80bf6d..ed30b484ec1 100644 --- a/packages/spec/src/system/index.ts +++ b/packages/spec/src/system/index.ts @@ -42,9 +42,12 @@ export * from './stack-server.zod'; // D8 "design+enforce or remove": the whole module had zero consumers — the LIVE // audit path (plugin-audit) captures unconditionally via engine hooks and defines // its own sys_audit_log row shape, and `AuditConfigSchema.enabled` contradicted -// the always-on compliance-ledger contract (object.zod `trackHistory`). The -// enforced authoring surface is object/field `trackHistory` + the object -// `lifecycle` `audit` category (retention), with per-org overrides in settings. +// the always-on compliance-ledger contract (object.zod `enable.trackHistory`: +// capture is always on, the flag only opens the ledger's view). The enforced +// authoring surface is the object's `enable.trackHistory` (the record page's +// ledger view and the `history` verb) + the object `lifecycle` `audit` category +// (retention), with per-org overrides in settings. Field-change values on the +// activity stream are `fieldHistory`'s, not part of this surface. export * from './logging.zod'; export * from './metrics.zod'; export * from './tracing.zod'; diff --git a/packages/spec/src/system/security-context.zod.ts b/packages/spec/src/system/security-context.zod.ts index e7f55dcf00b..a12e5d86122 100644 --- a/packages/spec/src/system/security-context.zod.ts +++ b/packages/spec/src/system/security-context.zod.ts @@ -14,7 +14,8 @@ import { z } from 'zod'; * the four have since been REMOVED per ADR-0056 D8 (declared-but-never-enforced; * see system/index.ts notes) — only encryption survives, marked experimental: * - **Audit** (audit.zod.ts — REMOVED): the live audit path is plugin-audit's - * always-on capture + object/field `trackHistory` + lifecycle `audit` retention + * always-on capture (an object's `enable.trackHistory` shows its field + * changes on the record page) + lifecycle `audit` retention * - **Encryption** (encryption.zod.ts): Field-level encryption and key management * - **Compliance** (compliance.zod.ts — REMOVED): GDPR/HIPAA/SOX/PCI-DSS configs * - **Masking** (masking.zod.ts — REMOVED): PII data masking and tokenization