Skip to content

feat(demo): generated demo data for every schema (ADR-111) - #766

Closed
rubenvdlinde wants to merge 1 commit into
mainfrom
feat/demo-data-adr-111
Closed

feat(demo): generated demo data for every schema (ADR-111)#766
rubenvdlinde wants to merge 1 commit into
mainfrom
feat/demo-data-adr-111

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Implements ADR-111 rules 1–2 (ConductionNL/hydra, merged). Enforcement is ConductionNL/.github#590.

Why

This app declares schemas and shipped no demo data, so it opened on an empty list. The person evaluating it had to author objects by hand — against a schema they don't know yet. Fleet-wide, 562 of 598 schemas were in that state.

🔴 Generated, not written

Every value is derived from the schema that will validate it: enum picks from the enum, pattern is satisfied, format drives the shape, minimum/maxLength are honoured, required is always populated.

Hand-written demo data is wrong in a way nobody sees until the demo — a status outside its own enum, a required field omitted — and it fails at import, in front of whoever asked for the demo.

Produced and validated by the single file gate-99 also runs: vendor/conduction/hydra-gates/scripts/lib/generate_mock_register.py. Regenerate with --keep to preserve any curated objects and top up only what is short.

🔴 It does not install itself

x-openregister.type: mock is imported on demand (ADR-111 rule 3). Sample data appearing on a production instance because somebody upgraded is a data-integrity incident, not a convenience.

occ openregister:descriptors:list --app=<app> --import=<register>

The setup-wizard step that offers this during first-run (ADR-111 rule 4) follows once OpenRegister's shared installer lands — deliberately not twenty-one copies of the same logic.

Verification

--check re-validates every object against its own schema with jsonschema, and reports zero findings.

Rolling this out across five apps found five defects in the generator, every one caught by that check — including a cross-product that paired every register with every schema in a file, and a validator bug that flagged nullable: true (OpenAPI) as invalid, which would have had someone "fix" data that was already correct.

🤖 Generated with Claude Code

This app declares schemas and shipped no demo data, so it opened on an empty
list: the person evaluating it had to author objects by hand against a schema
they did not know yet. Fleet-wide, 562 of 598 schemas were in that state.

🔴 GENERATED, NOT WRITTEN. Every value is derived from the schema that will
validate it — `enum` picks from the enum, `pattern` is satisfied, `format`
drives the shape, `minimum`/`maxLength` are honoured, `required` is always
populated. Hand-written demo data is wrong in a way nobody sees until the demo
(a status outside its own enum, a required field omitted) and it fails at
import, in front of whoever asked for the demo.

Produced and validated by the single file gate-99 also runs:
`vendor/conduction/hydra-gates/scripts/lib/generate_mock_register.py`.
`--keep` preserves curated objects and tops up only what is short.

🔴 IT DOES NOT INSTALL ITSELF (ADR-111 rule 3). `x-openregister.type: mock` is
imported ON DEMAND — sample data appearing on a production instance because
somebody upgraded is a data-integrity incident, not a convenience:

    occ openregister:descriptors:list --app=<app> --import=<register>

The setup-wizard step offering this on first run (ADR-111 rule 4, gate-100)
follows once OpenRegister's shared installer lands — deliberately not
twenty-one copies of the same logic.

Verified: `--check` re-validates every object against its own schema with
jsonschema and reports zero findings.
@rubenvdlinde

Copy link
Copy Markdown
Contributor Author

Superseded: this targeted main, which was wrong twice over.

The fleet convention is --base development, and I concluded this repo had no development branch from a shallow clone that simply had not fetched it. It does.

That was not a cosmetic mistake. The schema sets differ between the branches — this repo generates a different number of schemas on development than on main — so the demo data here describes the wrong schema set. Replaced by a branch cut from development and regenerated against its schemas.

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.

1 participant