KB-2553

01 — Live State Before Parent Graph Commit

3 min read Revision 1
registries-pivotlive-statepre-commit2026-06-03

01 — Live State Before Parent Graph Commit

Execution channel (verified live)

  • ssh contabo → user root; docker exec postgres psql -U workflow_admin -d directussuperuser RW.
  • Read path: MCP query_pg (read-only role, 5s timeout, LIMIT 500).
  • Classification: EXECUTION_MODE.

pivot_definitions (pre-commit)

metric value
total rows 37
active rows 35
parent_code NULL 37 (flat)
children 0
parent_code-hash 66c0692600dc6a0a1589f00e75862f03

Structurally identical to the prior checkpoint (37 / 0 children / all parent_code NULL). The prior doc's full-row pd_hash 1e31696f… used a different hash recipe; structure matches exactly.

pivot_results / cache

  • pivot_results = 126 rows; needs_refresh = true on 3 rows at entry.

Triggers on pivot_definitions (live)

trigger level/timing function fires on parent_code UPDATE?
trg_after_pivot_definitions_change STATEMENT AFTER (ins/upd/del) trg_pivot_def_refresh YES — runs refresh_meta_catalog_from_pivot() + refresh_pivot_results()
trg_matrix_config_changed ROW AFTER (ins/upd) fn_matrix_config_changed YES — sets pivot_results.needs_refresh=true WHERE pivot_code=NEW.code
trg_birth_pivot_definitions ROW AFTER INSERT only fn_birth_registry_auto NO (INSERT only)

What the refresh functions touch (verified by reading bodies)

  • refresh_pivot_results(): re-runs pivot_query(code) for every active pivot and upserts into pivot_results (bumps refreshed_at, recomputes metric); deletes results for inactive pivots. Cache table only.
  • refresh_meta_catalog_from_pivot(): advisory-locked; updates meta_catalog.record_count/active_count/last_scan_date only when a count actually changes. Cache/derived table only.

⇒ The designed count-refresh side-effect is bounded to pivot_results + meta_catalog. No business/registry source table is mutated. parent_code does not enter any count expression, so count values cannot change from the edge itself (only stale-cache catch-up can).

Views (pre-commit)

  • v_registries_pivot_node_contract: 37 rows, has_children=0 (honest-flat), 23 pivot_backed / 14 PIVOT_MISSING (the group-by pivots whose counts live in child rows).
  • v_registries_pivot_tree: present, flat.

Safety confirmations

  • No RP cleanup mutation planned/executed.
  • No dot-pivot-update execution/registration.
  • Global guard / birth gate untouched.
  • Expected side-effect limited to pivot-result/meta-catalog cache refresh — confirmed by function-body inspection.
Back to Knowledge Hub knowledge/dev/reports/architecture/registries-pivot-parent-graph-commit-and-aggregate-pivots-2026-06-03/01-live-state-before-parent-graph-commit.md