Skip to content

fix(platform): let audit logs be kept for 180 days - #4080

Merged
yannickmonney merged 3 commits into
mainfrom
fix/audit-log-retention-180-days
Oct 2, 2026
Merged

yannickmonney merged 3 commits into
mainfrom
fix/audit-log-retention-180-days

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

Why

Admins could not set audit-log retention below 365 days ("Unter Operator-Untergrenze (min 365 Tage)"). Two things enforced that floor:

  • every organization's seeded governance/retention.yml (auditLog.min: 365), and
  • a hard floor in the bounds schema (RETENTION_COMPLIANCE_FLOORS.auditLog = 365). That floor refused any operator file going lower, so even an operator edit could not allow 180 days: the org's retention editor lost its bounds, and every save failed with RETENTION_CONFIG_MISSING.

What changes

  • Floor 365 → 180 days, in the schema and in the bundled retention.yml. A new organization can keep audit logs for 180–3650 days. The comment now says what the floor is for and how an organization that needs 12 months (PCI DSS 10.5.1) raises it: in its own file or with TALE_RETENTION_AUDIT_MIN. The old comment cited SOC 2 / ISO 27001, neither of which sets a period.
  • A refused bounds file is logged. loadOrgRetentionConfig used to drop the validation error silently. It now logs [retention] bounds file unreadable for org <slug>: …compliance floor violation: auditLog.min >= 180, loginAttempt.min >= 90, matching the governance policy reader. The floor message is built from the floor map, so it can't drift again.
  • Docs-screenshot catalog repaired. tests/e2e/fixtures/config/docs-demo/governance/retention.json still carried the retired promptTemplates category. It had not parsed since July, so demo orgs had no retention bounds. It now matches the builtin catalog.
  • Stale helper copy removed (en/de/fr). Four helpers duplicated the rendered "Allowed: {min}–{max}" line, and two contradicted it: audit logs "30–365" against 180–3650, login attempts "7–365" against 90–365.
  • Docs (en/de/fr, self-hosted retention): the fixed floors, what an operator sees when a file undercuts one, the bundled audit range, and existing orgs (below).

Existing organizations

An org keeps the bounds file it was seeded with; a regular upgrade does not rewrite it. Orgs created before this change still have auditLog.min: 365. To allow 180 days there, the operator sets auditLog.min: 180 in $TALE_CONFIG_DIR/<org>/governance/retention.yml, and an admin applies the bounds proposal under Settings › Governance › Policies & limits. No DB migration: the change only loosens validation, and every existing file stays valid.

Rollback note: an image from before this change refuses a bounds file with auditLog.min below 365. On such an image, an org created by this release (or lowered by an operator) shows no bounds and cannot save its retention policy until the file goes back to 365. Cleanup keeps using the applied snapshot.

Verification

  • New tests: lib/shared/schemas/retention.test.ts (180 accepted; 179 and a login floor of 89 refused, naming both floors), backend/core/governance/shipped_retention.test.ts (both shipped catalogs parse, declare every category, admit 180 audit days, seed a policy inside their own bounds), backend/domains/retention/service.bounds-file.test.ts (refused file logged, missing file quiet). All 9 new assertions fail against main and pass here.
  • Local: retention/governance/schema/guard suites 583/583, platform i18n 185/185, retention editor UI tests 19/19, docs suite 222/222, lint:manual, lint:links, full platform oxlint --type-aware and tsc --noEmit green.
  • Live, on an isolated dev stack with a fresh org:
    • seeded file has auditLog.min: 180;
    • the first-apply proposal lists auditLog: min — → 180;
    • after Apply, the editor shows "Allowed: 180–3650 days"; enabling audit logs at 180 saves, and the summary shows 180 days with the usual 7-day reduction cooldown.
    • With the file at 179: no allowed ranges, the save fails, and the backend logs the floors.
  • Docs pages rendered in en/de/fr on the docs dev server.

Not run locally: backend:integration. CI's Backend integration check covers it; its fixtures use auditLog.min: 365, which stays valid.

The audit-log retention floor was 365 days twice over: the bounds every
new organization is seeded with, and a hard floor in the bounds schema
that refuses any operator file going lower. So no admin could choose
fewer than 365 days, and an operator who lowered the file broke the
organization's retention editor instead.

The hard floor is now 180 days and the bundled bounds start there, so a
new organization can keep audit logs for 180 to 3650 days. PCI DSS asks
for 12 months; an organization bound by it raises the floor in its own
file or through TALE_RETENTION_AUDIT_MIN. A refused file's error now
names every floor instead of pointing at a constant in the source.

The docs-screenshot catalog's bounds file still carried the retired
promptTemplates category, so it never parsed and its organizations had
no bounds; it now matches the builtin catalog, and a test holds both
shipped files to the schema, to every category and to their own seeded
policy.
An organization whose retention.yml exists but does not parse — a floor
below its compliance floor, a retired category — reads as having no
bounds file at all: the editor shows no allowed ranges and every save
fails, and nothing said why. The loader now logs the file's validation
error, naming the floors, the way the governance policy reader does; a
missing file stays quiet.

The self-hosted retention guide documents the fixed floors (audit logs
180 days, login attempts 90), what an operator sees when a file
undercuts one, the bundled 180–3650-day audit range, and that an
organization created by an earlier release keeps auditLog.min: 365 in
its own file until the operator lowers it.
Four retention categories carried a range in their helper text beside
the "Allowed: {min}–{max}" line the editor renders from the operator's
bounds, and two of them contradicted it: audit logs said 30–365 days
where the bounds now allow 180–3650, login attempts 7–365 where they
allow 90–365. The bounds line is the one source; the helper text now
says only what the category deletes, in en, de and fr.
@yannickmonney
yannickmonney merged commit 654f9e9 into main Oct 2, 2026
@yannickmonney
yannickmonney deleted the fix/audit-log-retention-180-days branch October 2, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant