Skip to content

Update merge mode schema and types with backwards-compatible transform #850

@acreeger

Description

@acreeger

Summary

Replace provider-specific merge mode enum values with generic ones and add a schema-level transform for backwards compatibility.

Context

Part of #842 — decoupling merge strategy from VCS provider. The mergeBehavior.mode setting currently uses provider-specific values (github-pr, github-draft-pr, bitbucket-pr) which create a combinatorial explosion as providers are added. This issue establishes the new canonical values that all other child issues consume.

Base branch: This work builds on top of the BitBucket integration branch (PR #609), which has bitbucket-pr already in the enum.

Acceptance Criteria

  • mergeBehavior.mode accepts only local, pr, or draft-pr as canonical output values
  • Old values (github-pr, github-draft-pr, bitbucket-pr) are accepted at parse time and automatically mapped to their generic equivalents via schema-level transform
  • The transform applies to both schema definitions (the one with defaults and the one without)
  • Schema .describe() text references the new generic mode names
  • Telemetry event type for merge_behavior reflects the new canonical values
  • Existing settings files on disk with old values continue to work without manual edits — the transform handles them transparently at load time

Shared Contracts

Produces:

  • mergeBehavior.mode canonical output values: 'local' | 'pr' | 'draft-pr'
  • Schema accepts old values and transforms: github-prpr, github-draft-prdraft-pr, bitbucket-prpr
  • LoomFinishedProperties.merge_behavior type: 'local' | 'pr' | 'draft-pr'

Note on telemetry continuity: After this change, analytics will receive 'pr' and 'draft-pr' instead of 'github-pr' and 'github-draft-pr'. Dashboards or queries filtering on the old values will need updating.

Scope Boundaries

  • Does NOT update consumers of the mode value (other child issues handle that)
  • Does NOT add a file-rewriting migration — the schema transform handles backwards compatibility at runtime
  • Does NOT update code comments in files that aren't otherwise modified

Must-Haves

  • substantive: src/lib/SettingsManager.ts — both Zod schemas define mode with canonical values ['local', 'pr', 'draft-pr'] and a transform accepting old values
  • substantive: src/types/telemetry.ts — merge_behavior type is 'local' | 'pr' | 'draft-pr'

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions