refactor: make materializer a generic transformer (#335)#336
Merged
Conversation
The materializer no longer maintains a hand-written registry mapping template names to short on-disk directory names. The active config's scenario-templates ABox is the single source of truth: every template declared there is emitted to `generated/<config>/playwright/templates/<TemplateName>/`, mirroring the planner's `scenarios/templates/<TemplateName>/` layout. Adding a new template now requires only a new ABox row (plus, eventually, a renderer when one is needed). Layout change (visible to anyone reading the generated tree): generated/<config>/playwright/edges/ -> templates/EdgeLifecycle/ generated/<config>/playwright/entities/ -> templates/EntityLifecycle/ generated/<config>/playwright/runtime-entities/ -> templates/UpdatedFieldVisibleOnReadBack/ generated/<config>/playwright/state-transitions/ -> templates/StateTransitionVisibleAfterAction/ What changed: - `materializer/src/templateRegistry.ts` deleted. The materializer reads the ABox via `loadScenarioTemplatesAbox()` and iterates the resulting names. - `materializer/src/coverage.ts` now takes `templateNames: readonly string[]` and derives `emittedSpec = templates/<name>/<subject>.lifecycle.spec.ts` via the new `templateOutputDir(name)` helper. No taxonomy table. - `materializer/src/playwright/templateEmitter.ts` support-import paths bumped to `../../support/...` to reflect the one-level-deeper spec location. - L3 invariants (`configs/camunda-oca/regression-invariants.test.ts`) retargeted to the new paths. `+26 lifecycle suites, -73 suppressed` is unchanged; only the on-disk paths moved. - `tests/codegen/template-registry.test.ts` deleted (the symmetry it guarded — registry name ↔ ABox name — is structural now: the ABox IS the source). Loader already enforces no-duplicate names. - README, JSDoc comments updated. Counts byte-stable: 117 endpoints, +70 variant suites, +26 lifecycle suites, -73 suppressed. Closes #335
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the materializer to treat the active config’s scenario-templates ABox as the single source of truth, eliminating the hand-maintained template registry and aligning Playwright output paths with the planner’s scenarios/templates/<TemplateName>/ structure.
Changes:
- Removed
TEMPLATE_REGISTRYand iterated template names directly fromscenario-templates.json(ABox) during materialization. - Updated coverage extraction to accept
templateNamesand derive template output directories mechanically (templates/<TemplateName>/). - Migrated generated Playwright suite layout to
generated/<config>/playwright/templates/<TemplateName>/...and retargeted invariants/docs/tests accordingly.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/codegen/template-registry.test.ts | Deleted now-obsolete registry↔ABox symmetry guard test. |
| tests/codegen/coverage.test.ts | Updated buildCoverage calls to use templateNames. |
| README.md | Updated documented template-derived suite output path to the new layout. |
| path-analyser/src/types.ts | Updated JSDoc path reference to the new template output layout. |
| materializer/src/templateRegistry.ts | Deleted the manual template registry and bindings. |
| materializer/src/playwright/templateEmitter.ts | Adjusted support import paths for the deeper templates/<TemplateName>/ suite nesting. |
| materializer/src/index.ts | Loads template names from the scenario-templates ABox; emits suites into per-template directories derived from the name. |
| materializer/src/coverage.ts | Replaced registry-based bindings with templateNames and introduced templateOutputDir(name). |
| configs/camunda-oca/regression-invariants.test.ts | Retargeted invariants and spec-path checks to playwright/templates/<TemplateName>/.... |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… JSDoc Copilot reviewer noted that the JSDoc on scenariosDir and outDir still referenced EdgeLifecycle specifically, even though emitTemplateSuites is now driven by templateNames and used for both EdgeLifecycle and EntityLifecycle (and future templates). Replace the hard-coded template name in both paths with <TemplateName> so the documentation stays accurate as new templates are added.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #335.
The materializer no longer maintains a hand-written registry mapping template names to short on-disk directory names. The active config's scenario-templates ABox is the single source of truth: every template declared there is emitted to
generated/<config>/playwright/templates/<TemplateName>/, mirroring the planner'sscenarios/templates/<TemplateName>/layout.Adding a new template now requires only a new ABox row (plus, eventually, a renderer when one is needed).
Layout change
playwright/edges/<Name>.lifecycle.spec.tsplaywright/templates/EdgeLifecycle/<Name>...playwright/entities/<Name>.lifecycle.spec.tsplaywright/templates/EntityLifecycle/<Name>...playwright/runtime-entities/<Name>...playwright/templates/UpdatedFieldVisibleOnReadBack/<Name>...playwright/state-transitions/<Name>...playwright/templates/StateTransitionVisibleAfterAction/<Name>...What changed
materializer/src/templateRegistry.ts— deleted.index.tsnow callsloadScenarioTemplatesAbox()and iterates names.materializer/src/coverage.ts—templates: TemplateBinding[]replaced withtemplateNames: readonly string[]. NewtemplateOutputDir(name)helper derivestemplates/<name>/from the name alone. No taxonomy table.materializer/src/playwright/templateEmitter.ts— support-import paths bumped from../support/...to../../support/...because suites are now one directory deeper.configs/camunda-oca/regression-invariants.test.tsretargeted to the new paths.tests/codegen/template-registry.test.ts— deleted. The symmetry it guarded (registry name ↔ ABox name) is now structural; the ABox IS the source. Loader already enforces no-duplicate names.tests/codegen/coverage.test.ts— updated to the newtemplateNamessignature.Counts byte-stable
117 endpoints, +70 variant suites, +26 lifecycle suites, -73 suppressed by scenario-template coverage— unchanged. Only on-disk paths moved.Pre-push gate
npm run build:analyser && npm run build:emitter-sdk✅tsc --noEmit(extractor, planner, emitter-sdk, materializer, request-validation, tests) ✅npm run lint✅TEST_SEED=snapshot-baseline npm run testsuite:generate && npm run generate:request-validation✅npm test→ 631 passed, 4 skipped ✅