fix(tools): canonical JSON Schema for chat tools#232
Merged
Conversation
Required by data-machine 0.106.1 PR #1900 which removes legacy schema
auto-normalization. Backwards compatible with 0.103.x.
Converts all 9 chat tool definitions from the legacy property-keyed
shape (with per-property 'required' booleans) to canonical JSON Schema:
parameters wrapped in { type: 'object', properties: {...}, required: [...] }.
Also adds 'items' schemas to every array property (required by OpenAI
strict tool-schema validation):
- FixEventTimezone.events: items=object
- UpdateEvent.events: items=object
- UpdateEvent.occurrenceDates: items=string
Files: EventHealthCheck, EventQualityAudit, FindBrokenTimezoneEvents,
FixEventTimezone, GetVenueEvents, TestEventScraper, UpdateEvent,
UpdateVenue, VenueHealthCheck.
Contributor
Homeboy Results —
|
5 tasks
chubes4
added a commit
that referenced
this pull request
May 9, 2026
Follow-up to PR #232. Converts the upsert_event handler tool registration to emit a canonical JSON Schema (type: object, properties, required) instead of a flat property bag. Required for DM 0.106.1 compatibility. PR #1900 in data-machine core makes RequestBuilder::normalizeToolParameters a passthrough, so handler tool definitions must already be canonical when registered. NOT backwards-compatible with DM 0.103.x at the provider return shape level: EventSchemaProvider and VenueParameterProvider now return canonical fragments ({properties, required?}) instead of flat property bags. The handler tool wire-up (EventUpsertFilters) is the only consumer of these providers in this plugin. No tests pin the old shape. TaxonomyHandler::getTaxonomyToolParameters() in data-machine core still returns a flat property bag. EventUpsertFilters' composer absorbs that shape transparently as a degenerate fragment with no required fields, so this PR works regardless of when DM core converts TaxonomyHandler to canonical fragments. Changes: - DynamicToolParametersTrait::filterByEngineData() now operates on canonical fragments and prunes filtered keys from both 'properties' and 'required'. - EventSchemaProvider::fieldsToToolParameters() emits canonical fragments. Per-property 'required' booleans are aggregated into a top-level required[] array. 'required' key omitted when empty. - VenueParameterProvider returns a canonical fragment with no required fields (venue presence is enforced upstream). - EventUpsertFilters::getDynamicEventTool() composes fragments via new composeCanonicalParameters() helper. Tolerates both canonical fragment shape and legacy flat property bag from TaxonomyHandler. - All array-typed properties carry an 'items' schema (already in source declarations; preserved through fieldsToToolParameters). Co-authored-by: homeboy-ci[bot] <266378653+homeboy-ci[bot]@users.noreply.github.com>
This was referenced May 9, 2026
chubes4
added a commit
to Extra-Chill/extrachill-roadie
that referenced
this pull request
May 9, 2026
DM 0.107.0 removes the auto-normalization layer that previously
converted legacy property-keyed parameter shapes. Convert all 4 chat
tool definitions in inc/tools/ to canonical JSON Schema directly:
- Wrap properties under { type: 'object', properties: {...} }
- Move required => true fields into top-level required[] array
- Drop required => false (no-op)
- Add items schema to every type: array property (OpenAI strict
schema validation requires it)
- Preserve description and enum verbatim
Forward-compatible pre-flight: works on DM 0.103.14 (current
production) and DM 0.107.0+ (target). Same pattern as
Extra-Chill/data-machine-events#232.
Closes #5
This was referenced May 10, 2026
Closed
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.
Why
Data Machine 0.106.1 PR #1900 ("Require canonical AI tool schemas") removes the auto-normalization layer in
RequestBuilder::normalizeToolParametersthat previously converted legacy property-keyed parameter shapes into canonical JSON Schema on the way to providers. Extension plugins must now ship canonical schemas directly.This is a pre-flight fix landed before the DM bump — canonical schemas already work on DM 0.103.14 (current production on extrachill.com), so this PR can ship and deploy independently of the DM upgrade.
What changed
Converted all 9 chat tool definitions in
inc/Api/Chat/Tools/from the legacy shape:…to canonical JSON Schema:
Files
inc/Api/Chat/Tools/EventHealthCheck.phpinc/Api/Chat/Tools/EventQualityAudit.phpinc/Api/Chat/Tools/FindBrokenTimezoneEvents.phpinc/Api/Chat/Tools/FixEventTimezone.phpinc/Api/Chat/Tools/GetVenueEvents.phpinc/Api/Chat/Tools/TestEventScraper.phpinc/Api/Chat/Tools/UpdateEvent.phpinc/Api/Chat/Tools/UpdateVenue.phpinc/Api/Chat/Tools/VenueHealthCheck.phpConversion rules applied
{ type: 'object', properties: {...} }.required => trueproperties into a top-levelrequired[]array of property names; removerequiredfrom individual property defs.required => falseentirely (it was a no-op).requiredkey when no properties are required (don't emit empty arrays).type: arrayproperty gains anitemsschema (required by OpenAI strict tool-schema validation, see MEMORY.md). Choices made:FixEventTimezone.events→items: { type: object }(array of update structs)UpdateEvent.events→items: { type: object }(array of update structs)UpdateEvent.occurrenceDates→items: { type: string }(array of YYYY-MM-DD date strings)description,enum) preserved verbatim.Required fields summary
UpdateVenue:venueTestEventScraper:target_urlGetVenueEvents:venueOut of scope (intentionally)
inc/Steps/Upsert/Events/EventUpsertFilters.php— verified. Itsparametersarray is built dynamically by merging output fromEventSchemaProvider::getCoreToolParameters(),EventSchemaProvider::getSchemaToolParameters(),TaxonomyHandler::getTaxonomyToolParameters(), andVenueParameterProvider::getToolParameters(). Those provider methods still emit the legacy property-keyed shape, but the entry point is handler tool registration, not chat tools — different code path through Data Machine's pipeline engine. Worth a follow-up audit before DM 0.106.1 deploys, but separate from this PR.Backwards compatibility
Canonical schemas are accepted by both DM 0.103.14 (current production) and DM 0.106.1+ (target). The legacy normalization path on 0.103.x silently passes canonical schemas through. No behavior change on the current site.
Test plan
php -l) passes on all 9 edited files.homeboy lint --path . --changed-since mainshows no findings on any of the 9 edited tool files (only pre-existing baseline noise inUniversalWebScraper.phpand other unrelated files).RequestBuilder::normalizeToolParameterspassthrough path.update_venueandevent_quality_audit).Constraints honored
main, no commits tomain.CHANGELOG.mdedits, no version constant bumps — homeboy owns those.