Skip to content

fix(confluence): normalize space identifiers - #7324

Open
BillLeoutsakosvl346 wants to merge 2 commits into
stagingfrom
fix/confluence-space-identifiers
Open

fix(confluence): normalize space identifiers#7324
BillLeoutsakosvl346 wants to merge 2 commits into
stagingfrom
fix/confluence-space-identifiers

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346 BillLeoutsakosvl346 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes Confluence workflow failures caused by mixing human-readable space keys with numeric Confluence Cloud space IDs.

The mismatch pre-existed PR #7185: selectors could save a key such as ENG, while the Confluence V2 runtime paths and bodies require the numeric space ID. This PR:

  • keeps numeric-ID selector semantics for V2 operations;
  • gives search_in_space a key-based selector because V1 CQL searches by space key;
  • migrates legacy saved search fields without changing public tool contracts;
  • resolves legacy keys to numeric IDs for V2 calls, and legacy numeric IDs to keys for V1 search;
  • checks current and archived spaces and requires an exact key match;
  • leaves Confluence connectors unchanged because their CQL and sync behavior intentionally uses space keys.

Affected operations

Numeric V2 ID semantics:

  • create_page
  • get_space
  • update_space
  • delete_space
  • list_pages_in_space
  • create_blogpost
  • list_blogposts_in_space
  • list_space_labels
  • list_space_permissions
  • list_space_properties
  • create_space_property
  • delete_space_property

Key semantics:

  • search_in_space

Atlassian API evidence

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

Focused behavior-level coverage was added without duplicating every operation:

  • legacy basic and advanced search values migrate, serialize, and reach the tool as spaceKey;
  • a representative V2 operation resolves ENG to 12345, uses /spaces/12345/pages, and passes numeric 12345 through without lookup;
  • legacy numeric search input resolves to ENG before constructing key-based V1 CQL.

Validation completed:

  • bun run test -- blocks/blocks/confluence.test.ts lib/internal/confluence/operations.test.ts lib/internal/confluence/execute-tool.test.ts lib/selectors/server/providers/confluence.test.ts connectors/confluence/confluence.test.ts blocks/blocks.test.ts — 6 files, 199 tests passed
  • bun run apps/sim/scripts/check-canvas-sentences.ts --block=confluence_v2 — 46/46 passed
  • targeted Biome checks — passed
  • bun run type-check — passed
  • bun run check:api-validation — passed
  • git diff --check — passed

Browser validation was attempted, but the stored Confluence OAuth credential returned Atlassian HTTP 401. No live provider result or screenshots are included; the PR was opened after that browser gate was explicitly waived.

Reviewers should focus on selector value semantics, the search-only subblock migration, exact-match legacy normalization, and unchanged connector behavior.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Not included: live browser validation was blocked by the expired Confluence OAuth credential.

@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 1, 2026 12:34am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR separates key-based Confluence scoped search from numeric-ID V2 operations while preserving legacy saved workflows.

  • Adds key-specific basic and advanced selector fields for search_in_space.
  • Migrates legacy search selector values to the new canonical field pair.
  • Resolves legacy keys to numeric IDs for V2 operations and numeric IDs to keys for V1 CQL search.
  • Adds focused migration and operation-level regression tests.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security defects identified.

The selector split, operation-scoped migration, canonical parameter mapping, and runtime identifier normalization remain aligned across legacy and newly configured workflows.

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/confluence.ts Introduces a key-specific selector pair for scoped search and maps its canonical value to the existing public spaceKey tool parameter.
apps/sim/lib/internal/confluence/operations.ts Adds bidirectional space identifier normalization and applies numeric IDs consistently to V2 space operations.
apps/sim/lib/workflows/migrations/subblock-migrations.ts Migrates legacy scoped-search fields into the new key-specific basic and advanced fields without affecting other operations.
apps/sim/blocks/blocks/confluence.test.ts Verifies legacy basic and advanced search values survive migration and serialization.
apps/sim/lib/internal/confluence/operations.test.ts Verifies key-to-ID normalization for V2 calls and ID-to-key normalization for V1 CQL search.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Saved or selected space value] --> B{Operation}
  B -->|V2 space operation| C{Numeric value?}
  C -->|Yes| D[Use numeric space ID]
  C -->|No| E[Look up exact current or archived key]
  E --> D
  B -->|V1 search_in_space| F{Numeric value?}
  F -->|Yes| G[Resolve ID to space key]
  F -->|No| H[Use space key]
  G --> I[Construct key-based CQL]
  H --> I
Loading

Reviews (1): Last reviewed commit: "fix(confluence): normalize space identif..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 5 files

Confidence score: 3/5

  • In apps/sim/lib/workflows/migrations/subblock-migrations.ts, migrating a numeric legacy spaceSelector into the key-based selector leaves the value unconverted, so confluence.spaces may look up the wrong key and fail to resolve the selected space; convert the legacy value during migration or preserve compatible handling.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/lib/workflows/migrations/subblock-migrations.ts">

<violation number="1" location="apps/sim/lib/workflows/migrations/subblock-migrations.ts:146">
P2: When a legacy basic search block stores a numeric `spaceSelector` value, this rename moves it into the key-based selector without converting the value. The `confluence.spaces` detail lookup then treats `12345` as a key instead of resolving it to `ENG`, so the migrated selector cannot hydrate and appears blank; normalize the ID to a key before using the key selector, or make the key-selector detail path resolve legacy numeric IDs.</violation>
</file>

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

Fix all with cubic | Re-trigger cubic

confluence_v2: [
{
from: 'spaceSelector',
to: 'spaceKeySelector',

@cubic-dev-ai cubic-dev-ai Bot Sep 1, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: When a legacy basic search block stores a numeric spaceSelector value, this rename moves it into the key-based selector without converting the value. The confluence.spaces detail lookup then treats 12345 as a key instead of resolving it to ENG, so the migrated selector cannot hydrate and appears blank; normalize the ID to a key before using the key selector, or make the key-selector detail path resolve legacy numeric IDs.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/sim/lib/workflows/migrations/subblock-migrations.ts, line 146:

<comment>When a legacy basic search block stores a numeric `spaceSelector` value, this rename moves it into the key-based selector without converting the value. The `confluence.spaces` detail lookup then treats `12345` as a key instead of resolving it to `ENG`, so the migrated selector cannot hydrate and appears blank; normalize the ID to a key before using the key selector, or make the key-selector detail path resolve legacy numeric IDs.</comment>

<file context>
@@ -140,6 +140,14 @@ export const SUBBLOCK_ID_MIGRATIONS: Record<string, readonly SubblockIdMigration
+  confluence_v2: [
+    {
+      from: 'spaceSelector',
+      to: 'spaceKeySelector',
+      whenOperation: ['search_in_space'],
+    },
</file context>
Fix with cubic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 46fda04. The key-based confluence.spaces detail path now recognizes legacy numeric values, hydrates them through GET /api/v2/spaces/{id}, and preserves the stored numeric option ID while returning the provider label. Added a focused regression test; the Confluence block, selector-provider, and operation suites pass (3 files, 17 tests).

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai re-review this PR, focusing on legacy numeric search-selector hydration.

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 1, 2026

Copy link
Copy Markdown

@cubic-dev-ai re-review this PR, focusing on legacy numeric search-selector hydration.

@BillLeoutsakosvl346 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 7 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

Re-trigger cubic

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

Live Confluence browser validation

Validated against simselector829.atlassian.net using Software Development (key SD, numeric ID 557061).

  • V2 space selection stored numeric 557061; List Pages succeeded.
  • Legacy V2 key SD normalized to the numeric ID and succeeded.
  • Search in Space stored key SD and returned results.
  • Legacy search value 557061 normalized back to SD and returned the same results.
  • Live confluence.spaces detail hydration returned { id: '557061', label: 'Software Development (SD)' }.
Browser evidence (11 screenshots) 11-list-pages-legacy-key-success 10-list-pages-input-numeric-id 09-list-pages-numeric-selector-success 08-search-space-input-legacy-numeric 07-search-space-legacy-numeric-success 06-search-space-input-key 05-search-space-key-success 04-v2-get-space-legacy-key-success 03-v2-get-space-input-numeric-id 02-v2-get-space-numeric-success 01-v2-space-selector-basic

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