Fix expand tests and harden the scheduled workflows - #87
Merged
Conversation
madonoharu
marked this pull request as draft
August 11, 2026 21:13
The expandtest has been failing (3 of 4 tests) both locally and in CI because `--features tsify/json` only enables tsify's features in the temporary project macrotest generates, while that project's own optional `serde` / `wasm-bindgen` dependencies stay disabled (macrotest's feature translation drops non-`dep:` feature references). The code emitted by `#[derive(Tsify)]` then fails to resolve `serde` / `wasm_bindgen` (E0463 / E0433). Older rustc tolerated unresolved macros during `-Zunpretty=expanded` and printed partially-expanded output; current rustc makes this a hard error, which is why CI has been red with no repo change. - Pass `json,wasm-bindgen` so the test project's own features (and thus `dep:serde` / `dep:wasm-bindgen`) are enabled - Regenerate expected outputs with `MACROTEST=overwrite`; wasm-bindgen attribute macros are now fully expanded instead of being left unexpanded as in the previous partially-expanded form. Since Cargo.lock is gitignored and CI resolves dependencies fresh, the outputs are generated against the current latest wasm-bindgen (0.2.127) to match what CI expands. Verified with wasm-bindgen 0.2.127: ./test.sh (cargo test --all, -F js, wasm-pack test --node x2, e2e build + compare), cargo fmt --all -- --check, and cargo clippy -- -D warnings all pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
madonoharu
force-pushed
the
fix/expandtest-features
branch
from
August 11, 2026 22:06
e9f8514 to
7f87e15
Compare
Collaborator
|
Thanks for noticing this. The github cronjob was supposed to fix this issue once and for all but I guess it didn't... Would you be able to update the cron job so that it correctly makes PRs whenever the expand tests start failing? |
The nightly expand-check cron has never produced an update PR since its
introduction (109 green runs during which 13 wasm-bindgen releases went
undetected because the committed snapshots had degraded to a partially
expanded form, then 75 consecutive failures that notified no one).
- check-wasmbindgen-changes.yml:
- add explicit token permissions (contents/pull-requests/issues);
without them PR/issue creation can fail silently depending on
repository settings
- log the freshly resolved wasm-bindgen version and rustc version to
the step summary, and use the version in the update PR title
- open a tracking issue (once per breakage) when the job fails,
instead of failing silently in the Actions tab
- assign and label the auto-created update PR; tolerate an existing PR
- latest-deps.yml (new): weekly + manual full ./test.sh against the
newest compatible dependency resolution, without snapshot overwrite —
the configuration downstream users actually get; previously this was
never exercised anywhere
- CONTRIBUTING.md (new): document the snapshot regeneration procedure
(fresh lockfile first — the stale-lockfile trap behind PR #87's first
CI failure) and the deliberate no-committed-lockfile policy
- .gitignore: turn the Cargo.lock entry into an explicit, documented
decision
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- tsify-macros: add unit tests for the TS declaration emitted by `#[tsify::declare]`. The fully-expanded snapshots can no longer see it: `#[wasm_bindgen(typescript_custom_section)]` expands to nothing on non-wasm targets, which had silently reduced type_alias.expanded.rs to an empty proof (a sentinel mutation in the macro passed the test). [found independently by 3 of 4 reviewers] - check-wasmbindgen-changes.yml: replace the `gh pr create || echo` catch-all with an explicit existing-PR check; create the PR bare and apply assignee/label afterwards so decoration failures cannot suppress it. The old pattern reported "PR already exists" for *any* failure (403, missing label, ...) and turned the job green. [consensus P1] - both workflows: auto-close the failure tracking issue on the next successful run — an issue left open would mute all future alerts, recreating the very silence this PR is meant to fix. - latest-deps.yml: exclude the expandtest snapshot comparison from the pass/fail signal (`--skip expandtest` + an informational step). Routine wasm-bindgen codegen drift belongs to the nightly cron; without this, every release would abort ./test.sh at the first command and file a false "compatibility break" issue. - CONTRIBUTING.md: state the lockfile policy factually (the previous wording implied a documented maintainer decision that does not exist in-repo). Verified: cargo test --all (incl. new unit tests and expandtest), fmt, clippy -D warnings, YAML syntax, and --skip expandtest filtering. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Applied the merged recommendations of three independent refactoring passes (two Opus reviewers and Codex): - workflows: hoist the tracking-issue title into a job-level env var (single source of truth — a title mismatch between the notify and close steps would permanently mute alerts), flatten "Check for changes" into guard clauses, tighten comments - CONTRIBUTING.md / .gitignore: tighter, more natural wording; same facts and warnings - type_alias.test.rs: assert_contains! macro in the style of ts_type.test.rs; more precise header comment - expandtest.rs: move the rationale comment to a //! doc comment No behavioral change except one deliberate addition: the cron now logs "nothing to do" when snapshots are unchanged (previously silent). All four review-hardening guarantees re-verified: pr-create failure propagation, decoration isolated from PR creation, issue dedup + auto-close, expandtest excluded from latest-deps pass/fail. Verified: YAML syntax, bash -n on all run blocks, cargo test --all, fmt --check, clippy -D warnings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
madonoharu
marked this pull request as ready for review
August 12, 2026 00:30
`cargo pkgid wasm-bindgen` is the purpose-built way to read the resolved version: no dependence on the lockfile's TOML layout, no external commands (bash parameter expansion strips the `name@` prefix), and it errors out loudly if multiple versions were ever resolved instead of silently picking the first match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The two scheduled workflows duplicated their entire environment setup (Node, toolchain, wasm-pack, cargo-expand, fresh dependency resolution + version logging) and the tracking-issue plumbing (dedup search, open on failure, close on success). Extract both into local composite actions: - .github/actions/setup-test-env: setup + fresh lockfile, exposing the resolved wasm-bindgen version as an output - .github/actions/track-failure-issue: mode: notify | close, with the issue title passed in from the caller so both modes keep searching for the same string Workflow-specific content (issue bodies, job comments, ISSUE_TITLE) stays in the workflows. As a side effect, issue bodies moved from inline shell strings to `with:` block scalars, which removes the leading indentation that previously leaked into the rendered issues. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The new action docs drifted from phrasing the earlier editing pass had settled on: "what downstream users actually get" (not "the configuration ..."), "resolves fresh" (not "pins ... to the latest" — pinning means the opposite), and the mute-warning phrased as "one left open would mute every later breakage" to match the workflow comments. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Discussed with an independent model which generic-shell constructs still have purpose-built equivalents, verified each locally: - `gh label create --force` replaces `2>/dev/null || true` — updates an existing label instead of erroring, and a real failure now surfaces as a workflow warning instead of vanishing - exact-title match for the tracking-issue lookup: GitHub's `in:title` search matches substrings, so filter with `--jq 'map(select(.title == env.ISSUE_TITLE))'` (gh's gojq exposes the environment) — a title that is a substring of another issue's can no longer mute alerts - install the toolchain with rustup directly: the archived actions-rs/toolchain action (node12) only wrapped the same rustup call the runner already ships - fold the two step-summary writes into one `tee` Considered and rejected with evidence: `gh pr view <branch>` for the existing-PR check (returns closed/merged PRs when no open one exists), and replacing the pinned wasm-pack action (its `latest` still resolves to 0.9.1, and `cargo install` trades a seconds-fast binary download for a minutes-long source build). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 17, 2026
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.
Fixes the expand tests (3 of 4 failing in CI since June) and hardens the scheduled workflows so this class of breakage can't go unnoticed again.
Root cause
macrotest translates tsify's
[features]table into its temporary test project but drops feature references that don't start withdep:.--features tsify/jsontherefore never enabled the temp project's ownserde/wasm-bindgenoptional deps, so the code emitted by#[derive(Tsify)]couldn't resolve those crates (E0463/E0433). Older rustc tolerated unresolved macros during expansion and printed partially-expanded output — that's what the old snapshots recorded. Current rustc makes this a hard error. Nothing in this repo changed; the toolchain did.Changes
--features json,wasm-bindgen(the test project's own features) and regenerate the snapshots. They are now fully expanded, which also restores the diff sensitivity the nightly cron relies on — the old partially-expanded snapshots never changed across 13 wasm-bindgen releases, which is why the cron never opened an update PR.Cargo.lockis gitignored; CI resolves fresh), currently 0.2.127. Future codegen changes will be picked up by the cron as designed.#[tsify::declare]unit tests: with full expansion,type_alias.expanded.rsno longer captures the emitted TS declaration (typescript_custom_sectionexpands to nothing on non-wasm targets), so tsify-macros now asserts it directly.check-wasmbindgen-changes.yml: explicit token permissions, resolved wasm-bindgen version in the logs and PR title, a tracking issue on failure (exact-title deduped, auto-closed on recovery), assignee/label on auto-PRs, and PR-creation failures now propagate instead of being swallowed.latest-deps.yml(new): weekly full test run against fresh dependency resolution, with the snapshot comparison excluded from pass/fail — routine codegen drift belongs to the nightly cron..github/actions/): both scheduled workflows use the same environment setup and tracking-issue plumbing. Setup now callsrustupdirectly instead of the archivedactions-rs/toolchain.CONTRIBUTING.md(new): test setup, snapshot regeneration (fresh lockfile first), and the lockfile policy.Note
The cron's PR-creation path has never fired in production; worth a manual
workflow_dispatchrun after this merges to prove it end-to-end.🤖 Generated with Claude Code