Observed behavior
Leia validates --module-format but still accepts --retry and --timeout as unrestricted strings. templates/body.def emits retry as raw JavaScript, while templates/header.def and templates/test.def interpolate paths, identifiers, version values, shell values, and other metadata directly into JavaScript string or template-literal contexts. Non-numeric option values or metadata containing JavaScript-significant quotes and backslashes can therefore make the generated harness invalid or change its meaning before tests run.
Expected behavior
Every value entering a generated CommonJS or ESM harness is validated according to its semantic type and serialized as JavaScript data rather than hand-escaped source. Invalid numeric CLI values fail early with an actionable error, and supported paths, identifiers, shell values, and metadata generate equivalent valid harnesses in both formats.
Reproduction or evidence
On the current main baseline, cli/default.js defines retry and timeout as string flags; templates/body.def renders this.retries({{=it.retry}});; and templates/header.def plus templates/test.def place metadata inside quoted JavaScript without a single serialization boundary. A non-numeric --retry value or a supported path containing a quote or backslash exercises the defect before Mocha can run the intended test.
Environment
Current main before Leia 2.0; both .leia.cjs and .leia.mjs generation paths are affected because they share the metadata templates.
Impact
Harness generation is Leia's core execution boundary. Malformed or JavaScript-significant metadata can prevent all tests from running and makes correctness depend on incidental path and argument characters across supported operating systems.
Delivery and verification
Open one linked draft completion pull request. Its first substantive change should add focused regression tests that fail against the current baseline for invalid numeric options and safely supported quote/backslash path metadata, then introduce centralized validation and serialization. Preserve the failing baseline evidence and show the same tests, CommonJS and ESM generation coverage, special-character shell coverage, lint, unit tests, and relevant CI examples passing with the fix.
Acceptance criteria
Task metadata
schema: tanaab/task-metadata/v2
mode: fallback
fallback:
work-size: 5
complexity: medium
impact: high
Observed behavior
Leia validates
--module-formatbut still accepts--retryand--timeoutas unrestricted strings.templates/body.defemitsretryas raw JavaScript, whiletemplates/header.defandtemplates/test.definterpolate paths, identifiers, version values, shell values, and other metadata directly into JavaScript string or template-literal contexts. Non-numeric option values or metadata containing JavaScript-significant quotes and backslashes can therefore make the generated harness invalid or change its meaning before tests run.Expected behavior
Every value entering a generated CommonJS or ESM harness is validated according to its semantic type and serialized as JavaScript data rather than hand-escaped source. Invalid numeric CLI values fail early with an actionable error, and supported paths, identifiers, shell values, and metadata generate equivalent valid harnesses in both formats.
Reproduction or evidence
On the current
mainbaseline,cli/default.jsdefinesretryandtimeoutas string flags;templates/body.defrendersthis.retries({{=it.retry}});; andtemplates/header.defplustemplates/test.defplace metadata inside quoted JavaScript without a single serialization boundary. A non-numeric--retryvalue or a supported path containing a quote or backslash exercises the defect before Mocha can run the intended test.Environment
Current
mainbefore Leia 2.0; both.leia.cjsand.leia.mjsgeneration paths are affected because they share the metadata templates.Impact
Harness generation is Leia's core execution boundary. Malformed or JavaScript-significant metadata can prevent all tests from running and makes correctness depend on incidental path and argument characters across supported operating systems.
Delivery and verification
Open one linked draft completion pull request. Its first substantive change should add focused regression tests that fail against the current baseline for invalid numeric options and safely supported quote/backslash path metadata, then introduce centralized validation and serialization. Preserve the failing baseline evidence and show the same tests, CommonJS and ESM generation coverage, special-character shell coverage, lint, unit tests, and relevant CI examples passing with the fix.
Acceptance criteria
retryandtimeoutaccept only documented numeric values and ranges, with actionable errors for invalid inputTask metadata