Skip to content

[ENGG-5253]: Add support for examples in local workspaces#300

Open
RuntimeTerror10 wants to merge 2 commits intomasterfrom
ENGG-5253
Open

[ENGG-5253]: Add support for examples in local workspaces#300
RuntimeTerror10 wants to merge 2 commits intomasterfrom
ENGG-5253

Conversation

@RuntimeTerror10
Copy link
Member

@RuntimeTerror10 RuntimeTerror10 commented Feb 24, 2026

Summary by CodeRabbit

  • New Features
    • Add example management for API requests: create, update, and delete examples.
    • Examples are integrated into API records and appear in listings/exports where applicable.
    • New example data type and parsing ensure examples (name, rank, request, response) are preserved and surfaced in the UI/API.

@linear
Copy link

linear bot commented Feb 24, 2026

@coderabbitai
Copy link

coderabbitai bot commented Feb 24, 2026

Walkthrough

This 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

  • iostreamer-X
  • nafees87n
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: adding support for examples in local workspaces, which aligns with the additions of example-management methods, types, and API surface.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ENGG-5253

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7c61ae6 and cd6dae5.

📒 Files selected for processing (5)
  • src/renderer/actions/local-sync/fs-manager.rpc-service.ts
  • src/renderer/actions/local-sync/fs-manager.ts
  • src/renderer/actions/local-sync/fs-utils.ts
  • src/renderer/actions/local-sync/schemas.ts
  • src/renderer/actions/local-sync/types.ts

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/renderer/actions/local-sync/fs-manager.ts (1)

747-761: Consider logging or tracking example parsing failures.

Currently, if parseExampleContentIntoRecord returns 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.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd6dae5 and 2bd9b2f.

📒 Files selected for processing (1)
  • src/renderer/actions/local-sync/fs-manager.ts

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.

2 participants