Repository navigation
fix(templates): drop the stale icon field from the render test fixture — main's cargo test has been red since 72ca33a - #7
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
main's test suite has not compiled since72ca33a.cargo test --workspaceexits 101:
What broke
Two PRs that were each green, merged twelve seconds apart off the same base:
0c80422) addedrender_tests.rs, whose fixture setsicon: None.iconfield from the catalog contract #4 (ac178ed) removedpub iconfromTemplateandIndexEntry.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_requestevent
actions/checkout@v4checks outrefs/pull/N/merge. From this PR's ownjob log:
Three things lined up instead:
.github/workflows/ci.ymldid not exist whenfeat(templates): add {{ app.slug }} placeholder for container hostnames #3 and chore(templates): drop the dead
iconfield from the catalog contract #4 merged; it arrived eleven minutes later in chore(lint)!: makecargo clippy -- -D warningspass, document build prerequisites, pin the gate in CI #6. Nothing ran oneither PR.
mainmoves underneath it. Merging feat(templates): add {{ app.slug }} placeholder for container hostnames #3 did not re-run chore(templates): drop the deadiconfield from the catalog contract #4.mainhas no branch protection.GET /branches/main/protectionreturns404, "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
iconfield 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.ymlever did onmain(pushf314846) failed both jobs on this exact error.mainhasbeen 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
iconis gone from the Rust schema, butployerandployer-websitedeployindependently and the published registry still ships the key — verified
live today:
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.rshold that door open.They have teeth — with
deny_unknown_fieldsadded to both structs they fail:and pass without it.
Verification
Local,
SQLX_OFFLINE=true:cargo test --workspacecargo clippy --workspace --all-targets -- -D warningsCI green on the merge result. The
exit code 1annotation on the clippy job isthe advisory
cargo fmt --checkstep (continue-on-error), whichDOCUMENTATION.md already flags as reported green regardless of outcome.
DOCUMENTATION.mdgets the findings above, replacing the earlier draft note onthis branch that said CI runs on the PR head — it does not, and the real
mechanism is more useful to know.