KB-7CC7

07 — Threshold Registry + Label Grouping (display_policy rehearsed; REUSE Đ24)

3 min read Revision 1
registries-pivotthresholddisplay_policylabelsdieu24reuserehearsedgated-RG52026-05-31

title: 07 — Threshold Registry + Label Grouping (Branch E) date: 2026-05-31 gate: RG5 / macro M5. Rehearsed; commit DEFERRED.

07 — Threshold Registry + Label Grouping (Branch E)

Threshold rule (data, not frontend)

  • 50 = MAXIMUM ungrouped display ceiling, not a target. Per-species smaller allowed.
  • If an unclassified list exceeds its ceiling → classification (grouping) required immediately, not pagination.
  • Ceiling MUST be PG data. GAP confirmed: taxonomy_facets.max_labels_per_entity is labels-per-entity, NOT a display ceiling; no per-species ungrouped ceiling column exists.

display_policy (rehearsed GREEN this session)

CREATE TABLE display_policy (
  species_code  text PRIMARY KEY,
  max_ungrouped smallint NOT NULL DEFAULT 50,
  note          text,
  CONSTRAINT display_policy_ceiling_ck CHECK (max_ungrouped > 0 AND max_ungrouped <= 50)  -- 50 = hard MAX
);
-- rows: ('__default__',50), ('dot_tool',30), ('collection',50)

Live demo (this session): of 160 leaves, 28 exceed their PG-resolved ceiling (default from the __default__ row; no literal 50 in the query). The CHECK forbids any ceiling above 50. Alternative homes considered: entity_species.max_ungrouped column, or reuse the existing kg_thresholds (green/yellow/red by dimension) pattern. display_policy preferred (single concern, born+registered).

Labels — REUSE existing Đ24 machinery (no new SoT)

label_rules 38 (facet_id, rule_type, condition jsonb, result_label, priority, **skip_wide_warning**, status) · taxonomy_facets 10 (cardinality, max_labels_per_entity) · taxonomy 58 (hierarchical) · entity_labels 722,803 · species_collection_map 164 (discriminator). Grouping labels come from taxonomy/label_rules applied to entity_labels — never a hardcoded label array in Nuxt.

Pivot-countable label/grouping contract

PIV-311 (entity_labels GROUP BY label_code, count — native-DSL, rehearsed accept) makes the 722,803 labels pivot-counted (today uncounted by any pivot). The grouping path for an over-ceiling list = the facet/label set from taxonomy/label_rules, surfaced via the pivot, never computed client-side.

Each leaf with list_count > resolved_ceiling (28 of 160; e.g. dot_tool 309 vs ceiling 30; birth 985k) must render grouped by its species' facet (via PIV-311 / taxonomy), with the ungrouped view gated behind "show all". No frontend arrays; the ceiling and the grouping dimension both come from PG.

Gate

RG5 / M5. display_policy is NEW (rehearsed valid). Labels = REUSE (no new table). Species-Collection Law v0.5 + Đ36 are DRAFT → grouping that depends on them stays GATED_BY_APPROVAL.

Back to Knowledge Hub knowledge/dev/reports/architecture/registries-pivot-ratify-foundation-commit-preview-campaign-2026-05-31/07-threshold-label-grouping.md