KB-71E8

P3D Pack 1 Phase 5C1A — Species Schema + Parent Probe Report

13 min read Revision 1
p3dpack1phase5c1aprobereportreadonly2026-05-11

P3D Pack 1 Phase 5C1A — Species Schema + Parent Probe Report

Date: 2026-05-11 Executor: Opus 4.7 Mode: READ-ONLY introspection (Phase 1→2→3) DB: VPS postgres container, db=directus, schema=public Prompt: knowledge/dev/laws/dieu44-trien-khai/prompts/p3d-pack1-phase5c1a-readonly-species-schema-parent-probe-prompt.md (rev2) Mutations performed: NONE


A. Phase 1 — Raw schema results

Q1 — entity_species columns (18 rows)

column data_type nullable default maxlen
id integer NO nextval('entity_species_id_seq')
sort integer YES
user_created uuid YES
date_created timestamp with time zone YES
user_updated uuid YES
date_updated timestamp with time zone YES
code character varying NO 255
species_code character varying NO 255
display_name character varying NO 255
composition_level character varying NO 255
management_mode character varying NO 'governed' 255
prefix character varying YES 255
description text YES
status character varying NO 'active' 255
_dot_origin character varying YES 'DIRECTUS' 255
parent_id integer YES
depth integer YES 1
kg_metadata jsonb YES '{}'

Q2 — entity_species constraints

constraint_name type column
entity_species_pkey PRIMARY KEY id
entity_species_code_unique UNIQUE code
entity_species_species_code_unique UNIQUE species_code

No FK declared on parent_id at DB level.

Q3 — species_collection_map columns (13 rows)

column data_type nullable default maxlen
id integer NO nextval('species_collection_map_id_seq')
sort integer YES
user_created uuid YES
date_created timestamp with time zone YES
user_updated uuid YES
date_updated timestamp with time zone YES
species_code character varying NO 255
collection_name character varying NO 255
is_primary boolean NO true
discriminator_field character varying YES 255
discriminator_value character varying YES 255
discriminator_operator character varying YES 255
discriminator_config json YES

Q4 — species_collection_map constraints

constraint_name type column
species_collection_map_pkey PRIMARY KEY id

No UNIQUE on (collection_name) or (species_code, collection_name). No FK declared at DB level.

Q5 — birth_registry columns (19 rows)

column data_type nullable default maxlen
id integer NO nextval('birth_registry_id_seq')
sort integer YES
user_created uuid YES
date_created timestamp with time zone YES
user_updated uuid YES
date_updated timestamp with time zone YES
entity_code character varying NO 255
collection_name character varying NO 255
species_code character varying YES 255
composition_level character varying YES 255
dot_origin character varying YES 255
born_at timestamp with time zone YES CURRENT_TIMESTAMP
governance_role character varying YES 255
inspect_pen timestamp with time zone YES
inspect_stamp timestamp with time zone YES
inspect_gate timestamp with time zone YES
certified boolean NO false
certified_at timestamp with time zone YES
status character varying YES 'born' 50

B. Phase 2 — Concept → column resolution

entity_species

Concept Resolved column Status
species_pk id RESOLVED
species_identifier species_code RESOLVED (only candidate present)
species_entity_code code RESOLVED
species_display_label display_name RESOLVED
species_composition composition_level RESOLVED
species_management management_mode RESOLVED
species_status status RESOLVED
species_depth depth RESOLVED
species_parent_ref parent_id RESOLVED
species_prefix prefix RESOLVED
species_kg_metadata kg_metadata RESOLVED
species_dot_origin _dot_origin RESOLVED

species_collection_map

Concept Resolved column Status
mapping_pk id RESOLVED
mapping_collection_key collection_name RESOLVED
mapping_species_identifier species_code RESOLVED
mapping_primary_flag is_primary RESOLVED
mapping_disc_field discriminator_field RESOLVED
mapping_disc_value discriminator_value RESOLVED
mapping_disc_operator discriminator_operator RESOLVED
mapping_disc_config discriminator_config RESOLVED

birth_registry

Concept Resolved column Status
birth_pk id RESOLVED
birth_collection_key collection_name RESOLVED
birth_species_identifier species_code RESOLVED
birth_composition composition_level RESOLVED
birth_entity_key entity_code RESOLVED

Totals: RESOLVED=25, FIELD_ABSENT=0, AMBIGUOUS_FIELD=0. phase2_resolution_complete=true.


C. Phase 3 — Evidence

Q6 — Collision check for proposed species

Query result: 0 rows. No row has species_code='information_unit_atom' or code='SPE-IUA'. → proposed_species_collision=false.

Q7 — _dot_origin policy

  • column: _dot_origin | data_type: character varying(255) | is_nullable: YES | column_default: 'DIRECTUS'
  • Policy: nullable + defaulted → INSERTs may omit; will be auto-set to 'DIRECTUS' if not provided.

Q8 — kg_metadata policy

  • column: kg_metadata | data_type: jsonb | is_nullable: YES | column_default: '{}'::jsonb
  • Policy: nullable + defaulted → INSERTs may omit; default {} applied.

Q9 — Taxonomy depth + parent distribution

Depth distribution:

depth species_count
1 40

All 40 species exist at depth=1 (the schema default). No depth=0 row exists. Every row has parent_id IS NULL. Effectively this is a flat root list — no internal taxonomy parent has been seeded.

Full dump (40 rows) — all parent_id NULL:

13|agent|SPE-AGT|Agent
27|ai_support|SPE-AIS|Hỗ trợ AI
34|approval_request|SPE-APP|Yeu cau phe duyet
26|business_support|SPE-BZS|Hỗ trợ Kinh doanh
4|catalog|SPE-CAT|Danh muc he thong
15|checkpoint_set|SPE-CPS|Bo checkpoint
28|checkpoint_support|SPE-CKS|Hỗ trợ Checkpoint
14|checkpoint_type|SPE-CPT|Loai checkpoint
22|cms_block|SPE-BLK|CMS Block
11|collection|SPE-COL|Collection
16|dependency|SPE-DEP|Phu thuoc
3|directus_field|SPE-DXF|Directus Field
1|dot_tool|SPE-DOT|DOT Tool
2|entity_label|SPE-LBL|Entity Label
20|entity_rule|SPE-ERL|Quy tac thuc the
43|governance_agency|SPE-GAG|Cơ quan Quản trị
29|governance_infra|SPE-GOV|Hạ tầng Giám sát
40|governance_relation|SPE-GRL|Liên kết Quản trị
33|help_center|SPE-HLP|Trung tâm Trợ giúp
31|junction_table|SPE-JCT|Bảng Liên kết
38|jurisdiction|SPE-JUR|Phạm vi Pháp lý
17|label_facet|SPE-FAC|Chieu phan loai
18|label_rule|SPE-LBR|Quy tac gan nhan
37|law|SPE-LAW|Văn bản Luật
41|law_enforcement|SPE-ENF|Thực thi DOT-Luật
6|module|SPE-MOD|Module
25|os_crm|SPE-OSC|OS CRM
10|page|SPE-PGE|Trang UI
36|pivot_result|SPE-PVR|Ket qua Pivot
19|species|SPE-SPE|Loai
32|system_backup|SPE-SYS|Hệ thống/Backup
21|system_issue|SPE-ISS|Van de he thong
30|system_log|SPE-LOG|Nhật ký Hệ thống
5|table_ui|SPE-TBL|Bang UI
12|task|SPE-TSK|Nhiem vu
9|wcr|SPE-WCR|De xuat thay doi
24|website_content|SPE-WEB|Nội dung Website
23|website_page|SPE-PGW|Trang Website
7|workflow|SPE-WKF|Quy trinh
8|workflow_step|SPE-WFS|Buoc quy trinh

Q10 — Parent candidates

The prompt requests "all depth-0 species". Live taxonomy has no depth=0 row; the lowest existing tier is depth=1, populated by 40 roots (all parent_id NULL). Interpreting "root tier" as the candidate pool, all 40 rows above are parent candidates.

All labelled candidate_not_approved. Agent makes no recommendation. GPT/User must lock the parent (or decline a parent and define a new depth=0 root) before 5C1 rev1.

parent_candidates_count = 40

Q11 — Existing mapping for information_unit

Query: SELECT * FROM species_collection_map WHERE collection_name='information_unit'; Result: 0 rows. → info_unit_mapping_exists=false.

Q12 — birth_registry rows for information_unit with NULL species

Query: SELECT count(*) FROM birth_registry WHERE collection_name='information_unit' AND species_code IS NULL; Result: 12. Matches Phase 5A evidence. → info_unit_null_species_count=12.


D. Bonus — Live fill-policy matrix

entity_species

column type nullable default fill_policy
id integer NO nextval(...) DB_AUTO
sort integer YES NULLABLE_SKIP
user_created uuid YES NULLABLE_SKIP
date_created timestamptz YES NULLABLE_SKIP
user_updated uuid YES NULLABLE_SKIP
date_updated timestamptz YES NULLABLE_SKIP
code varchar(255) NO NEEDS_VALUE
species_code varchar(255) NO NEEDS_VALUE
display_name varchar(255) NO NEEDS_VALUE
composition_level varchar(255) NO NEEDS_VALUE
management_mode varchar(255) NO 'governed' DB_DEFAULT
prefix varchar(255) YES NULLABLE_SKIP
description text YES NULLABLE_SKIP
status varchar(255) NO 'active' DB_DEFAULT
_dot_origin varchar(255) YES 'DIRECTUS' DB_DEFAULT (nullable)
parent_id integer YES NULLABLE_SKIP
depth integer YES 1 DB_DEFAULT (nullable)
kg_metadata jsonb YES '{}' DB_DEFAULT (nullable)

NEEDS_VALUE columns for 5C1 INSERT into entity_species: code, species_code, display_name, composition_level.

species_collection_map

column type nullable default fill_policy
id integer NO nextval(...) DB_AUTO
sort integer YES NULLABLE_SKIP
user_created uuid YES NULLABLE_SKIP
date_created timestamptz YES NULLABLE_SKIP
user_updated uuid YES NULLABLE_SKIP
date_updated timestamptz YES NULLABLE_SKIP
species_code varchar(255) NO NEEDS_VALUE
collection_name varchar(255) NO NEEDS_VALUE
is_primary boolean NO true DB_DEFAULT
discriminator_field varchar(255) YES NULLABLE_SKIP
discriminator_value varchar(255) YES NULLABLE_SKIP
discriminator_operator varchar(255) YES NULLABLE_SKIP
discriminator_config json YES NULLABLE_SKIP

NEEDS_VALUE columns for 5C1 INSERT into species_collection_map: species_code, collection_name.

fill_policy_matrix_complete=true.


E. Status block

phase5c1a_probe_status=PASS
report_path=knowledge/dev/laws/dieu44-trien-khai/reports/p3d-pack1-phase5c1a-species-schema-parent-probe-report.md
no_mutation_performed=true
entity_species_schema_discovered=true
mapping_schema_discovered=true
birth_registry_schema_discovered=true
phase2_resolution_complete=true
phase2_field_absent_count=0
phase2_ambiguous_count=0
proposed_species_collision=false
kg_metadata_policy=defaulted
dot_origin_policy=defaulted
parent_candidates_count=40
info_unit_mapping_exists=false
info_unit_null_species_count=12
fill_policy_matrix_complete=true
next_recommended_action=GPT/User locks species identity + parent from probe evidence then Opus writes 5C1 rev1

Critical observations / blocker notes

  1. No depth=0 layer exists. Schema default for depth is 1; all 40 rows sit at depth=1 with parent_id NULL. The prompt's "list all depth-0 species" requirement is structurally unsatisfiable as-written. Interpreted as "root tier" (depth=1, parent_id NULL) → 40 candidates.
  2. No FK on parent_id at DB level — taxonomy is enforced application-side only.
  3. No UNIQUE constraint on species_collection_map.collection_name nor on (species_code, collection_name) — duplicate mappings are physically permitted; 5C1 must check before INSERT.
  4. Composition_level / management_mode are free-text varchar(255) — no CHECK constraint or enum. 5C1 must source allowed values from a governance reference, not DB.
  5. information_unit collection has 0 mapping rows and 12 birth_registry rows with NULL species_code — confirms the gap 5C1 is intended to close.
  6. kg_metadata, _dot_origin, depth all nullable + defaulted → safe to omit in 5C1 INSERT; DB will fill.

Phase 5C1A probe executed | read-only | 0 mutations | 2026-05-11

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reports/p3d-pack1-phase5c1a-species-schema-parent-probe-report.md