Affaan Mustafa
72de0a4e2c
test: add 17 tests for validators, hooks, and edge cases (Round 32)
...
Coverage improvements:
- validate-agents: empty frontmatter block, no-content frontmatter,
partial frontmatter, mixed valid/invalid agents
- validate-rules: directory with .md name (stat.isFile check),
deeply nested subdirectory rules
- validate-commands: 3-agent workflow chain, broken middle agent
- post-edit-typecheck: spaces in paths, shell metacharacters, .tsx
- check-console-log: git failure passthrough, large stdin
- post-edit-console-warn: console.error only, null tool_input
- session-end: empty transcript, whitespace-only transcript
Total tests: 686 → 703
2026-02-13 03:44:10 -08:00
Affaan Mustafa
b1eb99d961
fix: use local-time Date constructor in session-manager to prevent timezone day shift
...
new Date('YYYY-MM-DD') creates UTC midnight, which in negative UTC offset
timezones (e.g., Hawaii) causes getDate() to return the previous day.
Replaced with new Date(year, month - 1, day) for correct local-time behavior.
Added 15 tests: session-manager datetime verification and edge cases (7),
package-manager getCommandPattern special characters (4), and
validators model/skill-reference validation (4). Tests: 651 → 666.
2026-02-13 03:29:04 -08:00
Affaan Mustafa
b3db83d018
test: add 22 tests for validators, skill-create-output, and package-manager edge cases
2026-02-13 03:02:28 -08:00
Affaan Mustafa
27dce7794a
fix: reject empty/invalid array commands in hooks validator, add 19 tests
...
validate-hooks.js: Empty arrays [] and arrays with non-string elements
(e.g., [123, null]) passed command validation due to JS truthiness of
empty arrays (![] === false). Added explicit length and element type
checks.
19 new tests covering: non-array event type values, null/string matcher
entries, string/number top-level data, empty string/array commands,
non-string array elements, non-string type field, non-number timeout,
timeout boundary (0), unwrapped hooks format, legacy format error paths,
empty agent directory, whitespace-only command files, valid skill refs,
mixed valid/invalid rules and skills.
2026-02-13 02:33:40 -08:00
Affaan Mustafa
2dbba8877b
fix: reject whitespace-only command/field values in CI validators, add 10 tests
...
validate-hooks.js: whitespace-only command strings now fail validation
validate-agents.js: whitespace-only model/tools values now fail validation
2026-02-13 02:09:22 -08:00
Affaan Mustafa
c1919bb879
fix: greedy regex in validate-commands captures all refs per line, add 18 tests
...
The command cross-reference regex /^.*`\/(...)`.*$/gm only captured the
LAST command ref per line due to greedy .* consuming earlier refs.
Replaced with line-by-line processing using non-anchored regex to
capture ALL command references.
New tests:
- 4 validate-commands multi-ref-per-line tests (regression)
- 8 evaluate-session threshold boundary tests (new file)
- 6 session-aliases edge case tests (cleanup, rename, path matching)
2026-02-13 01:52:30 -08:00
Affaan Mustafa
654731f232
fix: add missing validation in renameAlias, add 6 tests
...
renameAlias was missing length (>128), reserved name, and empty string
validation that setAlias enforced. This inconsistency allowed renaming
aliases to reserved names like 'list' or 'delete'.
Also adds tests for:
- renameAlias empty string, reserved name, and length limit
- validate-skills whitespace-only SKILL.md rejection
- validate-rules whitespace-only file and recursive subdirectory scan
2026-02-13 01:05:59 -08:00
Affaan Mustafa
39280e251b
fix: use valid model name in colon-in-values frontmatter test
...
The test was using 'claude-sonnet-4-5-20250929' which isn't in VALID_MODELS
(haiku/sonnet/opus). Use 'sonnet' with a description field containing
colons to properly test colon handling in frontmatter values.
2026-02-12 17:33:17 -08:00
Affaan Mustafa
35aed05903
test: add 6 tests for command validation and session content verification
...
- validate-commands: creates: line skipping, valid cross-refs, unclosed
code blocks, valid workflow diagrams
- session-end: backtick escaping in session files, tools/files in output
2026-02-12 17:15:21 -08:00
Affaan Mustafa
e5f1c58c11
test: add regression tests for empty frontmatter field rejection
...
Add 2 tests verifying validate-agents correctly rejects agents with
empty model and empty tools values in YAML frontmatter.
2026-02-12 16:58:27 -08:00
Affaan Mustafa
64796f99be
fix: remove unused imports in test files (ESLint)
...
- validators.test.js: remove unused execSync (only execFileSync used)
- skill-create-output.test.js: remove unused path module
2026-02-12 16:51:40 -08:00
Affaan Mustafa
6fa3bfe71d
test: add cross-reference validation tests for validate-commands
...
- Add runValidatorWithDirs() helper for multi-constant overrides
- Test broken command references (e.g., /nonexistent-cmd)
- Test broken agent path references (e.g., agents/fake-agent.md)
- Test fenced code block exclusion (refs inside ``` are skipped)
- Test broken workflow agent references (e.g., planner -> ghost-agent)
- Total tests: 261 → 287 (+26)
2026-02-12 16:26:24 -08:00
Affaan Mustafa
492c99ac24
fix: 3 bugs fixed, stdin encoding hardened, 37 CI validator tests added
...
Bug fixes:
- utils.js: glob-to-regex conversion now escapes all regex special chars
(+, ^, $, |, (), {}, [], \) before converting * and ? wildcards
- validate-hooks.js: escape sequence processing order corrected —
\\\\ now processed before \\n and \\t to prevent double-processing
- 6 hooks: added process.stdin.setEncoding('utf8') to prevent
multi-byte UTF-8 character corruption at chunk boundaries
(check-console-log, post-edit-format, post-edit-typecheck,
post-edit-console-warn, session-end, evaluate-session)
New tests (37):
- CI validator test suite (tests/ci/validators.test.js):
- validate-agents: 9 tests (real project, frontmatter parsing,
BOM/CRLF, colons in values, missing fields, non-md skip)
- validate-hooks: 13 tests (real project, invalid JSON, invalid
event types, missing fields, async/timeout validation, inline JS
syntax, array commands, legacy format)
- validate-skills: 6 tests (real project, missing SKILL.md, empty
files, non-directory entries)
- validate-commands: 5 tests (real project, empty files, non-md skip)
- validate-rules: 4 tests (real project, empty files)
Total test count: 228 (up from 191)
2026-02-12 16:08:49 -08:00