Skip to content

fix(templates): drop the stale icon field from the render test fixture — main's cargo test has been red since 72ca33a - #7

Merged
nusendra merged 2 commits into
mainfrom
fix/stale-icon-in-render-tests
Oct 29, 2026
Merged

nusendra merged 2 commits into
mainfrom
fix/stale-icon-in-render-tests

Conversation

@nusendra

@nusendra nusendra commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

main's test suite has not compiled since 72ca33a. cargo test --workspace
exits 101:

error[E0560]: struct `schema::Template` has no field named `icon`
  --> crates/ployer-templates/src/render_tests.rs:17:9

What broke

Two PRs that were each green, merged twelve seconds apart off the same base:

Neither was ever compiled against the other. The fix is the one line #4 missed.

Why no gate caught it

Worth stating precisely, because the obvious explanation is wrong.

CI does test the merge result, not the branch tip — on a pull_request
event actions/checkout@v4 checks out refs/pull/N/merge. From this PR's own
job log:

HEAD is now at 8f29f11 Merge 852355e... into f314846...

Three things lined up instead:

  1. There was no test gate yet. .github/workflows/ci.yml did not exist when
    feat(templates): add {{ app.slug }} placeholder for container hostnames #3 and chore(templates): drop the dead icon field from the catalog contract #4 merged; it arrived eleven minutes later in chore(lint)!: make cargo clippy -- -D warnings pass, document build prerequisites, pin the gate in CI #6. Nothing ran on
    either PR.
  2. The merge ref is a snapshot. It is recomputed when a PR changes, not when
    main moves underneath it. Merging feat(templates): add {{ app.slug }} placeholder for container hostnames #3 did not re-run chore(templates): drop the dead icon field from the catalog contract #4.
  3. main has no branch protection. GET /branches/main/protection returns
    404, "Branch not protected" — no required status check, and no Require
    branches to be up to date before merging
    , which is the one setting that
    would have forced chore(templates): drop the dead icon field from the catalog contract #4 to re-run against the new base.

And the signal that did exist was not read: the first run ci.yml ever did on
main (push f314846) failed both jobs on this exact error. main has
been red for eighteen hours.

Enabling branch protection with both jobs required and "up to date" checked is
the actual fix for the class. That is a repo setting, so it is left to you
rather than done here.

Also in this PR: a guard for the hazard next door

icon is gone from the Rust schema, but ployer and ployer-website deploy
independently and the published registry still ships the key — verified
live today:

$ curl -s https://ployer.nusendra.com/templates/index.json | grep -c '"icon"'
4                                     # jellyfin, mariadb, mongodb, postgresql
$ curl -s https://ployer.nusendra.com/templates/postgresql.yaml | grep icon
icon: postgresql.svg

So the parser has to keep ignoring it. Adding #[serde(deny_unknown_fields)]
to either struct would read as tightening and would in fact fail every
install on a field nobody uses. Two tests in a new
crates/ployer-templates/src/schema_tests.rs hold that door open.

They have teeth — with deny_unknown_fields added to both structs they fail:

unknown field `icon`, expected one of `slug`, `name`, `description`, ...

and pass without it.

Verification

Local, SQLX_OFFLINE=true:

Command Result
cargo test --workspace 143 passed, 0 failed, exit 0
cargo clippy --workspace --all-targets -- -D warnings exit 0

CI green on the merge result. The exit code 1 annotation on the clippy job is
the advisory cargo fmt --check step (continue-on-error), which
DOCUMENTATION.md already flags as reported green regardless of outcome.

DOCUMENTATION.md gets the findings above, replacing the earlier draft note on
this branch that said CI runs on the PR head — it does not, and the real
mechanism is more useful to know.

`cargo test --workspace` has been red on `main` since 72ca33a. One error:

    error[E0560]: struct `schema::Template` has no field named `icon`
      --> crates/ployer-templates/src/render_tests.rs:17:9

ac178ed removed `icon` from `schema::Template`. It did not remove the one
remaining construction site because that site did not exist on its branch:
`render_tests.rs` arrived in b2bbfbf (PR #3), which merged first. Neither
PR saw the other.

Two things let it through, and both are now written down in DOCUMENTATION.md:

1. ac178ed verified with `cargo check --workspace`, which does not build
   `#[cfg(test)]` code. The field removal was invisible to it. `cargo test`
   and `cargo clippy --all-targets` both catch it.
2. CI runs on the PR head, not on the PR merged into `main`, and branches
   are not required to be up to date. PR #3 and PR #4 were each green and
   broke `main` together.

The fix is the one-line deletion. No behaviour change: `icon` was never read.

Also confirms the premise of the report that prompted this change is stale.
`ployer-db`'s 72 `from_str` errors were real, but 0f1f6fc already fixed them
by renaming the call sites alongside the `ployer-core` constructors; they
only reproduce on a checkout behind `origin/main`. Both `ployer-db` and
`ployer-api` compile here.

Verified on f314846 + this change, SQLX_OFFLINE=true:
  cargo test --workspace                                -> 141 passed, 0 failed
    (ployer-api 53, ployer-core 26, ployer-db 24, ployer-proxy 28,
     ployer-docker 6, ployer-templates 4)
  cargo clippy --workspace --all-targets -- -D warnings -> clean (stable)
  cargo +1.99.1 clippy --workspace --all-targets -- -D warnings -> clean
…he CI note

`ac178ed` dropped `icon` from `Template` and `IndexEntry`, but `ployer` and
`ployer-website` deploy independently and the published registry still ships
the key: all four entries in the live `index.json` carry `"icon"`, and
`postgresql.yaml` carries `icon: postgresql.svg` (verified against
https://ployer.nusendra.com/templates today). The parser therefore has to keep
ignoring it. Adding `#[serde(deny_unknown_fields)]` to either struct would look
like tightening and would in fact fail every install on a field nobody reads.

Two tests now hold that open. Confirmed to have teeth: with
`deny_unknown_fields` added to both structs they fail with

  unknown field `icon`, expected one of `slug`, `name`, ...

and pass without it.

Also corrects the CI paragraph this branch added. It claimed CI runs on the PR
head; it does not. `actions/checkout@v4` checks out `refs/pull/N/merge`, as the
job log for this very PR shows ("HEAD is now at a679483 Merge a3d9fea into
f314846"). The real mechanism was staleness plus an absent gate: `ci.yml` did
not exist when #3 and #4 merged twelve seconds apart off the same base, and
`main` has no branch protection at all, so nothing required a re-run against
the moved base. The replacement paragraph documents that instead.
@nusendra
nusendra merged commit c652aea into main Oct 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant