Skip to content

feat: strict directive validation at parse time#46

Merged
sleipi merged 2 commits into
mainfrom
feat/43-strict-directive-validation
May 24, 2026
Merged

feat: strict directive validation at parse time#46
sleipi merged 2 commits into
mainfrom
feat/43-strict-directive-validation

Conversation

@sleipi
Copy link
Copy Markdown
Owner

@sleipi sleipi commented May 24, 2026

Validate @timeout, @poll, and @env directives during parsing, rejecting malformed values with line-numbered error messages before execution begins.

Changes

  • DirectiveError type -- structured error with line number, directive name, message
  • Validation rules: @timeout (int >= 0), @poll (int > 0), @env (KEY=VALUE with non-empty key)
  • *int refactor -- Timeout/Poll changed to pointer to distinguish unset from zero
  • File-level @timeout -- set in frontmatter, inherited by entries unless overridden
  • ParseFile returns []error -- multi-error reporting, all validation errors shown at once
  • Error format: file.clitest:line N: @directive: message
  • E2E tests for all validation cases
  • SPEC.md updated with validation rules and file-level @timeout docs

Closes #43

Validate `@timeout`, `@poll`, and `@env` directives during parsing,
rejecting malformed values with line-numbered error messages before
execution begins.

- Add DirectiveError type with structured line/directive/message fields
- Validate @timeout (integer >= 0), @poll (integer > 0), @env (KEY=VALUE)
- Refactor Timeout/Poll to *int to distinguish unset from explicit zero
- Support file-level @timeout in frontmatter (inherited by entries)
- ParseFile returns []error for multi-error reporting
- Add E2E tests for directive validation
- Update SPEC.md with validation rules and file-level @timeout docs

Closes #43
@sleipi sleipi added the enhancement New feature or request label May 24, 2026
- parseFrontmatter now returns []error (was single error)
- Replace manual newline trimming with strings.Join in loadAndParse
@sleipi sleipi merged commit ff387f2 into main May 24, 2026
4 checks passed
@sleipi sleipi deleted the feat/43-strict-directive-validation branch May 24, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strict directive validation — reject malformed directives at parse time

1 participant