Skip to content

Migrate branding spec to deployConfig + transformRemoteToLocal#6910

Open
ryancbahan wants to merge 1 commit intorcb/contract-point-of-salefrom
rcb/contract-branding
Open

Migrate branding spec to deployConfig + transformRemoteToLocal#6910
ryancbahan wants to merge 1 commit intorcb/contract-point-of-salefrom
rcb/contract-branding

Conversation

@ryancbahan
Copy link
Contributor

@ryancbahan ryancbahan commented Feb 28, 2026

Summary

  • Remove transformConfig from branding spec, set deployConfig and transformRemoteToLocal directly
  • Reverse transform maps app_handlehandle, namename
  • transformLocalToRemote is now undefined
  • Part of the app module contracts migration

Test plan

  • Reverse transform test passes unchanged
  • New test verifies transformLocalToRemote is undefined

🤖 Generated with Claude Code

@github-actions
Copy link
Contributor

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.

Caution

DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

@ryancbahan ryancbahan force-pushed the rcb/contract-point-of-sale branch from 036d663 to e0af67f Compare February 28, 2026 02:47
@ryancbahan ryancbahan force-pushed the rcb/contract-branding branch from 1f345db to 805f23f Compare February 28, 2026 02:47
@github-actions
Copy link
Contributor

github-actions bot commented Feb 28, 2026

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 78.82% 14521/18424
🟡 Branches 73.17% 7223/9872
🟡 Functions 79.03% 3694/4674
🟡 Lines 79.15% 13727/17342

Test suite run success

3782 tests passing in 1450 suites.

Report generated by 🧪jest coverage report action from 0053593

identifier: BrandingSpecIdentifier,
schema: BrandingSchema,
transformConfig: BrandingTransformConfig,
deployConfig: async (config) => configWithoutFirstClassFields(config),

Choose a reason for hiding this comment

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

deployConfig signature mismatch (ignored params) may cause behavior drift

ExtensionSpecification.deployConfig is typed as (config, directory, apiKey, moduleId?) => Promise<...> (per specification.ts). In app_config_branding.ts, deployConfig is now async (config) => ..., ignoring directory/apiKey/moduleId. While extra args are tolerated at runtime, this can silently diverge from wrappers/future logic that rely on arity/params (logging, auditing, feature flags, module scoping). It’s also unclear whether configWithoutFirstClassFields alone preserves the required remote payload key shape previously handled by transformConfig.

identifier: BrandingSpecIdentifier,
schema: BrandingSchema,
transformConfig: BrandingTransformConfig,
deployConfig: async (config) => configWithoutFirstClassFields(config),

Choose a reason for hiding this comment

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

Removing transformLocalToRemote may change remote payload keys (handle vs app_handle)

Previously, transformConfig provided a forward transform (handle -> app_handle). With transformConfig removed and transformLocalToRemote now undefined (and explicitly tested), branding configs may be deployed without translating handle to app_handle unless another layer does it.

Evidence: createConfigExtensionSpecification only auto-creates transformLocalToRemote if transformConfig is provided; otherwise it remains undefined.

Impact: deploy/update may fail validation or silently ignore fields if the API expects app_handle, causing confusing drift between local and remote state.

@binks-code-reviewer
Copy link

binks-code-reviewer bot commented Feb 28, 2026

🤖 Code Review · #projects-dev-ai for questions
React with 👍/👎 or reply — all feedback helps improve the agent.

Complete - 2 findings

📋 History

✅ 2 findings → ✅ No issues → ✅ 2 findings

@ryancbahan ryancbahan force-pushed the rcb/contract-branding branch from 805f23f to 722da12 Compare February 28, 2026 20:16
Remove transformConfig, set deployConfig (configWithoutFirstClassFields
pass-through) and transformRemoteToLocal directly (app_handle → handle).
transformLocalToRemote is now undefined.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ryancbahan ryancbahan force-pushed the rcb/contract-branding branch from 722da12 to 0053593 Compare February 28, 2026 20:50
transformRemoteToLocal: (content: object) => ({
name: (content as {name?: string}).name,
handle: (content as {app_handle?: string}).app_handle,
}),

Choose a reason for hiding this comment

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

Reverse transform only reads app_handle; could drop handle if backend migrated

transformRemoteToLocal maps handle exclusively from content.app_handle. If the backend has migrated to return handle (matching the new deploy behavior), pulls/syncs will start producing handle: undefined and lose the value in local config.

Evidence:

handle: (content as {app_handle?: string}).app_handle,

Impact:

  • Local config may lose branding handle on pull/sync.
  • Causes local/remote drift and repeated diffs.

transformRemoteToLocal: (content: object) => ({
name: (content as {name?: string}).name,
handle: (content as {app_handle?: string}).app_handle,
}),

Choose a reason for hiding this comment

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

Reverse transform returns explicit undefined keys, which may clobber existing config

The new transformRemoteToLocal always returns { name: ..., handle: ... } even when fields are missing, which can produce {name: undefined, handle: undefined}. Some merge strategies treat explicit undefined as an overwrite, potentially clearing existing local values.

Previously, reverse-transform logic only copied keys when present (e.g., if (content[key] !== undefined) result[key] = content[key]), avoiding clobbering.

Impact:

  • Pulling/syncing from partial remote responses could wipe locally configured name/handle.
  • Leads to configuration loss and hard-to-debug drift.

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