Conversation
… autosave, map) and update docs [v0.3.0-phase2-baseline]
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <span className="block">Arg: delta/factor</span> | ||
| <input | ||
| className="w-full border rounded px-2 py-1" | ||
| value={String((rule.then.args ?? {}).delta ?? (rule.then.args ?? {}).factor ?? "")} | ||
| onChange={(e) => { | ||
| const raw = e.target.value; | ||
| const num = Number(raw); | ||
| if (raw.trim() === "") { | ||
| setArg("delta", undefined); | ||
| } else if (Number.isFinite(num)) { | ||
| setArg("delta", num); | ||
| } else { | ||
| setArg("delta", raw); | ||
| } | ||
| }} | ||
| value={String((value.then.args ?? {}).delta ?? (value.then.args ?? {}).factor ?? "")} | ||
| onChange={(e) => setArg("delta", Number(e.target.value) || e.target.value)} | ||
| /> |
There was a problem hiding this comment.
Handle empty and zero delta inputs without producing invalid args
The new onChange handler for the delta/factor field now calls setArg("delta", Number(e.target.value) || e.target.value). Because Number("") evaluates to 0, clearing the input stores an empty string instead of removing the argument, and entering 0 stores the string "0" instead of the number 0. The previous implementation trimmed the input and deleted the key when blank, ensuring only valid numeric values were sent. With the current code, normalizing a rule after clearing the field or setting delta to 0 will emit then.args.delta as a string, which CSC’s normalizer expects to be a number and therefore rejects. Consider restoring the explicit parsing/removal logic so blank values delete the argument and zero remains numeric.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_6907860a17108328803753a6c6804be0