Skip to content

ADR-0090 D3 rename miss: exported RLSUserContextSchema still carries a dead role field #2722

Description

@os-zhuang

What

`packages/spec/src/security/rls.zod.ts` still exports `RLSUserContextSchema` with a `role: string | string[]` field ("User role(s)"), missed by the P1 breaking wave (#2697).

Why it's wrong

  • ADR-0090 D3 makes "role" a reserved-forbidden word; the canonical membership field is `positions`.
  • The runtime never consumes this schema field: `packages/plugins/plugin-security/src/rls-compiler.ts` defines its own local `RLSUserContext` interface, which already uses `positions?: string[]`. The spec export is dead surface documenting a vocabulary that no longer exists (it also leaks into the auto-generated `content/docs/references/security/rls.mdx`).

Fix

Rename `role` → `positions` (`z.array(z.string())`) or delete the field in favor of the runtime shape. This is an exported-type change in the frozen spec surface (ADR-0059 §4) — either take it as part of the next spec major, or treat it as the documented dead/renderless-export exception (precedent: PR #2272). Regenerate `references/security/rls.mdx` afterwards.

Found while aligning docs + showcase to ADR-0090 (P4 follow-up).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions