Skip to content

Policy naming

This page is generated from the PhiSQL spec artifacts for v1.0. Do not edit it by hand; change the artifact and rebuild.

The Phileas JSON policy schema has no top-level name or description field; policy identity comes from the filename. These rules bridge that convention with PhiSQL's optional POLICY declaration.

Policy name

The policy name is the file basename (with the .phisql or .json extension stripped). This matches the existing convention in philterd/pii-redaction-policies and how Phileas resolves policies by name today.

The POLICY declaration

The POLICY declaration inside a PhiSQL document is optional. A PhiSQL file containing only REDACT / DEIDENTIFY / IGNORE statements is well-formed and compiles successfully.

Consistency rule

When the filename is known and a POLICY name is declared, the declared name must match the file basename after normalization (hyphens and underscores are treated as equivalent). A mismatch is a compile error.

Catches the common bug where someone copies a .phisql file to a new name and forgets to update the POLICY declaration inside.

Compiling from a string

When PhiSQL is compiled from a string with no associated filename (e.g., embedded in a tool's UI, included in another configuration format), the POLICY declaration is the only source of the name. If absent, the policy name is null and the caller must provide one.

The DESCRIPTION clause

The DESCRIPTION '' clause, when present on a POLICY declaration, compiles to the policy's human-readable description. The Phileas JSON schema has no description field, so the destination is a sibling Markdown file named .md. The compiler returns the description text on CompileResult; writing the file is the caller's choice.