Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/38154-trackhistory-comment-field-history-model.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion content/docs/concepts/metadata-driven.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion content/docs/data-modeling/field-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
4 changes: 2 additions & 2 deletions content/docs/data-modeling/objects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion content/docs/data-modeling/schema-design.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion content/docs/protocol/objectql/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions content/docs/protocol/objectql/schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion content/docs/references/system/security-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions packages/spec/src/system/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 2 additions & 1 deletion packages/spec/src/system/security-context.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading