Skip to content

codegen: lexicons declare their own upstream release resolver (drop core's hard-coded map) #685

Closed

Description

@lex00

Context

The lexicon self-upgrade feature (epic, weekly cron) checks each pinned lexicon for a newer upstream release.

Finding

packages/core/src/codegen/pinned-upgrade.ts hard-codes each lexicon's upstream source in core:

export const REAL_RESOLVERS: Record<LexiconId, UpstreamResolver> = {
  k8s: () => latestGitHubRelease("kubernetes", "kubernetes", "releases"),
  gcp: () => latestGitHubRelease("GoogleCloudPlatform", "k8s-config-connector", "releases"),
  docker: () => latestGitHubRelease("moby", "moby", "releases"),
  gitlab: () => latestGitHubRelease("gitlab-org", "gitlab", "tags", "-ee"),
};

Which repo/tag-format a lexicon tracks is the lexicon's own knowledge, not core's. Adding a new lexicon with upstream tracking means editing core.

Proposed approach

Let each lexicon declare its upstream resolver through the LexiconPlugin seam — e.g. an optional upstream?(): UpstreamResolver (or a static descriptor { repo, kind, suffix }) that core's upgrade command reads from the loaded plugin. Core keeps the generic latestGitHubRelease helper + the surface-diff pipeline; the per-lexicon repo/tag knowledge lives in the lexicon.

Acceptance criteria

  • pinned-upgrade.ts has no per-lexicon repo map; it consults the loaded lexicon plugins.
  • k8s/gcp/docker/gitlab each declare their upstream in their own package.
  • Upgrade cron behavior unchanged; tests green.
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions