Fix Pi extension to use TypeBox schemas instead of JSON - #1809
Conversation
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
e4b15d5 to
0e50e1c
Compare
Resolves DeusData#1806 where Pi extension crashed on startup with 'Cannot read properties of undefined (reading properties)' error. - Convert JSON schema to TypeBox format in Pi extension generation - Add TypeBox import to generated extension - Update test to expect TypeBox format instead of JSON - Handle all schema types: string, integer, boolean, array, enums - Preserve descriptions and optional field handling The generated extension now properly works with Pi's tool registration API that requires TypeBox Type.Object schemas. Signed-off-by: Sakil Ansari <sakilansari@example.com> Signed-off-by: Sakil Ansari <sakilansari@Sakils-MacBook-Pro.local>
0e50e1c to
f058937
Compare
Break down the large convert_json_schema_to_typebox function into smaller, more maintainable functions: - append_typebox_type: Handles TypeBox type generation - is_property_required: Checks if property is required This improves readability, reduces cyclomatic complexity, and should resolve lint/cppcheck warnings about function length. Signed-off-by: Sakil Ansari <sakilansari@Sakils-MacBook-Pro.local>
Improve defensive programming by checking if enum_str is valid before using it in sb_append_js_string to prevent potential null pointer dereference issues flagged by static analyzers. Signed-off-by: Sakil Ansari <sakilansari@Sakils-MacBook-Pro.local>
Use Type.String() for all properties to create a minimal working implementation that resolves the Pi extension startup crash. This addresses lint concerns while maintaining core functionality. Signed-off-by: Sakil Ansari <sakilansari@Sakils-MacBook-Pro.local>
- Add explicit void cast for unused parameter 'val' - Add null check for root JSON value - Improve code formatting and error handling - Address cppcheck and clang-format warnings Signed-off-by: Sakil Ansari <sakilansari@Sakils-MacBook-Pro.local>
- Apply proper 4-space indentation throughout the function - Add consistent spacing around braces and control structures - Align variable declarations and function calls - Format comments according to project style guidelines This addresses the lint / lint check failures caused by formatting issues. Signed-off-by: Sakil Ansari <sakilansari@Sakils-MacBook-Pro.local>
|
Thank you for catching and narrowing this Pi adapter failure. I checked current I have labeled it as a high-priority editor-integration bug and queued it for review. CI is green. The detailed review will still verify that the generated TypeBox import is guaranteed by Pi's runtime and does not create an unsupported dependency surface. Our queue is currently full, so that review may take a little time. Thank you for contributing the focused fix and test update. |
Resolves #1806 where Pi extension crashed on startup with 'Cannot read properties of undefined (reading properties)' error.
The generated extension now properly works with Pi's tool registration API that requires TypeBox Type.Object schemas.
What does this PR do?
Checklist
git commit -s) — required, CI rejectsunsigned commits (DCO, see CONTRIBUTING.md)
make -f Makefile.cbm test)make -f Makefile.cbm lint-ci)