Repository navigation
fix: preserve offering schemas and support standard JSON Schema formats - #108
Open
epistemedeus wants to merge 2 commits into
Open
epistemedeus wants to merge 2 commits into
epistemedeus wants to merge 2 commits into
Conversation
epistemedeus
marked this pull request as ready for review
October 20, 2026 21:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Valid object schemas containing
format: "uri"are currently saved as description strings byoffering createandoffering update. The shared Ajv instance has no standard formats registered, andparseSchemaOrStringcatches compilation errors together with JSON syntax errors. Invalid object schemas can therefore also silently reach the API as strings.Register
ajv-formatsas a direct runtime dependency and let object-schema compilation errors propagate. Validate requirements and deliverable flags before authentication or owner HTTP requests, then reuse those parsed values. Nonempty descriptions and existing scalar/array string behavior are preserved; format constraints remain in the submitted schema. The shared validator also serves interactive schema input and resource params.Reproducible schema:
{ "type": "object", "additionalProperties": false, "required": ["url"], "properties": { "url": { "type": "string", "format": "uri" }, "method": { "type": "string", "enum": ["GET", "POST"], "default": "GET" } } }The new offline tests exercise the real Commander actions, shared compiler, AgentApi and ApiClient serialization with fake identity/configuration and HTTP. All four create/update and requirements/deliverable combinations send the URI schema as an object. The emitted schema accepts GET/POST, rejects missing URL, invalid URI, unsupported method and extra properties. Invalid schema objects and whitespace fail before any owner request; description, malformed-JSON text, scalar and array inputs retain their existing string behavior. The original source fails 19 of these 49 tests; the fix passes all 49.
Validation:
npm ci --ignore-scripts --no-audit --no-fundnpm run test:offering-schema(49 passed)npm run typechecknpm run buildnpm exec -- tsx scripts/tradeLoopSign.test.ts(3 passed)git diff --checkThe lockfile update also fills its missing optional
utf-8-validatepeer entry so cleannpm ciworks. Tests use no live ACP endpoint or credentials.Note
Medium Risk
Changes how offering requirements/deliverable flags are interpreted and validated before API calls; invalid object schemas now error instead of being saved as strings, which is correct but may break scripts that relied on the old silent fallback.
Overview
Fixes
offering create/offering updateso JSON object flags for requirements and deliverable are stored as schemas instead of silently falling back to plain strings when Ajv cannot compile them (e.g.format: "uri").ajv-formatsis added and wired invalidateJsonSchema, enabling standard formats (uri,email,date-time, etc.).parseSchemaOrStringnow treats any parsed JSON object as an intended schema and surfaces compilation errors; invalid schemas and whitespace-only values fail before auth/owner HTTP.parseSchemaFlagscentralizes flag parsing and runs at the start of create/update. Plain-text, malformed JSON, and scalar/array JSON inputs still behave as descriptions.Adds
npm run test:offering-schemawith offline Commander/API tests (49 cases). README documents schema formats and early validation. Lockfile adds the missing optionalutf-8-validatepeer for cleannpm ci.Reviewed by Cursor Bugbot for commit 1472bfb. Bugbot is set up for automated code reviews on this repo. Configure here.