Skip to content

Allow functions configure to set --response-format - #95

Merged
giordano-lucas merged 2 commits into
mainfrom
fix/functions-configure-response-format
Sep 4, 2026
Merged

Allow functions configure to set --response-format#95
giordano-lucas merged 2 commits into
mainfrom
fix/functions-configure-response-format

Conversation

@giordano-lucas

Copy link
Copy Markdown
Member

Summary

  • notte functions configure --response-format can document run()'s return schema without re-uploading code
  • Flag generator maps JSON-document fields onto application/json bodies (inline / @file / stdin), matching create/update
  • Client and configure flags regenerated from the current staging OpenAPI

Test plan

  • go test ./scripts/gen-flags/ ./internal/cmd/ -run 'JSONBody|FunctionConfigure|Multipart|JSONDocument'
  • make check
  • notte functions configure --response-format @schema.json against a real function; confirm PATCH body sends an object and other metadata is unchanged
  • notte functions configure with no flags still errors with the updated "nothing to configure" message

Made with Cursor

Extend the flag generator so JSON-document fields work on application/json
bodies, regenerate from staging, and wire configure's help and empty-patch
guard to the new flag.

Co-authored-by: Cursor <cursoragent@cursor.com>
@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds --response-format support to notte functions configure, regenerates the API and flag contracts, updates command documentation, and adds unit coverage.

  • Accepts inline JSON, @file, or stdin input.
  • Sends the schema as an object in the metadata PATCH without including unrelated fields.
  • Extends the flag generator to map JSON-document fields into application/json request bodies.
  • The new JSON-body generation path currently loses precision for large numeric schema values.

Confidence Score: 4/5

The PR should not merge until response-format schemas are transferred without silently changing large numeric values.

The new JSON-body path round-trips the schema through map[string]interface{}, so valid large integers can be rounded before the PATCH request and alter the documented return contract.

Files Needing Attention: scripts/gen-flags/codegen.go, internal/cmd/functionconfigure_flags.gen.go

Important Files Changed

Filename Overview
scripts/gen-flags/codegen.go Adds JSON-document mapping for application/json bodies, but decoding into interface values can silently round large numbers.
internal/cmd/functionconfigure_flags.gen.go Registers and builds the new response-format field using the generator’s lossy numeric conversion path.
internal/cmd/functions.go Integrates response-format into configure validation and help while preserving the existing request lifecycle.
internal/api/client.gen.go Adds the generated optional response_format object to the metadata update contract.
internal/cmd/functionsextra_test.go Verifies response-format can be sent alone and unrelated metadata remains omitted, but uses no precision-sensitive numeric values.
scripts/gen-flags/parser_test.go Covers generation of a JSON-document field in an application/json body.
README.md Documents configuring the return schema without re-uploading function code.

Fix all with Greploop Fix All in Claude Code

Prompt To Fix All With AI
### Issue 1
scripts/gen-flags/codegen.go:380
**Large numbers lose precision**

Unmarshalling the schema into `map[string]interface{}` converts JSON numbers to `float64`. A valid schema containing an integer beyond exact float64 precision, such as `{"const":9007199254740993}`, is rounded when the generated client marshals the PATCH body. The service then stores a response schema different from the one the user supplied. Please preserve numeric tokens with `json.Number` or another lossless JSON representation.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Allow functions configure to set --respo..." | Re-trigger Greptile

Comment thread scripts/gen-flags/codegen.go Outdated
@giordano-lucas
giordano-lucas merged commit 2cd164a into main Sep 4, 2026
3 checks passed
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.

1 participant