Skip to content

feat(#507): configuration schema validation and structured error types - #511

Merged
admarble merged 8 commits into
mainfrom
feature/507-arch-configuration-schema-validation-and-structure
Apr 9, 2026
Merged

admarble merged 8 commits into
mainfrom
feature/507-arch-configuration-schema-validation-and-structure

Conversation

@admarble

@admarble admarble commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Configuration schema validation: Zod schema for .sequant/settings.json with .passthrough() for forward compatibility. validateSettings() produces clear error messages for type mismatches and warns on unknown/misspelled keys. sequant status displays validation warnings; sequant init generates documented JSONC settings file with companion reference doc.
  • Structured error types: SequantError base class with 6 typed subclasses (ContextOverflowError, ApiError, HookFailureError, BuildError, TimeoutError, SubprocessError). Each has isRetryable property and typed metadata. classifyError() refactored to return typed instances with exit codes as primary signal.
  • Integration: Run logs store errorType + metadata (backwards compatible). Phase executor retry logic uses error.isRetryable instead of string matching. All types exported from package.

AC Coverage

AC Description Status
AC-1 Zod schema for settings.json ✅ MET
AC-2 loadSettings() validates with clear errors ✅ MET
AC-3 sequant status displays warnings ✅ MET
AC-4 sequant init generates documented settings ✅ MET
AC-5 SettingsSchema exported ✅ MET
AC-6 SequantError + 6 subclasses ✅ MET
AC-7 classifyError() returns typed instances ✅ MET
AC-8 Run logs store errorType + metadata ✅ MET
AC-9 Retry logic uses isRetryable ✅ MET
AC-10 Error types exported ✅ MET

Test plan

  • 89 tests pass (49 unit + 22 unit + 18 integration)
  • npm run build passes
  • npm run lint passes
  • Backwards compatibility: old log format parses correctly

Closes #507

🤖 Generated with Claude Code

admarble added 3 commits April 8, 2026 20:39
…types

- Zod schema for settings.json with passthrough for forward compatibility (AC-1)
- validateSettings() with clear error messages for type mismatches (AC-2)
- Settings validation warnings in sequant status command (AC-3)
- JSONC settings file with inline comments from sequant init (AC-4)
- SettingsSchema and error types exported from package (AC-5, AC-10)
- SequantError base class with 6 typed subclasses and isRetryable (AC-6)
- classifyError() returns typed instances; exit codes as primary signal (AC-7)
- Run logs store errorType + metadata, backwards compatible (AC-8)
- Phase executor retry logic uses error.isRetryable (AC-9)

Closes #507
…ects

- Add generateSettingsReference to init.test.ts settings mock
- Use thresholdWithDefaults() factory for ScopeThresholdSchema so partial
  input like { yellow: 10 } fills missing fields from threshold-specific
  defaults instead of failing validation
admarble added 5 commits April 8, 2026 21:16
These fields are written to settings.json by sequant init but were
missing from the Zod schema and KNOWN_KEYS map, causing false
"unknown key" warnings on every project that ran init.
classifyError() now returns SequantError instances instead of string
categories (#507 AC-7). Use errorTypeToCategory() wrapper to preserve
the existing test assertions.
Use errorTypeToCategory() and populate new ErrorContext fields
(errorType, errorMetadata, isRetryable) to match the refactored
classifyError() return type.
The -y flag was added in 5987921 but the integration test wasn't
updated to match. Unit test already expected the correct args.
@admarble
admarble merged commit fd8fca5 into main Apr 9, 2026
3 of 5 checks passed
@admarble
admarble deleted the feature/507-arch-configuration-schema-validation-and-structure branch April 9, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arch: configuration schema validation and structured error types

1 participant