KB-7531

S143 Auto-ID Cleanup Report

4 min read Revision 1
reports143auto-idcleanupdirectus-flows

S143: Disable Redundant AUTO-ID Flows

Date: 2026-03-19 Status: COMPLETE Predecessor: S142 (discovered root cause)

Assembly Gate

# Question Answer
Q0 PG triggers exist? YES — 19 trg_auto_code_* triggers covering all managed collections
Q1 Directus flows needed? NO — PG triggers replace all AUTO-ID flows
Q2-Q5 N/A Only disabling flows, no new code

Flow → PG Trigger Mapping

Flow Name Collection PG Trigger Status Before → After
[AUTO-ID] Agents agents trg_auto_code_agents inactive → inactive (S142)
[AUTO-ID] Checkpoint Sets checkpoint_sets trg_auto_code_checkpoint_sets active → inactive
[AUTO-ID] Checkpoint Types checkpoint_types trg_auto_code_checkpoint_types active → inactive
[AUTO-ID] Collections collection_registry trg_auto_code_collection_registry active → inactive
[AUTO-ID] DOT Tools dot_tools trg_auto_code_dot_tools active → inactive
[AUTO-ID] Meta Catalog meta_catalog trg_auto_code_meta_catalog active → inactive
[AUTO-ID] Modules modules trg_auto_code_modules active → inactive
[AUTO-ID] Pages ui_pages trg_auto_code_ui_pages active → inactive
[AUTO-ID] Table Registry table_registry trg_auto_code_table_registry active → inactive
[AUTO-ID] Tasks tasks trg_auto_code_tasks active → inactive
[AUTO-ID] WCR workflow_change_requests trg_auto_code_workflow_change_requests active → inactive
[AUTO-ID] Workflow Steps workflow_steps trg_auto_code_workflow_steps active → inactive
[AUTO-ID] Workflows workflows trg_auto_code_workflows active → inactive

Total: 13 flows disabled (12 in S143 + 1 in S142)

Code Field Fixes

For collections with NOT NULL + required=true on code columns (same pattern as S142 agents fix):

Collection Field PG Default Set Directus required=false
checkpoint_sets code '' YES
collection_registry code '' YES
dot_tools code '' YES
meta_catalog code '' YES
modules code '' YES
ui_pages code '' YES
table_registry table_id '' YES

POST Test Results

Collection HTTP Code Generated Cleaned Up
dot_tools 200 DOT-230 YES
meta_catalog 200 CAT-100 NO (delete guard)
ui_pages 200 PG-038 YES
workflows 200 WF-004 YES

Note: When creating items via API without AUTO-ID flows, callers must send code: "" (empty string) explicitly. The PG trigger catches empty strings and generates the real code. Sending NULL or omitting the field may cause Directus unique constraint validation to fail.

Verification

# Condition Result
1 Full list of AUTO-ID flows 13 flows identified
2 Each flow has PG trigger 13/13 matched
3 All flows inactive 13/13 inactive
4 POST test 3+ collections 4/4 passed (dot_tools, meta_catalog, ui_pages, workflows)
5 verify_counts 0 MISMATCH 19/19 OK
6 Health check 3/4 PASS (auth FAIL is pre-existing)

Residual Note

  • CAT-100 test record in meta_catalog could not be deleted (fn_guard_meta_catalog_delete blocks DELETE). Should be deprecated/retired in future cleanup.
  • Auth flow health check FAIL is pre-existing, not related to S143.