7 Commits

Author SHA1 Message Date
Tom Boucher
637daa831b fix(2130): anchor extractFrontmatter regex to file start (#2133)
* test(2130): add failing tests for frontmatter body --- sequence mis-parse

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(2130): anchor extractFrontmatter regex to file start, preventing body --- mis-parse

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 23:47:50 -04:00
Jeremy McSpadden
fa57a14ec7 fix: resolve REG-04 — frontmatter inline array parser now respects quoted commas (#1695)
Fixes #1694

The inline array parser used .split(',') which ignored quote boundaries,
splitting "a, b" into two items. Replaced with a quote-aware splitter
that tracks single/double quote state.

Updated REG-04 test to assert correct behavior and added coverage for
single-quoted and mixed-quote inline arrays.
2026-04-04 15:50:01 -04:00
Tom Boucher
2703422be8 refactor(tests): standardize to node:assert/strict and t.after() per CONTRIBUTING.md (#1675)
* refactor(tests): standardize to node:assert/strict and t.after() per CONTRIBUTING.md

- Replace require('node:assert') with require('node:assert/strict') across
  all 73 test files to enforce strict equality (no type coercion)
- Replace try/finally cleanup blocks with t.after() hooks in core.test.cjs
  and hooks-opt-in.test.cjs per the test lifecycle standards
- Utility functions in codex-config and security-scan retain try/finally
  as that is appropriate for per-function resource guards, not lifecycle hooks

Closes #1674

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* perf(tests): add --test-concurrency=4 to test runner for parallel file execution

Node.js --test-concurrency controls how many test files run as parallel child
processes. Set to 4 by default, configurable via TEST_CONCURRENCY env var.
Fixes tests at a known level rather than inheriting os.availableParallelism()
which varies across CI environments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(security): allowlist verify.test.cjs in prompt-injection scanner

tests/verify.test.cjs uses <human>...</human> as GSD phase task-type
XML (meaning "a human should verify this step"), which matches the
scanner's fake-message-boundary pattern for LLM APIs. This is a
false positive — add it to the allowlist alongside the other test files
that legitimately contain injection-adjacent patterns.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 14:29:03 -04:00
Tom Boucher
1d97626729 fix: parseMustHavesBlock now handles any YAML indentation width
The parser hardcoded 4/6/8/10-space indent levels for must_haves
sub-blocks, but standard YAML uses 2-space indentation. This caused
"No must_haves.key_links found in frontmatter" for valid plan files.

The fix dynamically detects the actual indent of must_haves: and its
sub-blocks instead of assuming fixed column positions.

Fixes #1356

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 13:16:10 -04:00
Ethan Hurst
c9e73e9c94 fix(quick-1): remove HIGH severity test overfitting in 4 test files
- frontmatter.test.cjs: delete FRONTMATTER_SCHEMAS describe block (4 tests asserting on lookup table shape)
- core.test.cjs: replace 12 per-profile per-agent matrix tests with 1 structural validation test
- commands.test.cjs: URL test uses URL.searchParams.get() instead of raw string includes
- state.test.cjs: date assertion uses before/after window to handle midnight boundary safely
2026-02-26 05:49:31 +10:00
Ethan Hurst
ceb10de3dd test(02-01): add spliceFrontmatter, parseMustHavesBlock, and FRONTMATTER_SCHEMAS tests
- spliceFrontmatter: replace existing, add to plain content, exact body preservation
- parseMustHavesBlock: truths as strings, artifacts as objects with min_lines,
  key_links with from/to/via/pattern, nested arrays, missing block, no frontmatter
- FRONTMATTER_SCHEMAS: plan/summary/verification required fields, all schema names
2026-02-26 05:47:19 +10:00
Ethan Hurst
f722a6aeba test(02-01): add extractFrontmatter and reconstructFrontmatter unit tests
- extractFrontmatter: simple key-value, quotes, nested objects, block arrays,
  inline arrays, REG-04 quoted comma edge case, empty/missing frontmatter,
  emoji/non-ASCII, object-to-array conversion, empty line skipping
- reconstructFrontmatter: simple values, empty/short/long arrays, quoted
  colons/hashes, nested objects, nested arrays, null/undefined skipping
- Round-trip identity tests: simple, nested, and multi-type fixtures
2026-02-26 05:47:19 +10:00