Skip to content

feat(gha): Revert "run the affected unit tests against OpenTofu (#439)" - #446

Merged
so0k merged 1 commit into
open-constructs:mainfrom
jsteinich:revert/opentofu-unit-axis
Sep 18, 2026
Merged

so0k merged 1 commit into
open-constructs:mainfrom
jsteinich:revert/opentofu-unit-axis

Conversation

@jsteinich

Copy link
Copy Markdown
Contributor

Related issue

Reverts #439, which is failing the OpenTofu unit job on every PR that touches a terraform-tagged project and blocking all CI since it merged.

Why it passed review and then broke main

#439's green check was vacuous. Its diff touched only .github/workflows/pr-unit.yml. The job it added runs nx affected -t test --exclude='*,!tag:unit-test:terraform', so on a workflow-only change nx affected resolved to no terraform-tagged projects and the OpenTofu job ran zero tests. The check went green having proved nothing.

That is the same shape as the release.yml matrix bug caught during review on the same PR: a workflow change whose effect cannot be observed from the PR that makes it.

Two independent problems, once it runs for real

1. Unsigned provider pins. OpenTofu rejects kreuzwerker/docker 2.16.0 (provider-generator/src/get/__tests__/generator/versions-file.test.ts:36) and 3.0.2 (provider-generator/src/__tests__/provider.test.ts:130):

Error while installing kreuzwerker/docker v2.16.0: the provider is not signed
with a valid signing key

Same class as #301 / #429 / #436 / #440. Missed because these carry the version inline in a test fixture rather than in a cdktf.json, so the earlier sweeps did not catch them. Signing starts at 3.7.0, not at the 3.x major — see #440.

2. Snapshots that embed a fully qualified provider name. provider-schema/src/__tests__/provider-schema.test.ts:

  "provider_versions": {
-   "registry.terraform.io/hashicorp/null": "3.1.0"
+   "registry.opentofu.org/hashicorp/null": "3.1.0"
  }

No single snapshot can satisfy both CLIs. This is not a pin bump — it needs the registry host normalised out of the snapshot, per-CLI snapshots, or those tests excluded from the tofu run. It is the same CLI-dependence #443 addresses for documentation links, showing up in schema snapshots.

Why revert rather than fix forward

Problem 1 is a two-line bump. Problem 2 needs a decision about how schema snapshots should behave across CLIs, and every PR is blocked while that is settled. Reverting restores CI now and lets the fixture and snapshot work land on its own merits.

What re-landing needs

  • Bump the two unsigned pins to a signed version (>= 3.7.0).
  • Decide how FQPN-bearing snapshots behave under a non-Terraform CLI.
  • Keep the axis red on its own PR until the fixtures are clean. A change to pr-unit.yml alone cannot demonstrate that the suites pass under OpenTofu; the PR that re-lands it should also touch a terraform-tagged project, or the job should be verified by running it directly.

🤖 Generated with Claude Code

…-constructs#439)"

This reverts commit 823682d.

The OpenTofu unit job fails on every PR that touches a terraform-tagged
project, blocking all CI since the merge.

It passed on its own PR vacuously. open-constructs#439's diff touched only
.github/workflows/pr-unit.yml, so `nx affected` resolved to no
terraform-tagged projects and the tofu job ran zero tests. The green check
proved nothing.

Two independent problems surface once it runs for real:

1. Unsigned provider pins OpenTofu rejects - kreuzwerker/docker 2.16.0 in
   provider-generator's versions-file.test.ts and 3.0.2 in its
   provider.test.ts. Same class as open-constructs#301/open-constructs#429/open-constructs#436/open-constructs#440, missed because those
   pins carry a version inline rather than in a cdktf.json.

2. Snapshots that embed a fully qualified provider name. provider-schema's
   provider-schema.test.ts snapshot contains
   "registry.terraform.io/hashicorp/null" under terraform and
   "registry.opentofu.org/hashicorp/null" under tofu. No single snapshot can
   satisfy both CLIs, so this is not a pin bump - it needs the host
   normalized out of the snapshot, per-CLI snapshots, or those tests excluded
   from the tofu run.

Reverting to unblock, rather than fixing forward, because (2) needs a
decision rather than a patch. Re-landing should keep the axis red on its own
PR until the fixtures are clean - a change to pr-unit.yml alone cannot
demonstrate that.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jsteinich jsteinich changed the title Revert "feat(gha): run the affected unit tests against OpenTofu (#439)" feat(gha): Revert "run the affected unit tests against OpenTofu (#439)" Sep 18, 2026
@jsteinich
jsteinich marked this pull request as ready for review September 18, 2026 02:23
@jsteinich
jsteinich requested a review from a team as a code owner September 18, 2026 02:23
@so0k
so0k merged commit ae015ef into open-constructs:main Sep 18, 2026
261 of 262 checks passed
jsteinich added a commit to jsteinich/cdk-terrain that referenced this pull request Sep 19, 2026
Re-lands open-constructs#439 with the fixtures actually fixed. That PR passed vacuously -
its diff touched only pr-unit.yml, so `nx affected` resolved to no
terraform-tagged projects and the tofu job ran zero tests. It then failed on
every PR that touched one, and was reverted in open-constructs#446.

This branch touches provider-generator and provider-schema, so the tofu job
runs for real on its own PR.

Four things had to change, in two classes.

Unsigned providers OpenTofu rejects:

- versions-file.test.ts pinned kreuzwerker/docker 2.16.0 and provider.test.ts
  pinned 3.0.2. Both move to 3.9.0; signing starts at 3.7.0, not at the 3.x
  major (open-constructs#440).
- provider.test.ts used andsafe-AG/bitbucket, which exists on the Terraform
  registry but not on OpenTofu's. It needs two same-named providers from
  different namespaces, so it moves to zahiar/bitbucket, which is on both.

Fully qualified names leaking the fetching CLI into expectations. The schema
JSON is keyed by FQPN, so the host records which binary fetched it rather
than anything about the code under test:

- provider-schema.test.ts snapshots the raw schema. Its sanitizer already
  stubs format_version, cli_name and cli_version for this exact reason;
  provider_schemas and provider_versions keys now get the same treatment.
  Keys only - a host inside provider documentation text is identical either
  way and stays as authored.
- versions-file.test.ts asserted keys equal to `registry.terraform.io/${fqn}`;
  it now compares the provider part.
- provider.test.ts snapshots a generated directory including versions.json;
  FQPN keys are normalized there too.

Verified against both CLIs rather than assumed: @cdktn/provider-generator
23 suites / 117 tests / 101 snapshots and @cdktn/provider-schema 6 suites /
58 tests / 10 snapshots pass under terraform and under OpenTofu 1.12.6.

The generated docs links that also differed by CLI are fixed by open-constructs#443, which
this is stacked on.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jsteinich added a commit to jsteinich/cdk-terrain that referenced this pull request Sep 23, 2026
Re-lands open-constructs#439 with the fixtures actually fixed. That PR passed vacuously -
its diff touched only pr-unit.yml, so `nx affected` resolved to no
terraform-tagged projects and the tofu job ran zero tests. It then failed on
every PR that touched one, and was reverted in open-constructs#446.

This branch touches provider-generator and provider-schema, so the tofu job
runs for real on its own PR.

Four things had to change, in two classes.

Unsigned providers OpenTofu rejects:

- versions-file.test.ts pinned kreuzwerker/docker 2.16.0 and provider.test.ts
  pinned 3.0.2. Both move to 3.9.0; signing starts at 3.7.0, not at the 3.x
  major (open-constructs#440).
- provider.test.ts used andsafe-AG/bitbucket, which exists on the Terraform
  registry but not on OpenTofu's. It needs two same-named providers from
  different namespaces, so it moves to zahiar/bitbucket, which is on both.

Fully qualified names leaking the fetching CLI into expectations. The schema
JSON is keyed by FQPN, so the host records which binary fetched it rather
than anything about the code under test:

- provider-schema.test.ts snapshots the raw schema. Its sanitizer already
  stubs format_version, cli_name and cli_version for this exact reason;
  provider_schemas and provider_versions keys now get the same treatment.
  Keys only - a host inside provider documentation text is identical either
  way and stays as authored.
- versions-file.test.ts asserted keys equal to `registry.terraform.io/${fqn}`;
  it now compares the provider part.
- provider.test.ts snapshots a generated directory including versions.json;
  FQPN keys are normalized there too.

Verified against both CLIs rather than assumed: @cdktn/provider-generator
23 suites / 117 tests / 101 snapshots and @cdktn/provider-schema 6 suites /
58 tests / 10 snapshots pass under terraform and under OpenTofu 1.12.6.

The generated docs links that also differed by CLI are fixed by open-constructs#443, which
this is stacked on.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jsteinich added a commit to jsteinich/cdk-terrain that referenced this pull request Sep 23, 2026
Re-lands open-constructs#439 with the fixtures actually fixed. That PR passed vacuously -
its diff touched only pr-unit.yml, so `nx affected` resolved to no
terraform-tagged projects and the tofu job ran zero tests. It then failed on
every PR that touched one, and was reverted in open-constructs#446.

This branch touches provider-generator and provider-schema, so the tofu job
runs for real on its own PR.

Four things had to change, in two classes.

Unsigned providers OpenTofu rejects:

- versions-file.test.ts pinned kreuzwerker/docker 2.16.0 and provider.test.ts
  pinned 3.0.2. Both move to 3.9.0; signing starts at 3.7.0, not at the 3.x
  major (open-constructs#440).
- provider.test.ts used andsafe-AG/bitbucket, which exists on the Terraform
  registry but not on OpenTofu's. It needs two same-named providers from
  different namespaces, so it moves to zahiar/bitbucket, which is on both.

Fully qualified names leaking the fetching CLI into expectations. The schema
JSON is keyed by FQPN, so the host records which binary fetched it rather
than anything about the code under test:

- provider-schema.test.ts snapshots the raw schema. Its sanitizer already
  stubs format_version, cli_name and cli_version for this exact reason;
  provider_schemas and provider_versions keys now get the same treatment.
  Keys only - a host inside provider documentation text is identical either
  way and stays as authored.
- versions-file.test.ts asserted keys equal to `registry.terraform.io/${fqn}`;
  it now compares the provider part.
- provider.test.ts snapshots a generated directory including versions.json;
  FQPN keys are normalized there too.

Verified against both CLIs rather than assumed: @cdktn/provider-generator
23 suites / 117 tests / 101 snapshots and @cdktn/provider-schema 6 suites /
58 tests / 10 snapshots pass under terraform and under OpenTofu 1.12.6.

The generated docs links that also differed by CLI are fixed by open-constructs#443, which
this is stacked on.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jsteinich added a commit that referenced this pull request Oct 3, 2026
### Related issue

Re-lands #439, reverted in #446. **Stacked on #443** — merge that first;
this branch contains its commit.

If this is approved before #446, #446 can be dropped. Otherwise this is
the follow-up to it.

### Why #439 failed

Its diff touched only `.github/workflows/pr-unit.yml`. The job it adds
runs `nx affected -t test --exclude='*,!tag:unit-test:terraform'`, so on
a workflow-only change `nx affected` resolved to **no terraform-tagged
projects** and the OpenTofu job ran zero tests. The green check proved
nothing, and it then failed on every PR that touched a tagged project.

**This branch touches `provider-generator` and `provider-schema`, so the
tofu job runs for real on its own PR.** That is the point — a change to
`pr-unit.yml` alone can never demonstrate this.

### What actually had to be fixed

Four fixtures, in two classes. The first was expected; the second was
not, and is the more interesting one.

#### Providers OpenTofu will not install

- `versions-file.test.ts` pinned `kreuzwerker/docker` **2.16.0**,
`provider.test.ts` pinned **3.0.2**. Both rejected as unsigned. Moved to
3.9.0 — signing starts at 3.7.0, **not** at the 3.x major (#440).
- `provider.test.ts` used `andsafe-AG/bitbucket`, which is on the
Terraform registry but **404s on OpenTofu's**. That test needs two
same-named providers from different namespaces, so it moves to
`zahiar/bitbucket`, which is on both.

#### Fully qualified names leaking the fetching CLI into expectations

The schema JSON is keyed by FQPN, so the host records *which binary
fetched it*, not anything about the code under test. Three places baked
Terraform's in:

| file | was | now |
| --- | --- | --- |
| `provider-schema.test.ts` | snapshots raw schema incl. FQPN keys |
keys stubbed in the existing sanitizer |
| `versions-file.test.ts` | asserted `registry.terraform.io/${fqn}` |
compares the provider part |
| `provider.test.ts` | directory snapshot incl. `versions.json` | FQPN
keys normalized |

For `provider-schema.test.ts` this extends a pattern already there: its
`sanitizeJson` stubs `format_version`, `cli_name` and `cli_version` for
exactly this reason — `cli_name` is already stubbed because it stamps
the fetching binary, and the FQPN host is the same signal through a
different field.

**Keys only.** A registry URL appearing inside provider *documentation
text* is identical under either CLI and stays as authored.

Normalizing happens in the tests, not the product: the FQPN host is
meaningful at runtime — #443 and #445 depend on it — so stripping it in
the product would destroy information.

### Verified against both CLIs

Not assumed, and not inferred from a green matrix job:

| package | terraform | OpenTofu 1.12.6 |
| --- | --- | --- |
| `@cdktn/provider-generator` | 23 suites / 117 tests / 101 snapshots |
same, all pass |
| `@cdktn/provider-schema` | 6 suites / 58 tests / 10 snapshots | same,
all pass |

The generated documentation links that also differed by CLI are fixed by
#443, which this is stacked on — without it, `provider.test.ts` still
diverges.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants