Skip to content

Compute(): append mode — partition, squatters, convergence #26

Description

@Ilyes512

Goal

internal/plan/plan.go:

func Compute(desired []config.Label, current []github.Label, mode Mode, renames []Rename) Plan

Pure, no I/O. This is the heart of the tool and the reason internal/plan imports no client.

Design reference

docs/design.md § Reconciliation algorithm,
§ Ordering, § Steps

Scope

  • Partition remote labels into matched and unconfigured, comparing names
    case-insensitively
  • Reserve every desired colour
  • Detect squatters — unconfigured labels sitting on a reserved colour — and emit a recolour for
    each, sorted by name ascending, feeding each new colour back into used
  • Converge configured labels in ascending name order: Create when absent; Update when
    colour, description, or casing differs; NoOp otherwise (retained for reporting, never
    sent to the API)
  • Emit actions in the design's order — renames, recolours, creates, updates, deletes. Recolours
    precede the claim so every intermediate state is clean if the run aborts mid-repository.
    GitHub permits duplicate colours, so this is about crash-consistency, not validity
  • Descriptions are authoritative: an omitted description means "", which means clear it

Tests

The core suite. Table-driven over (desired, current, mode, renames) → expected actions, covering
squatter detection, casing drift, description clearing, and action ordering.

Depends on

#19, #24, #25

Done when

task lint and task test pass, every box above is ticked, and the change ships with its tests and documentation in the same PR (per AGENTS.md).

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions