Skip to content

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

Open
RuntimeTerror10 wants to merge 1 commit intomasterfrom
ENGG-5253
Open

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

Conversation

@RuntimeTerror10
Copy link
Member

@RuntimeTerror10 RuntimeTerror10 commented Feb 24, 2026

Summary by CodeRabbit

  • New Features
    • Added example management capabilities for API requests. Users can now create, update, and delete examples to organize and document their API usage.

@linear
Copy link

linear bot commented Feb 24, 2026

@coderabbitai
Copy link

coderabbitai bot commented Feb 24, 2026

Walkthrough

This pull request introduces comprehensive example request management capabilities to the local-sync module. New type definitions (ResponseObject, ExampleRecord, ExampleAPI) are added to the schema and type layers. The FsManager class gains three new public methods for creating, updating, and deleting examples associated with parent requests. A parsing utility function converts example content to the API format. The getAllRecords method is refactored to branch explicitly on resource type and process examples when parsing files. Three corresponding IPC methods are exposed in FsManagerRPCService to make these operations remotely invocable.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • nafees87n
  • iostreamer-X
🚥 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 describes the main change: adding support for examples in local workspaces, which is reflected throughout the changeset with new example management methods, types, and API extensions.

✏️ 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

Comment on lines +1621 to +1673
@HandleError
async deleteExampleRequest(
parentRequestId: string,
exampleId: string
): Promise<FileSystemResult<void>> {
const requestFileResource = this.createResource({
id: parentRequestId,
type: "file",
});

const fileResult = await parseFile({
resource: requestFileResource,
fileType: new ApiRecordFileType(),
});

if (fileResult.type === "error") {
return fileResult;
}

const { content } = fileResult;

if (!content.examples || !(exampleId in content.examples)) {
return {
type: "error",
error: {
code: ErrorCode.UNKNOWN,
message: `Example with id ${exampleId} not found in request ${parentRequestId}`,
path: requestFileResource.path,
fileType: FileTypeEnum.UNKNOWN,
},
};
}

delete content.examples[exampleId];

if (Object.keys(content.examples).length === 0) {
delete content.examples;
}

const writeResult = await writeContent(
requestFileResource,
content,
new ApiRecordFileType()
);

if (writeResult.type === "error") {
return writeResult;
}

return {
type: "success",
};
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use NotFound for missing examples.

Returning ErrorCode.UNKNOWN makes it harder for callers to distinguish “missing example” from unexpected failures. Prefer ErrorCode.NotFound for the not-found branches.

Suggested tweak
@@
-          code: ErrorCode.UNKNOWN,
+          code: ErrorCode.NotFound,
@@
-          code: ErrorCode.UNKNOWN,
+          code: ErrorCode.NotFound,

Also applies to: 1726-1784

🤖 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 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).

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