[ENGG-5253]: Add support for examples in local workspaces#300
[ENGG-5253]: Add support for examples in local workspaces#300RuntimeTerror10 wants to merge 2 commits intomasterfrom
Conversation
WalkthroughThis pull request adds example-request support to local-sync: new schema and API types (ResponseObject, ExampleRecord, ExampleAPI); a parsing helper parseExampleContentIntoRecord; FsManager methods createExampleRequest, updateExampleRequest, and deleteExampleRequest; refactors getAllRecords to handle folder vs file branches and include examples when parsing files; and exposes the three new methods over IPC via FsManagerRPCService. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/renderer/actions/local-sync/fs-manager.ts`:
- Around line 1621-1673: The not-found branch in deleteExampleRequest currently
returns ErrorCode.UNKNOWN; change it to return ErrorCode.NotFound (or the
project's canonical NotFound enum value) so callers can distinguish a missing
example from other errors—update the error object in deleteExampleRequest
(referencing requestFileResource, content.examples check and the returned error)
to use ErrorCode.NotFound and make the same change in the analogous not-found
branches around the other example-handling function referenced (the block at the
1726-1784 region).
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/renderer/actions/local-sync/fs-manager.rpc-service.tssrc/renderer/actions/local-sync/fs-manager.tssrc/renderer/actions/local-sync/fs-utils.tssrc/renderer/actions/local-sync/schemas.tssrc/renderer/actions/local-sync/types.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/actions/local-sync/fs-manager.ts (1)
747-761: Consider logging or tracking example parsing failures.Currently, if
parseExampleContentIntoRecordreturns an error, it's silently ignored. While examples may be non-critical, tracking these failures would help with debugging malformed data.♻️ Proposed enhancement to track example errors
const { content: record } = fileResult; if (record.examples) { const parentRequestId = getIdFromPath(resource.path); for (const [exampleId, exampleContent] of Object.entries( record.examples )) { const exampleResult = parseExampleContentIntoRecord( exampleContent, exampleId, parentRequestId ); if (exampleResult.type === "success") { entities.push(exampleResult.content); + } else { + console.warn( + `Failed to parse example ${exampleId} in ${resource.path}:`, + exampleResult.error?.message + ); } } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/renderer/actions/local-sync/fs-manager.ts` around lines 747 - 761, When iterating record.examples in the block that calls parseExampleContentIntoRecord, add handling for non-success returns so parsing failures are not silent: detect when exampleResult.type !== "success" and record or log the failure (include exampleId, parentRequestId from getIdFromPath(resource.path), and the exampleResult error/message). Update the loop around parseExampleContentIntoRecord to push successful contents into entities as before and to call the existing logger/tracker (or a new error-collection structure) for failed parses so malformed example data is discoverable during debugging.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/renderer/actions/local-sync/fs-manager.ts`:
- Around line 747-761: When iterating record.examples in the block that calls
parseExampleContentIntoRecord, add handling for non-success returns so parsing
failures are not silent: detect when exampleResult.type !== "success" and record
or log the failure (include exampleId, parentRequestId from
getIdFromPath(resource.path), and the exampleResult error/message). Update the
loop around parseExampleContentIntoRecord to push successful contents into
entities as before and to call the existing logger/tracker (or a new
error-collection structure) for failed parses so malformed example data is
discoverable during debugging.
Summary by CodeRabbit