Skip to content

feat(storage): add Object Contexts samples and system tests#4

Open
thiyaguk09 wants to merge 3 commits intomainfrom
feat-object-contexts
Open

feat(storage): add Object Contexts samples and system tests#4
thiyaguk09 wants to merge 3 commits intomainfrom
feat-object-contexts

Conversation

@thiyaguk09
Copy link
Copy Markdown
Owner

Description

  • Add setObjectContexts.js to demonstrate CRUD and deletion of contexts.
  • Add getObjectContexts.js to show retrieval of structured metadata.
  • Add listObjectsWithContextFilter.js to demonstrate server-side filtering.
  • Implement comprehensive system tests in files.test.js covering presence, absence (-), and existence (:) filter operators.
  • Ensure samples use correct 'contexts' field with 'custom' map structure.

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

- Add `setObjectContexts.js` to demonstrate CRUD and deletion of
contexts.
- Add `getObjectContexts.js` to show retrieval of structured metadata.
- Add `listObjectsWithContextFilter.js` to demonstrate server-side
filtering.
- Implement comprehensive system tests in `files.test.js` covering
  presence, absence (-), and existence (:) filter operators.
- Ensure samples use correct 'contexts' field with 'custom' map
structure.
@thiyaguk09 thiyaguk09 marked this pull request as ready for review April 6, 2026 11:29
@thiyaguk09
Copy link
Copy Markdown
Owner Author

/gemini summary

@thiyaguk09
Copy link
Copy Markdown
Owner Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces new samples for managing and filtering object contexts in Google Cloud Storage, including scripts for getting, setting, and listing contexts, along with corresponding system tests. Feedback was provided to correct a filename in the usage instructions, improve error handling by wrapping all metadata operations within a single try-catch block, and remove a redundant assertion in the test suite.

Comment thread storage/listObjectContexts.js Outdated
Comment thread storage/setObjectContexts.js Outdated
Comment thread storage/system-test/files.test.js Outdated
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

This pull request introduces new samples and corresponding system tests for managing and filtering Google Cloud Storage object contexts. The changes provide clear examples for developers on how to interact with the 'contexts' metadata field, including setting, retrieving, and performing server-side filtering using various operators.

Highlights

  • New Object Contexts Samples: Added three new sample files: setObjectContexts.js, getObjectContexts.js, and listObjectContexts.js to demonstrate CRUD operations and server-side filtering for object contexts.
  • Comprehensive System Tests: Implemented new system tests in files.test.js to validate the functionality of setting, retrieving, and filtering objects based on custom context metadata.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Activity
  • The author requested a summary and a review.
  • Gemini Code Assist provided feedback regarding file naming consistency in usage instructions.
  • Gemini Code Assist suggested improving error handling by wrapping all setMetadata operations within a single try-catch block.
  • Gemini Code Assist identified a redundant assertion in the system tests.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces new samples for managing and filtering Google Cloud Storage object contexts. I have identified a few improvements: the usage metadata in listObjectContexts.js should be updated to match the filename, the internal try-catch block in setObjectContexts.js can be removed for cleaner error handling, and a redundant assertion in files.test.js should be deleted.

Comment thread storage/listObjectContexts.js Outdated
Comment thread storage/setObjectContexts.js Outdated
Comment thread storage/system-test/files.test.js Outdated
@thiyaguk09 thiyaguk09 changed the title Feat(storage): add Object Contexts samples and system tests feat(storage): add Object Contexts samples and system tests Apr 6, 2026
@thiyaguk09
Copy link
Copy Markdown
Owner Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces new Node.js samples for managing and filtering Google Cloud Storage object contexts, including scripts to set, get, and list objects based on custom metadata, along with corresponding system tests. I have no further feedback, as the reviewer's comment regarding console.error in the test cleanup block does not provide a specific actionable code suggestion.

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