Skip to content

fix: add hubId preRequisites#2362

Closed
maheshkutty wants to merge 1 commit intodevelopfrom
fix.hs_hubid_check
Closed

fix: add hubId preRequisites#2362
maheshkutty wants to merge 1 commit intodevelopfrom
fix.hs_hubid_check

Conversation

@maheshkutty
Copy link
Collaborator

@maheshkutty maheshkutty commented Feb 25, 2026

🔒 Scanned for secrets using gitleaks 8.28.0

Write a brief explainer on your code changes.

Check linear ticket

image

What is the related Linear task?

Resolves INT-5951

Please explain the objectives of your changes below

Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

N/A

Any new dependencies introduced with this change?

N/A

Any new checks got introduced or modified in test suites. Please explain the changes.

N/A


Developer checklist

  • My code follows the style guidelines of this project

  • No breaking changes are being introduced.

  • All related docs linked with the PR?

  • All changes manually tested?

  • Any documentation changes needed with this change?

  • I have executed schemaGenerator tests and updated schema if needed

  • Are sensitive fields marked as secret in definition config?

  • My test cases and placeholders use only masked/sample values for sensitive fields

  • Is the PR limited to 10 file changes & one task?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

Summary by CodeRabbit

  • Configuration Updates
    • Hub ID configuration field relocated to Connection settings section from Destination settings.
    • Hub ID is now required when using the legacy API version.
    • Stricter validation rules apply to Hub ID format to prevent configuration errors.
    • Users must provide Hub ID during setup when using legacy API connection type.

🔒 Scanned for secrets using gitleaks 8.28.0
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

The Hub ID field in the HubSpot destination UI configuration was relocated from the Destination-specific settings section to the Connection settings section, with an added prerequisite that the API version must be set to "legacyApi".

Changes

Cohort / File(s) Summary
HubSpot Configuration
src/configurations/destinations/hs/ui-config.json
Hub ID field moved from Destination settings to Connection settings with stricter constraints and a legacyApi version prerequisite.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Hub ID hops to a new place,
Connection settings now embrace,
With legacyApi's gentle gate,
Configuration feels just great!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: add hubId preRequisites' directly relates to the main change: relocating the hubId field and adding apiVersion prerequisites to it.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description follows the required template structure with all main sections present, including Linear task reference (INT-5951), objectives explanation, and developer/reviewer checklists.

✏️ 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 fix.hs_hubid_check

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
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: 2

🤖 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/configurations/destinations/hs/ui-config.json`:
- Line 126: The placeholder value "e.g: 74X991" in ui-config.json is misleading
because HubSpot Hub IDs are numeric; update the "placeholder" field (currently
"e.g: 74X991") to a fully numeric example such as "e.g: 749991" so the
"placeholder" key reflects a valid Hub ID format and avoids confusion for users.
- Around line 128-136: Update the placeholder for the HubSpot Hub ID field to
use a numeric-only example (replace the current "e.g: 74X991" with something
like "e.g: 1234567") so it reflects actual HubSpot Hub ID format; leave the
existing required: true and the preRequisites block (including configKey
"apiVersion" with value "legacyApi") unchanged since that pattern is handled
elsewhere.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3f4ad6 and cdba324.

📒 Files selected for processing (1)
  • src/configurations/destinations/hs/ui-config.json

"configKey": "hubID",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$",
"regexErrorMessage": "Invalid Hub ID",
"placeholder": "e.g: 74X991",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Placeholder "74X991" may mislead users — HubSpot Hub IDs are numeric.

The placeholder contains an alphabetic X character (likely used to redact a real ID), but actual HubSpot Hub IDs are purely numeric (e.g., 7499911). Consider replacing it with a fully numeric example such as "e.g: 749991" to avoid confusion.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/configurations/destinations/hs/ui-config.json` at line 126, The
placeholder value "e.g: 74X991" in ui-config.json is misleading because HubSpot
Hub IDs are numeric; update the "placeholder" field (currently "e.g: 74X991") to
a fully numeric example such as "e.g: 749991" so the "placeholder" key reflects
a valid Hub ID format and avoids confusion for users.

Comment on lines +128 to +136
"required": true,
"preRequisites": {
"fields": [
{
"configKey": "apiVersion",
"value": "legacyApi"
}
]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the actual file to confirm the context
cat -n src/configurations/destinations/hs/ui-config.json | sed -n '75,140p'

Repository: rudderlabs/rudder-integrations-config

Length of output: 3389


🏁 Script executed:

# Search for fields combining required:true and preRequisites across the repo
find src/configurations/destinations -name "ui-config.json" -type f | while read f; do
  python3 << 'PYEOF'
import json
import sys

try:
    with open(sys.argv[1]) as file:
        data = json.load(file)
    
    def find_fields_with_both(node, path=""):
        results = []
        if isinstance(node, dict):
            # Check if this node has both required and preRequisites
            if node.get('required') is True and 'preRequisites' in node:
                config_key = node.get('configKey', '?')
                results.append(f"{sys.argv[1]}: {config_key}")
            
            # Recurse into all values
            for key, value in node.items():
                results.extend(find_fields_with_both(value, f"{path}.{key}"))
        elif isinstance(node, list):
            for i, item in enumerate(node):
                results.extend(find_fields_with_both(item, f"{path}[{i}]"))
        
        return results
    
    matches = find_fields_with_both(data)
    if matches:
        for match in matches:
            print(match)
except json.JSONDecodeError:
    pass
PYEOF
done | sort | uniq

Repository: rudderlabs/rudder-integrations-config

Length of output: 26785


🏁 Script executed:

# Check HubSpot Hub ID format - search for documentation or examples in code
rg -i "hub.*id|hubspot" src/configurations/destinations/hs/ -A 2 -B 2 | head -50

Repository: rudderlabs/rudder-integrations-config

Length of output: 4596


🏁 Script executed:

# Look at the hs destination configuration more broadly to understand context
cat src/configurations/destinations/hs/ui-config.json | python3 -m json.tool | sed -n '1,150p'

Repository: rudderlabs/rudder-integrations-config

Length of output: 9030


🏁 Script executed:

# Better search for fields combining required:true and preRequisites across all ui-config.json files
find src/configurations/destinations -name "ui-config.json" -type f -exec grep -l "required" {} \; | head -20 | while read file; do
  python3 << 'EOF'
import json
import sys

filepath = sys.argv[1]
try:
    with open(filepath) as f:
        data = json.load(f)
    
    def find_required_with_prereqs(node, path=""):
        results = []
        if isinstance(node, dict):
            # Check if this object has both "required": true AND "preRequisites"
            if node.get("required") is True and "preRequisites" in node:
                config_key = node.get("configKey", "unknown")
                results.append((filepath, config_key))
            for value in node.values():
                results.extend(find_required_with_prereqs(value, path))
        elif isinstance(node, list):
            for item in node:
                results.extend(find_required_with_prereqs(item, path))
        return results
    
    matches = find_required_with_prereqs(data)
    for f, key in matches:
        print(f"{f}: {key}")
except Exception as e:
    pass
EOF
done | sort

Repository: rudderlabs/rudder-integrations-config

Length of output: 10363


🏁 Script executed:

# Check HubSpot Hub ID format - search for documentation or references
rg -i "hubspot.*hub.*id|hub.*id.*numeric|hub.*id.*format" --type json -A 2 -B 2 | head -30

Repository: rudderlabs/rudder-integrations-config

Length of output: 63


🏁 Script executed:

# Look for any example Hub IDs or documentation about Hub ID format in the repo
rg "74X991|hub.id|hubID" src/configurations/destinations/hs/ -B 3 -A 3

Repository: rudderlabs/rudder-integrations-config

Length of output: 2664


🏁 Script executed:

# Use rg to find any field with both "required": true and "preRequisites" in its parent scope
# This is a text search approach
rg -A 5 '"required":\s*true' src/configurations/destinations/ --type json | rg -B 5 'preRequisites' | head -100

Repository: rudderlabs/rudder-integrations-config

Length of output: 7106


🏁 Script executed:

# Simpler: just find how many ui-config.json files have fields with both required and preRequisites
cd src/configurations/destinations && for f in */ui-config.json; do
  if grep -l '"required"\s*:\s*true' "$f" 2>/dev/null | xargs grep -l 'preRequisites' 2>/dev/null; then
    echo "=== $f ==="
    # Extract fields that have both
    cat "$f" | python3 << 'EOF'
import json, sys
try:
    data = json.load(sys.stdin)
    def walk(obj):
        if isinstance(obj, dict):
            if obj.get('required') is True and 'preRequisites' in obj:
                print(f"  - {obj.get('configKey', '?')}")
            for v in obj.values():
                walk(v)
        elif isinstance(obj, list):
            for item in obj:
                walk(item)
    walk(data)
except:
    pass
EOF
  fi
done | head -50

Repository: rudderlabs/rudder-integrations-config

Length of output: 1600


🏁 Script executed:

# Search for HubSpot Hub ID format in comments or documentation
rg -i "hub.?id" src/configurations/destinations/hs/ --type json --context 2

Repository: rudderlabs/rudder-integrations-config

Length of output: 2201


🏁 Script executed:

# Search for any HubSpot documentation or comments in the codebase about Hub ID format
rg -i "hubspot|hub.?id" src/configurations/destinations/hs/ -B 2 -A 2 | grep -i "numeric\|digit\|format\|id" | head -20

Repository: rudderlabs/rudder-integrations-config

Length of output: 760


🏁 Script executed:

# Check if the schema.json actually enforces numeric-only validation
cat src/configurations/destinations/hs/schema.json | python3 -m json.tool | grep -A 5 "hubID"

Repository: rudderlabs/rudder-integrations-config

Length of output: 304


🌐 Web query:

HubSpot Hub ID format numeric vs alphanumeric

💡 Result:

  • Hub ID (hub_id) / Portal ID (portalId) is numeric (digits only). HubSpot treats the account identifier as a number (e.g., hub_id: 1234567) in OAuth token metadata and API schemas. [1], [2]
  • You may sometimes see it serialized as a string in templating variables (e.g., HubL lists hub_id / portal_id as a “String”), but it’s still an all-digits ID, not an alphanumeric code. [3]
  • If you’re seeing an alphanumeric “ID” in HubSpot, it’s usually something else (commonly a GUID/UUID for assets like forms), not the Hub/Portal ID. [4]

Sources: [1] [2] [3] [4]


🏁 Script executed:

# Look for comments or documentation in README or other docs about this destination
find src/configurations/destinations/hs -type f \( -name "*.md" -o -name "README*" \) -exec cat {} \;

Repository: rudderlabs/rudder-integrations-config

Length of output: 63


🏁 Script executed:

# Check if there are any transformation or validation files that might show expected format
find src/configurations/destinations/hs -type f ! -name "*.json" ! -name "*.md" | head -20

Repository: rudderlabs/rudder-integrations-config

Length of output: 63


Update placeholder to reflect actual HubSpot Hub ID format.

The placeholder "e.g: 74X991" is misleading—HubSpot Hub IDs are numeric only (e.g., 1234567), not alphanumeric. Change the placeholder to use a purely numeric example.

Regarding required: true combined with preRequisites, this pattern is established and commonly used across 27+ destinations in the codebase (woopra, zoho, zapier, zendesk, segment, etc.), suggesting the UI framework handles it correctly. No change needed for this aspect.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/configurations/destinations/hs/ui-config.json` around lines 128 - 136,
Update the placeholder for the HubSpot Hub ID field to use a numeric-only
example (replace the current "e.g: 74X991" with something like "e.g: 1234567")
so it reflects actual HubSpot Hub ID format; leave the existing required: true
and the preRequisites block (including configKey "apiVersion" with value
"legacyApi") unchanged since that pattern is handled elsewhere.

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a3f4ad6) to head (cdba324).

Additional details and impacted files
@@            Coverage Diff            @@
##           develop     #2362   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           72        72           
  Branches         8         8           
=========================================
  Hits            72        72           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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