[codex] Bound shared schema diagnostics#3424
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Filter issues drop nested paths
- Added a Filter case to collectSchemaDiagnosticIssues that recurses into issue.issue when the inner issue is not a bare InvalidValue, matching Effect's own toDefaultIssues behavior to preserve nested field paths.
- ✅ Fixed: Omission suffix lost to truncation
- Changed formatSchemaError to truncate the formatted issues part separately with reserved space for the omission suffix, so the '... and N more issue(s)' line is always preserved regardless of total output length.
Or push these changes by commenting:
@cursor push 216bda4d7c
Preview (216bda4d7c)
diff --git a/packages/shared/src/schemaJson.ts b/packages/shared/src/schemaJson.ts
--- a/packages/shared/src/schemaJson.ts
+++ b/packages/shared/src/schemaJson.ts
@@ -78,6 +78,11 @@
switch (issue._tag) {
case "Encoding":
return collectSchemaDiagnosticIssues(issue.issue, path, diagnostics);
+ case "Filter":
+ if (issue.issue._tag !== "InvalidValue") {
+ return collectSchemaDiagnosticIssues(issue.issue, path, diagnostics);
+ }
+ break;
case "Pointer":
return collectSchemaDiagnosticIssues(issue.issue, [...path, ...issue.path], diagnostics);
case "Composite":
@@ -157,11 +162,11 @@
const omittedIssueCount = issueCount - issues.length;
const formatted = issues.map(formatDiagnosticIssue).join("\n");
- const withOmittedCount =
- omittedIssueCount === 0
- ? formatted
- : `${formatted}\n... and ${omittedIssueCount} more issue(s)`;
- return truncateDiagnostic(withOmittedCount, MAX_SCHEMA_DIAGNOSTIC_LENGTH);
+ if (omittedIssueCount === 0) {
+ return truncateDiagnostic(formatted, MAX_SCHEMA_DIAGNOSTIC_LENGTH);
+ }
+ const suffix = `\n... and ${omittedIssueCount} more issue(s)`;
+ return truncateDiagnostic(formatted, MAX_SCHEMA_DIAGNOSTIC_LENGTH - suffix.length) + suffix;
};
/**You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 034068f. Configure here.
ApprovabilityVerdict: Approved Security improvement that prevents sensitive values from appearing in schema validation error diagnostics. The changes are self-contained to error formatting with comprehensive test coverage verifying no value leakage. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>
034068f to
3277fa3
Compare
Dismissing prior approval to re-evaluate 3277fa3


Summary
Validation
vp test packages/shared/src/schemaJson.test.ts apps/server/src/sourceControl/GitHubCli.test.ts apps/server/src/sourceControl/GitLabCli.test.ts apps/server/src/sourceControl/AzureDevOpsCli.test.ts(30 tests)vp check(passes with 20 pre-existing warnings)vp run typecheckNote
Medium Risk
Changes user-visible validation messages across shared JSON/schema helpers used by server and UI boundaries; behavior is safer for secrets but less detailed for debugging.
Overview
formatSchemaErrorno longer uses Effect Schema’s default formatter (which embedded invalid values). It walks schema issues and emits fixed labels like Invalid type / Invalid value with bounded JSON paths, caps how many issues and how long the string can be, and reports “… and N more issue(s)” when truncated. Defects and interruptions get a count-only summary instead ofCause.prettymessages.Lenient JSON parse failures now propagate the underlying schema issue instead of wrapping them in
InvalidValuewithString(error), so malformed input is not echoed in diagnostics.Tests assert secrets in bad JSON are not present in formatted output.
Reviewed by Cursor Bugbot for commit 3277fa3. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Bound schema diagnostics in
formatSchemaErrorto prevent value exposureformatSchemaErrorimplementation with a value-agnostic formatter that caps the number of issues, path segment count, path segment length, and total diagnostic length, appending an omitted-issues suffix when truncated.SchemaIssuetags to stable strings (e.g.'Invalid type','Missing key') so no user-supplied values appear in diagnostics.InvalidValueissue.formatSchemaErroroutput format changes significantly — callers relying on the previous Schema default formatter output will see different diagnostic strings.Macroscope summarized 3277fa3.