PR #304 · pramaan-io/pramaan-functions · merged 2026-06-11
A firm is born with an empty participant-label catalog — and every matter invents its own vocabulary.
Firms provisioned today ship with no default roles; matters, reports, and cross-matter links all hang off that missing roster.
A roster built per-matter never agrees with itself.
The fix — A firm gets its role roster on day one, matters link to a role, and no catalog is ever empty.
sequenceDiagram autonumber participant firm as Firm service participant catalog as Label catalog participant matter as Matter service participant migration as Migration 0091 firm->>catalog: create_firm → seed_default_participant_labels migration->>catalog: upgrade() backfills existing firms matter->>catalog: honor participantLabelId → source_participant_label_id matter->>matter: no participantLabelId? freeform path preserved
| Method | in → out | what it does |
|---|---|---|
seed_default_participant_labels | (session, firm_id, created_by_user_id) → None | opens the role roster for a new firm and stamps the default entries with unique references |
upgrade | () → None | visits every existing firm with an empty catalog and seeds the default label set |
downgrade | () → None | rolls back the seeded defaults so old firms return to their pre-0091 catalog state |
Backfills existing firms with the default participant-label set, allocating a unique reference per firm. Anchors the backfill claim of story 1201.
| new method | signature |
|---|---|
upgrade | () → None |
downgrade | () → None |
revision : strdown_revision : str | Sequence[str] | Nonebranch_labels : str | Sequence[str] | Nonedepends_on : str | Sequence[str] | NoneSeeds a new firm's participant-label catalog atomically with create_firm, stamping the default roles. Anchors the seed-on-provisioning claim of story 1201.
| new method | signature |
|---|---|
seed_default_participant_labels | (session, firm_id, created_by_user_id) → None |