Skip to content

Conversation

thiyaguk09
Copy link

Description

Fixes #

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed guidelines from CONTRIBUTING.MD and Samples Style Guide
  • Tests pass: npm test (see Testing)
  • Lint pass: npm run lint (see Style)
  • Required CI tests pass (see CI testing)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This pull request is from a branch created directly off of GoogleCloudPlatform/nodejs-docs-samples. Not a fork.
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new sample directory, and I created GitHub Actions workflow for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

Note: Any check with (dev), (experimental), or (legacy) can be ignored and should not block your PR from merging (see CI testing).

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Sep 4, 2025
@thiyaguk09 thiyaguk09 marked this pull request as ready for review September 4, 2025 13:05
@thiyaguk09 thiyaguk09 requested review from a team as code owners September 4, 2025 13:05
Copy link

snippet-bot bot commented Sep 4, 2025

Here is the summary of changes.

You are about to add 7 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Copy link
Contributor

@iennae iennae left a comment

Choose a reason for hiding this comment

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

This mostly looks ok. I have a few questions. I did run this through our generation to see what kind of output I received and I've shared those headers for visibility. I think there are a few areas of improvements to make sure there is a try..catch to ensure folks get actionable feedback so they don't assume the code is broken depending on the order in which they run commands.

Thanks!

@thiyaguk09
Copy link
Author

This mostly looks ok. I have a few questions. I did run this through our generation to see what kind of output I received and I've shared those headers for visibility. I think there are a few areas of improvements to make sure there is a try..catch to ensure folks get actionable feedback so they don't assume the code is broken depending on the order in which they run commands.

Thanks!

Thank you for the suggestion. Our samples are designed to demonstrate the simplest "happy path" for a feature, focusing on the core API call. We intentionally omit try...catch blocks to keep the code concise and readable, which helps maintain a consistent style across all of our language samples. Furthermore, unhandled rejections are already handled at the application level to prevent the code from breaking, so the primary goal of our samples remains focused on positive-case demonstration.

@thiyaguk09 thiyaguk09 requested a review from iennae September 9, 2025 09:58
@thiyaguk09 thiyaguk09 force-pushed the anywhere-cache-samples branch from e83ba77 to b5e4d63 Compare September 12, 2025 07:54
@thiyaguk09 thiyaguk09 force-pushed the anywhere-cache-samples branch from b5e4d63 to a15ae91 Compare September 22, 2025 08:14
@thiyaguk09
Copy link
Author

@iennae Just a friendly reminder to review this PR when you get a chance. Thanks!

@thiyaguk09 thiyaguk09 force-pushed the anywhere-cache-samples branch from a15ae91 to bb23814 Compare October 8, 2025 06:11
@thiyaguk09
Copy link
Author

@iennae That's great feedback, thank you for running the samples and sharing the output headers—having that visibility is really helpful. The issues have been fixed and pushed here; could you please take a look?

Improve Anywhere Cache API samples (Documentation & Error Handling)

* Wraps all asynchronous Anywhere Cache API samples (Create, Get, List,
Disable, Pause, Resume) in `try...catch` blocks for production
readiness.
* Adds specific gRPC error code checks (NOT_FOUND, FAILED_PRECONDITION)
to provide better diagnostic feedback to users.
* Clarifies documentation regarding the optional nature and default
values of `ttl` and `admissionPolicy` for cache creation.
@thiyaguk09 thiyaguk09 force-pushed the anywhere-cache-samples branch from fd4b63b to 572f7f1 Compare October 8, 2025 09:57
…rage

Updates tests for all Anywhere Cache management methods (Create, Get,
List, Resume, Disable, Pause) to align with enhanced sample script
output.

**(Tests were skipped due to reliance on Long-Running Operations (LROs)
in the sample code.)**

This includes:
* **Enhanced Assertions:** Asserting against all newly added detail
fields (e.g., Name, State, TTL) to verify full API response parsing in
Get and List samples.
* **Negative Scenario Coverage:** Adding explicit **negative scenario
tests** for state-dependent operations (Disable, Pause, Resume) to
assert graceful failure on expected errors like `FAILED_PRECONDITION`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants