Task: B3: Teach load_org_model() to parse table-only sections

Table of Contents

This page documents a task in the Resolve codegen model unification blockers story. It captures the goal, current status, acceptance, and any notes or results.

Goal

load_org_model() produces a domain_entity model dict that includes all fields previously only available via load_org_table_model(): validation_fn, insert_trigger.validations, has_tenant_id, coding_scheme, image_id. The table loader is not deleted yet.

Status

Field Value
State DONE
Parent story Resolve codegen model unification blockers
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-06-27

Acceptance

  • load_org_model() parses #+has_tenant_id, #+coding_scheme, #+image_id from frontmatter
  • load_org_model() parses * Validation function section into domain_entity.validation_fn
  • load_org_model() parses * Insert trigger / ** Validations org table into domain_entity.insert_trigger.validations
  • Existing entity org files that lack these sections produce identical output to before (no regression)

Plan

(Implementation strategy. Written when work starts; key decisions are distilled into the parent story's * Decisions at close, but the plan itself stays — it is the historical record of what we did.)

Notes

PRs

PR Title
   

Review

Comment summary File Decision Notes
       

Result

Shipped in one commit on feature/codegen-unification-blockers.

Extended org_document_to_model() in codegen/org_loader.py with five new parse paths:

  • Frontmatter scalars (after the existing string-key loop):
    • #+has_tenant_idde["has_tenant_id"] (bool via _parse_typed)
    • #+coding_schemede["coding_scheme"] (raw string; boolean flags computed at render time)
    • #+image_idde["image_id"] (bool via _parse_typed)
  • Sections (after the * SQL block):
    • * Validation function property drawer → de["validation_fn"] dict; default / default_value keys kept as raw strings for Mustache 0-falsy guard
    • * Insert trigger / ** Validations org table → de["insert_trigger"]["validations"] list of row dicts

load_org_table_model() is unchanged; it continues to produce {"table": {...}} as before. All existing entity org files that lack these sections produce identical output (9 smoke tests cover all paths including backward-compat, and 0 component-scaffold regression failures).

Acceptance met:

  • load_org_model() parses #+has_tenant_id, #+coding_scheme, #+image_id from frontmatter. ✓
  • load_org_model() parses * Validation function into domain_entity.validation_fn. ✓
  • load_org_model() parses * Insert trigger / ** Validations into domain_entity.insert_trigger.validations. ✓
  • Existing entity org files without these sections produce identical output. ✓

Emacs 29.1 (Org mode 9.6.6)