Task: Fix workspace entity model drift: update to latest format and regenerate

Table of Contents

This page documents a task in the Codegen developer experience improvements story. It captures the goal, current status, acceptance, and any notes or results.

1. Goal

Mirror Fix refdata entity model drift for ores.workspace: regenerate every ores.workspace domain_entity and junction model (compass codegen entity list) against current codegen templates. Where a model uses an outdated format/convention rather than the templates having simply moved on, update the model to the current convention before regenerating. Commit the resulting clean tree.

Along the way, apply the same lessons learned fixing refdata's drift: check whether any entity's SQL/domain/messaging layer is explicitly hand-maintained (a doc comment flagging missing paste-block coverage) before doing a full regen – prefer --address-scoped regen for anything so flagged; grep synthetic generators for hardcoded/fabricated soft-FK values (coding scheme codes, lookup-table codes) that don't match what a freshly-recreated default database actually seeds.

2. Status

Field Value
State ABANDONED
Parent story Codegen developer experience improvements
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-10-05

3. Acceptance

  • Every ores.workspace domain_entity and junction model is regenerated via compass codegen entity generate and shows zero diff on a second regen (idempotent).
  • Any model found using an outdated format/convention is updated to the current one before regenerating.
  • Any entity whose SQL/domain/messaging layer is hand-maintained (flagged in its own model doc, mirroring party's) is excluded from a full regen and only its safe facets (e.g. Qt) are regenerated, same as party's treatment in the refdata task.
  • Synthetic generators for FK-referencing fields are checked against actual seed SQL (the default db recreate chain, not optional artefact/dataset scripts) and fixed if they fabricate values that don't exist there.
  • compass build and full rat pass after the regenerated files are committed.
  • No entity outside workspace is touched.

4. 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.)

5. Notes

  • 2026-09-27: the entity's ores.sql.schema facet is switched off (Hotfix: Restore every red build on main). Commit 48f4282df6 committed the four files the facet generates – create/workspace/workspace_workspaces_create.sql, its drop, and the two notify-trigger files – and no aggregator includes them, so validate_schemas.sh refused the tree with four WIRE_001 warnings. They cannot be wired as they stand: they define the same table, the same three indexes and the same ores_workspaces_insert_fn as the wired, hand-written workspace_create.sql, and they drop the party_id and name columns that the hand-written repository reads. The hotfix deleted the four files and set :ores.sql.schema.enabled: false on ores.workspace.workspace.org, with the reasoning on the model page. This task must re-enable the facet, reconcile the generated schema with the hand-written one (cycle guard, resolution-order function, trade scope table, validate function) and re-point create.sql and drop.sql at the result, then delete the hand-written files.
  • The model states its natural key name under a * Natural keys heading. The loader reads keys only from a * Columns section with :natural_key: true (org_loader._split_columns_section), so name is silently absent from every generated artefact. :has_party_id: true is likewise used by no other model and reaches the SQL generator not at all. Both are moved into the current format by this task's first acceptance item.

6. Test Scenarios

Manual QA scenarios (scaffolded via compass add test_scenario, run through the QA Validation Runner panel) that verify this task. Link new ones here as they're created; the scenario doc itself links back via its "Verifies task" field.

Scenario State Notes
     

7. PRs

PR Title
   

8. Review

Comment summary File Decision Notes
       

9. Result

Abandoned on 2026-10-05: ores.workspace is removed by Remove workspaces from every component, so its model has no drift to fix.

Emacs 29.3 (Org mode 9.6.15)