CLI 'ucas put @schema' now detects meta-schema target and routes
through putSchema() which uses isValidSchema() — a proper recursive
validator — instead of ajv against the meta-schema (which cannot
express recursive constraints for nested property sub-schemas).
This fixes the core issue where schemas with typed properties like
{"type":"string","minLength":1} were rejected by the CLI path.
Added CLI E2E test: put @schema with nested constraints (minLength,
maximum, uniqueItems).
494 tests, 0 fail.
Refs #82
Add 10 new schema keywords to whitelist + meta-schema:
- numeric: minimum, maximum, exclusiveMinimum, exclusiveMaximum
- string: minLength, maxLength, pattern
- array: minItems, maxItems, uniqueItems
These are pure leaf constraints with no collectRefs() impact.
5 new tests covering validation, rejection, and nested usage.
Refs #82
Checks for unresolved workspace:* dependencies before publish.
Changesets resolves these automatically, so normal release flow
passes through. Direct npm publish with workspace deps is blocked.
Changes:
1. openStore() now async, auto-creates directory and bootstraps
2. Removed shouldCreate parameter and validateStoreExists()
3. All openStore() calls now awaited
4. Deleted init and bootstrap commands
5. Removed Issue #55 store validation tests (superseded by auto-bootstrap)
6. Enhanced error handling in openStore() for permission/path issues
7. Updated e2e snapshots after fixing missed await in cmdRender
Bootstrap is idempotent. Core tests using createMemoryStore() unaffected.
Fixes#73
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Strip volatile fields (timestamp, created, updated) from JSON before
snapshotting using a stripVolatile helper
- Remove toMatchSnapshot() from test 2.1 to avoid embedding machine-
specific tmp paths in the snapshot; use toContain assertions instead
- Replace GC count snapshot with structural shape assertions so counts
don't need to match exact phase-history state
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
Convert 46 e2e-check workflow scenarios to fast bun test snapshot tests.
7 describe phases share a single mkdtempSync store; hashes are deterministic
so cross-phase data dependencies work without re-creating data.
Closes#66
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
- Add validateStoreExists() helper to check store directory existence
- Modify openStore() to accept shouldCreate parameter (default: false)
- Update read commands to validate store exists first
- Update write commands (init, put, schema put, hash) to allow creation
- Add 10 E2E tests covering all affected commands
- Improve error message: "Store not found at <path>" vs "Node not found"
Commands that now validate:
- get, has, verify, refs, walk, cat
- schema get, schema list
Commands that still create:
- init, put, schema put, hash
- var commands (use openVarStore)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ajv strict mode requires explicit type: object when properties/required
are used. All three workflow YAMLs had this missing, causing frontmatter
validation to fail with:
strict mode: missing type "object" for keyword "required"
Also added frontmatter output example in e2e-check.yaml procedure to
prevent agents from outputting bugs as plain strings instead of objects.
Applied tester feedback to fix 5 test failures:
1. Updated error message format from "Node not found" to "CAS node not found"
for consistency with existing tests in variable-store.test.ts and var.test.ts
2. Fixed CLI tests R9 and R10 to use bootstrap() directly instead of
non-existent "types" command. Added imports for bootstrap and createFsStore.
3. Fixed render test 6.5 to pass actual schema Hash instead of entire
bootstrap object (Record<string, Hash>)
4. Updated test expectations in render.test.ts (tests 1.5, 10.1, 10.2) to
match new error message format
All 390 tests now pass. Core functionality verified:
- Missing root hash detection working correctly
- CLI exits with code 1 on missing hash
- Error message includes hash: "CAS node not found: <hash>"
- Nested nodes still render as cas: references (preserved behavior)
- Resolution decay behavior preserved
Fixes#53
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add schema validation to the `json-cas put` command to ensure data
integrity. The CLI now validates the payload against the specified
schema before storing, and exits with a non-zero code and descriptive
error message if validation fails.
Changes:
- Add schema existence check in cmdPut()
- Add payload validation before storing
- Exit with error code 1 on validation failure
- Provide helpful error messages indicating the file and schema
- Add comprehensive test suite with 16 test scenarios covering:
- Valid data (regression tests)
- Type mismatches (new validation)
- Schema errors (edge cases)
- Integration with existing features
- Error message quality
The hash command continues to work without validation (dry-run
consistency), and schema put continues to use its own validation.
Fixes#50
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When rendering a non-existent hash, the CLI now exits with code 1 and
displays an error message instead of silently outputting "cas:<hash>"
with exit code 0.
Changes:
- Updated CasNodeNotFoundError constructor signature to store hash
- Added root hash existence check in render() and renderAsync()
- Updated CLI error handling to catch CasNodeNotFoundError
- Added comprehensive test suite for missing hash error handling
- Updated existing incorrect tests (R2 and test 1.5)
The fix distinguishes between:
- Root hash (user-requested): Must exist or throw error
- Nested hash (during traversal): Renders as cas: reference (existing behavior)
- Resolution below epsilon: Renders as cas: reference (existing behavior)
Fixes#53
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes#54
The `json-cas schema put` command now catches SchemaValidationError
and displays a clean error message instead of showing a raw stack trace.
Changes:
- Import SchemaValidationError from @uncaged/json-cas
- Wrap putSchema() call in try-catch in cmdSchemaPut
- Catch SchemaValidationError specifically and call die(e.message)
- Add 5 comprehensive tests for invalid schema error handling
Test cases:
1. Invalid JSON Schema type value
2. Unknown schema keys
3. Invalid nested schema
4. Non-object root schema
5. Valid schema regression test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>