PR #271 · pramaan-io/pramaan-functions · merged 2026-06-08
Forums you can't quote are forums that get lost.
Why a human-readable forum number matters.
Two firms. Two F-001s. One confused counsel.
The fix — One firm-scoped slip, allocated once, formatted once, never reissued.
sequenceDiagram autonumber participant client as Client participant service as Forum Service participant alloc as Reference Allocator participant db as Reference Counter (DB) participant fmt as Formatter client->>service: create forum service->>alloc: allocate_reference(firm, 'forum') alloc->>db: increment counter atomically db->>alloc: next integer alloc->>service: return integer service->>service: persist Forum with forum_number service->>fmt: format_forum_ref(n) fmt->>service: F-001 service->>client: ForumView
| Method | in → out | what it does |
|---|---|---|
_create_support_reference_counter_policies | () → None | |
_drop_support_reference_counter_policies | () → None | |
_replace_reference_kind_constraint | (include_forum) → None |
Extends the counter kind check to admit 'forum', adds RLS policies, seeds per-firm counters via deterministic backfill. Maps to counter-reuse + migration claim.
| new method | signature |
|---|---|
_create_support_reference_counter_policies | () → None |
_drop_support_reference_counter_policies | () → None |
_replace_reference_kind_constraint | (include_forum) → None |
upgrade | () → None |
downgrade | () → None |
revision : strdown_revision : str | Sequence[str] | Nonebranch_labels : str | Sequence[str] | Nonedepends_on : str | Sequence[str] | NoneAdds the integer forum_number field on the Forum entity, allocated for new forums and backfilled for existing ones by the migration.
forum_number : intNew formatter turning a forum number integer into the human-readable F-zero-zero-one string. Maps to format claim.
| new method | signature |
|---|---|
format_forum_ref | (forum_number) → str |
Exposes forum_number and forum_number_formatted on the ForumView DTO. Maps to format claim.
forum_number : intforum_number_formatted : strReference counter model that allocate_reference reads and increments atomically per firm and kind. Maps to counter-reuse claim.
| new class | signature |
|---|---|
ReferenceCounter | (type) |