Skip to content

Compliance Templates — Slice 2: all value types + typed inputs + value-type engine #707

Description

@larsgeorge-db

Parent PRD

#676

What to build

Extend the skeleton (#706) from String-only to the full value-type set: String, Numeric, Enum (single), MultiEnum (multi-select), Date, Range ({low, high}, low <= high), Boolean. Admin picks a field's type (and, for Enum/MultiEnum, its controlled value list); the fill modal renders the matching typed input; values are validated/coerced on write.

The core deliverable is a pure value-type engine (its own module, no DB/HTTP) holding all validation/coercion and "is-set" semantics, with table-driven unit tests — mirroring the existing pure compliance-DSL evaluator tests. See PRD Value types and Testing Decisions §1.

  • Backend — value-type engine: validate/coerce per type + controlled vocabulary (Enum membership, MultiEnum subset, Numeric parsing, Date parsing, Range ordering, Boolean, String empty/whitespace); reject ill-typed values. Wire it into the write path. Reuse the tag-validator controlled-vocabulary pattern (models/tags.py).
  • Frontend — typed inputs in the modal: text (String), number (Numeric), single-select (Enum), multi-select (MultiEnum), date picker (Date), low/high pair (Range), checkbox (Boolean); admin field editor gains a type picker + enum-vocabulary editor.

Acceptance criteria

  • All seven value types definable by an admin; Enum/MultiEnum carry a controlled value list
  • Pure value-type engine module validates/coerces every type and computes "is-set" (Boolean false = set; MultiEnum needs ≥1; Range needs both bounds; String non-empty/non-whitespace)
  • Ill-typed or out-of-vocabulary values are rejected on write with a clear error
  • Range enforces low <= high
  • Modal renders the correct typed input per field type; can't submit an invalid value
  • Table-driven unit tests cover every type incl. edge cases (mirror compliance-DSL evaluator test style)

Blocked by

User stories addressed

  • User story 3
  • User story 7
  • User story 17

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions