Skip to content

api-gate: two copies of one CRD, and CRDs behind directory links #5170

Open

Description

@myasnikovdaniil

Describe the bug

api-gate keys its snapshot by (group, plural) and the last file walked wins, so if the tree ships two copies of one first-party CRD, a sizeable change in the copy that loses is not seen while Helm renders both. The walk also does not follow directory links, and Helm does when it packages a chart.

Both are on current main and hit the same-repo gate the same way, forks are not needed. I found them while testing the fork path of the gate in #3440. The first version of this issue had more placements of a CRD that the detector does not see, they were dropped as out of scope in this comment.

To Reproduce

Run api-gate --base <base> --head <head> on two trees. Base has one cozyrd (packages/system/postgres-rd/cozyrds/postgres.yaml). The CRD is the one from sampleCRD in internal/apigate/parse_test.go.

  1. Base has packages/chart/crds/widget.yaml. Head changes a field there from string to integer and adds an unused copy of the old CRD as packages/zzz-decoy/widget.yaml.
  2. Base has no chart. Head adds packages/chart/Chart.yaml and makes packages/chart/crds a link to a directory outside packages/ and internal/ that holds the CRD.

Expected behaviour

Exit 2 in both cases.

For 1, each copy is checked against its previous version, and a sizeable change in either one is sizeable. Neither copy wins over the other.

For 2, the walk follows directory links as Helm does, and remembers visited targets so a loop cannot hang it.

Actual behaviour

Exit 0, No sizeable API changes detected. Without the decoy file case 1 gives exit 2.

Additional context

Helm v4.3.0.

The tree has no such duplicate today. I scanned main (d32092ac9) with the detector's own discovery and parsing: 3229 YAML files, 31 first-party CRD documents, 3 APIService documents, 31 cozyrds, and none of the 71 (group, plural) keys is defined twice. So the fix is about what happens when a duplicate shows up, and how to pair a copy with its previous version when files move is still open.

Activity

  1. added
    kind/bugCategorizes issue or PR as related to a bug
    triage/needs-triageIndicates an issue needs triage by a maintainer
    area/ciIssues or PRs related to CI workflows, GitHub Actions, automation
    on Oct 30, 2026
  2. changed the title [-]api-gate detector misses first-party CRDs that Helm still ships[/-] [+]api-gate: two copies of one CRD, and CRDs behind directory links[/+] on Nov 2, 2026
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

    area/ciIssues or PRs related to CI workflows, GitHub Actions, automationkind/bugCategorizes issue or PR as related to a bugtriage/needs-triageIndicates an issue needs triage by a maintainer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions