Skip to content

Conversation

@guitavano
Copy link
Contributor

@guitavano guitavano commented Sep 18, 2025

add some examples because it was impossible to remember these keys

Summary by CodeRabbit

  • Documentation

    • Improved inline documentation for facet types to clarify key/value fields. No API changes or user-facing impact.
  • Style

    • Formatting and whitespace cleanups across integrations (Google Docs, Google Sites, Slack, DataForSEO) for consistency.
    • Added a missing end-of-file newline and adjusted minor indentation in comments.
    • No functional, behavioral, or observable changes; all existing flows and outputs remain the same.
  • Chores

    • General code hygiene updates; no action required from users.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 18, 2025

Walkthrough

Whitespace and formatting adjustments across multiple modules; added documentation comments in one type file. No logic, control flow, or public API signatures were changed.

Changes

Cohort / File(s) Summary
Data for SEO
data-for-seo/mod.ts
Adjusted JSDoc indentation for a property; no functional changes.
Google Docs
google-docs/actions/updateDocumentContent.ts
Whitespace-only tweaks; document length calculation and batchUpdate logic unchanged.
Google Sites
google-sites/loaders/searchContent.ts, google-sites/mod.ts
Formatting and newline fixes; no behavior or API changes.
Slack DM
slack/actions/dms/send.ts
Whitespace-only change around channel open call; control flow unchanged.
VTEX Types
vtex/utils/types.ts
Added JSDoc comments to SelectedFacet fields; no type signature changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • mcandeia
  • viktormarinho
  • vitoUwu

Poem

I tidied the code with a hop and a sweep,
Nibbled the whitespace, left logic asleep.
Comments now bloom where types used to hide,
Newlines in place, all neatly aligned.
Thump-thump—review’s quick! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description is a single short sentence ("add some examples because it was impossible to remember these keys") and does not follow the repository template: it lacks a detailed "What is this Contribution About?" section, an Issue link, a Loom video, and a Demonstration link, and it does not include the examples or details referenced. Please update the PR description to follow the repository template by adding a brief summary of the change and rationale, linking the related issue (or stating none), attaching or linking a short Loom screencast, and providing a demonstration/test link or instructions; include the actual examples added and any notes on verification.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "add: description for selectedFacets" directly and concisely summarizes the primary change (adding documentation and examples for selectedFacets) and is relevant to the files and intent in the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tavano/facets-examples

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

@github-actions
Copy link
Contributor

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 0.124.1 update
  • 🎉 for Minor 0.125.0 update
  • 🚀 for Major 1.0.0 update

Copy link
Contributor

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
google-sites/loaders/searchContent.ts (2)

770-783: Pagination bug: passing offset as page number to searchWithCustomSearch

searchWithCustomSearch expects a 1-based page number, but you’re passing start + 1 (an item offset + 1). This will skip far more results than intended (e.g., page=2, pageSize=10 → passing 11 yields startIndex=100 inside the function).

Fix by passing the page number directly:

-    searchResults = await searchWithCustomSearch(
-      query,
-      siteUrlNorm || "",
-      start + 1,
-      pageSize,
-    );
+    searchResults = await searchWithCustomSearch(
+      query,
+      siteUrlNorm || "",
+      page,       // pass page number, not offset
+      pageSize,
+    );

743-748: normalize(siteUrl) returns undefined for undefined input — change normalize or the empty-string check

google-sites/utils/helpers.ts defines export const normalize = (s?: string) => s?.trim().replace(...) so normalize(undefined) is undefined, not "". In google-sites/loaders/searchContent.ts the code uses if (siteUrlNorm === "") — that branch won't run when siteUrl is undefined.

  • Fix A (preferred): make normalize return an empty string for falsy input (google-sites/utils/helpers.ts), e.g. export const normalize = (s?: string) => (s?.trim().replace(/^['"\]\s*|\s*['"`]$/g, "") || "");`
  • Fix B: change the check in google-sites/loaders/searchContent.ts to treat falsy values as empty (e.g. if (!siteUrlNorm) { ... }).
🧹 Nitpick comments (3)
vtex/utils/types.ts (1)

546-555: Nice docs addition; consider examples and typical VTEX keys

The JSDoc helps. Add concrete examples and hint that multiple entries with the same key are allowed (e.g., multiple brands). Also clarify common keys used in VTEX (brand, brandId, category-1..n, specificationFilter_X, productClusterIds).

Apply this doc-only diff if you agree:

 export interface SelectedFacet {
   /**
    * @title Key
-   * @description The key of the facet (e.g. "brand", "category-1", "productClusterIds")
+   * @description The key of the facet.
+   * @example "brand"
+   * @example "brandId"
+   * @example "category-1"
+   * @example "specificationFilter_42"
+   * @example "productClusterIds"
    */
   key: string;
   /**
    * @title Value
-   * @description The value of the facet
+   * @description The value of the facet (usually a slug or ID, depending on the key).
+   * @example "apple"     // for key="brand"
+   * @example "123"       // for key="brandId"
+   * @example "electronics"
+   * @example "true"      // for boolean/text specs
    */
   value: string;
 }
google-docs/actions/updateDocumentContent.ts (1)

83-94: Whitespace-only; optional guard on documentLength

Current logic is fine. As a micro-hardening, you could clamp documentLength to at least 1 to avoid accidental 0 if endIndex were unexpected.

-    let documentLength = 1; // Default to 1 if no content
+    let documentLength = 1; // Default to 1 if no content
@@
-      if (lastElement.endIndex) {
-        documentLength = lastElement.endIndex - 1; // endIndex is exclusive, so subtract 1
-      }
+      if (typeof lastElement.endIndex === "number") {
+        documentLength = Math.max(1, lastElement.endIndex - 1); // endIndex is exclusive
+      }
google-sites/loaders/searchContent.ts (1)

606-613: Optional: extract a named return type for clarity

The inline Promise<{ results; total; unavailable?; info? }> appears multiple times. A named type (e.g., CloudSearchResult) would improve reuse and readability.

+type CloudSearchResult = {
+  results: SearchResult[];
+  total: number;
+  unavailable?: boolean;
+  info?: string;
+};
@@
-): Promise<
-  {
-    results: SearchResult[];
-    total: number;
-    unavailable?: boolean;
-    info?: string;
-  }
-> {
+): Promise<CloudSearchResult> {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a138a4 and b79d75a.

📒 Files selected for processing (6)
  • data-for-seo/mod.ts (1 hunks)
  • google-docs/actions/updateDocumentContent.ts (1 hunks)
  • google-sites/loaders/searchContent.ts (8 hunks)
  • google-sites/mod.ts (1 hunks)
  • slack/actions/dms/send.ts (1 hunks)
  • vtex/utils/types.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
google-sites/loaders/searchContent.ts (1)
google-sites/utils/types.ts (1)
  • SearchResult (7-15)
🔇 Additional comments (4)
data-for-seo/mod.ts (1)

12-13: Formatting-only tweak looks good

JSDoc closing alignment change is fine; no behavioral impact.

slack/actions/dms/send.ts (1)

41-44: No-op whitespace change

All good; flow and error handling remain correct.

google-sites/mod.ts (1)

154-154: EOF newline added — fine

No behavior change.

google-sites/loaders/searchContent.ts (1)

164-167: Safe DOM mutation spacing — OK

The multi-line insertBefore call improves readability without behavior change.

@aka-sacci-ccr aka-sacci-ccr self-assigned this Sep 19, 2025
@guitavano guitavano merged commit 7143dbe into main Sep 19, 2025
5 of 6 checks passed
@guitavano guitavano deleted the tavano/facets-examples branch September 19, 2025 15:18
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.

3 participants