Skip to content

fix(bank-template): export keeps entity_labels stored in the attributes envelope - #6106

Merged
nicoloboschi merged 2 commits into
mainfrom
fix/export-entity-labels-envelope
Oct 26, 2026
Merged

nicoloboschi merged 2 commits into
mainfrom
fix/export-entity-labels-envelope

Conversation

@nicoloboschi

Copy link
Copy Markdown
Collaborator

Fixes #6057.

Problem: a bank whose labels were set through PATCH /config or the control plane stores them as {"attributes": [...]}. Export only accepted the bare list, so it dropped entity_labels (warning in server logs only). Importing that export gave a bank with no label taxonomy.

Fix: migrate_entity_labels_input unwraps the envelope, same as parse_entity_labels. Applies to export, import and dry-run extract.

Full audit of export/import (tests added so it can't regress):

  • Every per-bank config field is on the template model (already guarded).
  • New: every config field set through the config API (not via import) survives export → import. Parametrized over every alternate shape the config API accepts (_CONFIG_API_ALTERNATE_SHAPES: envelope, legacy free_values/multi_value). The envelope case failed before the fix.
  • New: every mental model field, every trigger field and every directive field, set away from its default, survives export → import; coverage test fails if a new field gets no sample.
  • No other field was lost.

…utes": [...]} envelope (#6057)

Banks configured through PATCH /config or the control plane store entity_labels
as the {"attributes": [...]} envelope. The template model only unwrapped bare
lists, so export dropped the whole label taxonomy with a server-side warning
and an export->import clone lost it.

migrate_entity_labels_input now unwraps the envelope (as parse_entity_labels
does). New tests seed every config field through the config API — plus each
alternate shape it accepts — and assert export keeps all of them; another sets
every mental model, trigger and directive field and checks a clone exports the
same thing.
…onfig API surviving export/import

Review fixes:
- add a hindsight-system-tests story (#6057 is a seam bug: config API -> export -> import)
- move test imports to module top
@nicoloboschi
nicoloboschi merged commit c5242eb into main Oct 26, 2026
110 checks passed
@nicoloboschi
nicoloboschi deleted the fix/export-entity-labels-envelope branch October 26, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: bank template export silently drops entity_labels stored in the {"attributes": [...]} envelope GET /config returns

1 participant