Skip to content

generate_mock_register.py invents rows for a schema the app already seeds, so demo data duplicates the catalogue #735

Description

@rubenvdlinde

hydra-gates/scripts/lib/generate_mock_register.py generates a mock object for
every schema it finds. It has no notion of "this schema is a catalogue the app
seeds itself", so for any app that ships seed rows in register.d and ships
demo data, installing demo data duplicates the catalogue.

Measured on dossiq

register.d/96-integrations.json seeds twelve dossiqIntegration rows with
stable slugs. The generator emitted three more:

key seeded slug generated slug
zgw integration-zgw dossiqintegration-dossiqintegration-1-1
stuf integration-stuf dossiqintegration-dossiqintegration-2-2
brp integration-brp dossiqintegration-dossiqintegration-3-3

ImportHandler upserts a seed object on (register, schema, slug), so the two
spellings never collapse. An instance with demo data installed shows two BRP
rows and two ZGW rows
.

Why it costs more than a duplicate row

It presents as a product defect somewhere else entirely. On dossiq it broke two
E2E tests, and neither pointed here:

  • a Playwright strict-mode violation, two rows matching /BRP/i
  • status: error for StUF, from a generated row asserting Circuit open on Gemeente Zuida connection failure nobody measured, invented by the
    generator to fill a status field

That second one is the part worth fixing upstream rather than per app. A
generator that fills an enum by picking a value will eventually pick the one that
means "something is broken", and a demo instance then reports an outage that does
not exist.

Suggested shape

An opt-out the app can declare, so the exclusion lives next to the seed that
causes it. Either:

  • a marker on the schema (x-hydra-mock: false, or reuse an existing annotation), or
  • a generator input listing schemas to skip, defaulted from the schemas that
    register.d already seeds objects for, which the generator can see.

The second needs no per-app change at all: if a schema has seed objects in
register.d, the app has said what its rows are, and inventing more is never
right.

Worked around for now

dossiq#2304 removes the three rows and adds a mutation-checked guard test, so a
regeneration that puts them back fails loudly. That guard is per app, which is
why this is filed here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions