Files
suaveplan/openspec/archive/2026-04-29-templates-spec-conformance/tasks.md
2026-05-27 23:29:53 +01:00

2.4 KiB

Tasks: templates-spec-conformance

1. Inline drift fixes

  • 1.1 Add @opentelemetry/api runtime dep (catalog:observability) to packages/primitives/templates/package.json.
  • 1.2 Create src/otel/templates-otel.ts with recordRender, recordPluginCall, startRenderTimer, _resetInstruments + sibling .md.
  • 1.3 Wire recordRender (success / error) and recordPluginCall (success / skip / error) into TemplateEngine and applyPlugin / applyPluginAsync.
  • 1.4 Validate TemplateEngineOptions via TemplateEngineOptionsSchema.safeParse in the constructor, throwing TemplateError(TEMPLATE.PARSE_ERROR) on failure.
  • 1.5 Validate ParseOptions via ParseOptionsSchema.safeParse in parse / parseAsync when callers pass options.
  • 1.6 Mark PluginPrioritySchema as // schema: boundary-only.
  • 1.7 Add src/otel/templates-otel.ts to the tests/no-disallowed.test.ts APPROVED set so the OTel timing helper can use Date.now.

2. Spec rewrite (folded)

  • 2.1 Rewrite openspec/specs/templates/spec.md to fourteen ### TPL-NN — name requirement blocks.
  • 2.2 Add **Verified by:** lines under each requirement naming the test files / cases that pin it.

3. Conformance tests

  • 3.1 src/__tests__/package-shape.spec-conformance.test.ts — TPL-01 / TPL-02.
  • 3.2 src/__tests__/types.spec-conformance.test.ts — TPL-04 (PluginPriority enum, SKIP_PLUGIN symbol, generic threading).
  • 3.3 src/engine/ParseState.spec-conformance.test.ts — TPL-05.
  • 3.4 src/engine/TemplateEngine.spec-conformance.test.ts — TPL-06 / TPL-07 / TPL-09.
  • 3.5 src/engine/apply-plugin.spec-conformance.test.ts — TPL-08.
  • 3.6 src/errors/template-error.spec-conformance.test.ts — TPL-03.
  • 3.7 src/otel/templates-otel.spec-conformance.test.ts — TPL-13.
  • 3.8 src/plugins/plugins.spec-conformance.test.ts — TPL-10.
  • 3.9 src/presets/presets.spec-conformance.test.ts — TPL-11.

4. Archive hygiene

  • 4.1 Replace the bulk-archive marker line in openspec/archive/2026-04-19-enterprise-templates/tasks.md with a pointer to this change folder.

5. Verification

  • 5.1 bun scripts/openspec-conformance.ts @suaveplan/templates — green (no errors; warnings for boundary-only schemas tolerated).
  • 5.2 bunx turbo lint typecheck test --filter=@suaveplan/templates — green.
  • 5.3 bunx turbo test:coverage --filter=@suaveplan/templates — 100/100/100/100.