docs: CLAUDE.md — correct the workspace test invocations - #314
Conversation
`cargo test --workspace` no longer fails to compile; it passes, 296 tests over 10 binaries. The documented failure moved rather than disappeared: `cargo test -p pg-core` alone still hits `unresolved import crate::test`, and what rescues the workspace build is cryptify's dev-dependency asking for pg-core with the `test` feature, which unification then applies to every member. That has only held since cryptify joined on 2026-07-31, and it reverts if that dev-dep line changes. Adds the invocation that does fail and was undocumented: `cargo test --workspace --all-features` cannot compile on any host, because it enables pg-core's wasm32-only `web` feature. Per-crate `--all-features` is unaffected and stays correct.
|
Thanks for the detailed follow-up on the |
There was a problem hiding this comment.
The correction is right and the reasoning behind it holds up. I re-measured every claim on this branch (5a7c4dc) rather than reading the prose: cargo test --workspace passes with 296 tests and exit 0; cargo test -p pg-core fails on unresolved import crate::test; the compile_error! sits at pg-core/src/client/web/mod.rs:19; and it really is cryptify's dev-dependency that carries the test feature, not its regular dependency. I also tested the load-bearing causal claim by temporarily dropping test from that dev-dep, and the workspace reverted to E0432 unresolved import crate::test, so feature unification is doing exactly the work the text says it does. Restored afterwards, clean tree.
One sentence in the new text is wrong, and it happens to reintroduce the trap the surrounding paragraph exists to close, so it is worth one more push. Details inline, with the suggested replacement wording.
Rule check: I ran the docs-relevant rules from the memory repo (writing-rules, no-runlog-in-process-rules, no-justification-paragraphs-for-simple-changes, claim-narrowed-in-code-survives-in-the-pr-body, removing-a-mechanism-leaves-docs-outside-the-diff, single-repo-lessons-belong-in-that-repos-claude-md, conventional-commit-pr-titles) and none of them added a finding beyond the one below. Worth recording what they cleared rather than leaving it implicit: the lesson is postguard-specific and lands in postguard's own CLAUDE.md, which is where single-repo lessons belong; cargo test --workspace appears in no other file in the repo, so the corrected claim leaves no stale second copy behind; the verified 2026-08-09 stamp is not run-log bloat here, because the text itself says the passing state can revert, which makes the date load-bearing; and the title passes the Conventional Commit check. All checks are green.
The one prose rule that did fire, em-dash density, I am dropping deliberately: the added text runs 6 em dashes across the bullet where CLAUDE.md already averages about 7 per 1000 words across all 4953 of them. That is this file's established register, not a regression introduced here.
| ## Workspace & CI | ||
|
|
||
| - Workspace members: `pg-core` (lib), `pg-ffi` (C ABI), `pg-pkg` (PKG service), `pg-cli`, `cryptify` (file-transfer service, merged in 2026-07-31). `pg-wasm` is a sibling crate the root `Cargo.toml` lists under `exclude`, so it is not part of the workspace and is built separately with wasm-pack (see Release & configuration). Sub-crates share workspace files. Build the workspace from repo root with `cargo build`. A bare `cargo test --workspace` FAILS to compile: `pg-core`'s tests are gated behind its `test` feature (also `rust`/`stream`), so the item is configured out and imports like `crate::test::TestSetup` don't resolve. CI (`.github/workflows/build.yml`) runs tests per crate: `cargo test --manifest-path pg-core/Cargo.toml --features test,rust,stream` for core, `--all-targets` for `cryptify` (it declares no features of its own, so that is the equivalent invocation), `--all-features` for `pkg`/`cli`/`ffi`. None of these cover `pg-wasm`. The `test`/`format`/`clippy` matrices key on the crate **directory** rather than a `pg-` suffix, because `cryptify` doesn't carry that prefix — so the check contexts are `Test workspace (pg-core)`, not `Test workspace (core)`. Nothing required points at them today, but whatever adds to the required list later must use the current names. Where that list lives is not obvious and an agent cannot read it: required checks come from **classic branch protection** (`gh api repos/encryption4all/postguard/branches/main/protection`, currently exactly `Wire compat`), *not* from the `main` ruleset, which carries only `deletion`/`non_fast_forward`/`pull_request` and no `required_status_checks` rule at all. `dobby-coder` gets 403 on the protection endpoint, so reading the ruleset alone concludes nothing is required, which is wrong — ask a maintainer rather than inferring. `pg-core` uses CGWKV + MKEM for multi-recipient encryption (production feature set `["cgwkv", "mkem"]`). [#262](https://github.com/encryption4all/postguard/issues/262) (merged `0343369`, #295) replaced the two per-language `Wire compat (published pg-core)` / `Wire compat (published pg-wasm/pg-js)` required checks with this single `wire-compat` job (`needs: [wire-compat-rust, wire-compat-js]`, `permissions: contents: read`); the two old names are no longer required and the underlying per-language jobs still exist and still run, just aren't required individually anymore. | ||
| - Workspace members: `pg-core` (lib), `pg-ffi` (C ABI), `pg-pkg` (PKG service), `pg-cli`, `cryptify` (file-transfer service, merged in 2026-07-31). `pg-wasm` is a sibling crate the root `Cargo.toml` lists under `exclude`, so it is not part of the workspace and is built separately with wasm-pack (see Release & configuration). Sub-crates share workspace files. Build the workspace from repo root with `cargo build`. Two test invocations are worth knowing, and the obvious reading of each is wrong. **`cargo test --workspace` passes** — 296 tests over 10 binaries, verified 2026-08-09 — but only by accident, so don't read it as the workspace being self-consistent. `pg-core`'s tests really are gated behind its `test` feature (also `rust`/`stream`), and `cargo test -p pg-core` alone still fails exactly as it always did, with `unresolved import crate::test` on `crate::test::TestSetup`. What rescues the workspace build is feature unification: `cryptify`'s dev-dependency asks for `pg-core` with `features = ["rust", "stream", "test"]` (`cryptify/Cargo.toml`), so the feature is on for every member — confirm with `cargo tree -e features -p pg-core --workspace`. That has only been true since `cryptify` joined the workspace on 2026-07-31; it is a side effect of one member's dev-deps rather than a property of the workspace, and it reverts to the old compile failure the moment that line changes. **`cargo test --workspace --all-features` does not compile at all**, on any host: it switches on `pg-core`'s `web`, whose `compile_error!` fires off wasm32 — `error: "web" feature should only be enabled on wasm32 targets`, `pg-core/src/client/web/mod.rs:19`. `--all-features` is correct *per crate* (it is what the CI matrices use for `pkg`/`cli`/`ffi`, and what the api_gate suite further down is run with) and wrong workspace-wide. CI (`.github/workflows/build.yml`) runs tests per crate: `cargo test --manifest-path pg-core/Cargo.toml --features test,rust,stream` for core, `--all-targets` for `cryptify` (it declares no features of its own, so that is the equivalent invocation), `--all-features` for `pkg`/`cli`/`ffi`. None of these cover `pg-wasm`. The `test`/`format`/`clippy` matrices key on the crate **directory** rather than a `pg-` suffix, because `cryptify` doesn't carry that prefix — so the check contexts are `Test workspace (pg-core)`, not `Test workspace (core)`. Nothing required points at them today, but whatever adds to the required list later must use the current names. Where that list lives is not obvious and an agent cannot read it: required checks come from **classic branch protection** (`gh api repos/encryption4all/postguard/branches/main/protection`, currently exactly `Wire compat`), *not* from the `main` ruleset, which carries only `deletion`/`non_fast_forward`/`pull_request` and no `required_status_checks` rule at all. `dobby-coder` gets 403 on the protection endpoint, so reading the ruleset alone concludes nothing is required, which is wrong — ask a maintainer rather than inferring. `pg-core` uses CGWKV + MKEM for multi-recipient encryption (production feature set `["cgwkv", "mkem"]`). [#262](https://github.com/encryption4all/postguard/issues/262) (merged `0343369`, #295) replaced the two per-language `Wire compat (published pg-core)` / `Wire compat (published pg-wasm/pg-js)` required checks with this single `wire-compat` job (`needs: [wire-compat-rust, wire-compat-js]`, `permissions: contents: read`); the two old names are no longer required and the underlying per-language jobs still exist and still run, just aren't required individually anymore. |
There was a problem hiding this comment.
Two notes on this line, one substantive.
The --all-features framing is wrong, and it reopens the trap. The text says:
--all-featuresis correct per crate (it is what the CI matrices use forpkg/cli/ffi, and what the api_gate suite further down is run with) and wrong workspace-wide.
Per-crate is not the distinguishing axis. I ran it:
cargo test -p pg-core --all-features --no-run
# error: "web" feature should only be enabled on wasm32 targets
# --> pg-core/src/client/web/mod.rs:19
# error: could not compile `pg-core` (lib) due to 1 previous error
--manifest-path pg-core/Cargo.toml --all-features fails the same way. The axis is whether pg-core is in the selected set, not whether the invocation is scoped to one crate. The three named exceptions are safe only incidentally: pkg, cli and ffi declare no [features] section at all, so --all-features is a no-op for them, and the api_gate suite lives in pg-pkg/tests/api_gate.rs, which is one of those three. As written, an agent trusting this sentence will reach for cargo test -p pg-core --all-features and hit the exact compile_error! the previous sentence just warned about.
Suggested replacement for that clause:
--all-featuresis correct for the crates that declare no features of their own (pkg/cli/ffiin the CI matrices, and the api_gate suite further down, which lives inpg-pkg) and wrong anywherepg-coreis in the selected set —cargo test -p pg-core --all-featuresfails identically, so this is not merely a workspace-wide problem.
The same claim is in the PR description ("Both are per-crate and remain correct; only workspace-wide is broken"), so that paragraph needs the same narrowing. A body edit is a PATCH on the PR, no branch push and no CI rerun.
Nit: 296 tests over 10 binaries. The 296 is exact, I summed the test result: lines and got 296 passed, 0 ignored. The count is 9 test binaries plus one doc-test target, though: cargo test --workspace --no-run prints exactly 9 Executable lines. A reader following that repro counts 9 and wonders what they missed. 296 tests over 10 targets (9 binaries + doc-tests) matches what the output actually shows.
I have deliberately not attached suggestion blocks. This bullet is one 493-word line, so a one-click suggestion would have to restate the whole paragraph, and a silent transcription slip in 493 words of backticks and quotes is a worse outcome than two find-and-replace edits.
|
Thanks for the deep dive — really appreciated the receipts. I reviewed #314 and requested changes: the fix itself is solid (re-verified PR: #314 |
Per-crate was the wrong axis: `cargo test -p pg-core --all-features` hits the same wasm32 `compile_error!`, so scoping does not make it safe. What makes pkg/cli/ffi safe is that they declare no `[features]` at all, which makes `--all-features` a no-op there — pg-core is the only member with a `[features]` section, so it is the only one that can break. Also 9 test binaries plus pg-core's doc-tests, not 10 binaries.
|
Both fixed in The
The count. 9 Noting your dropped em-dash finding as correctly dropped: the file's register is what it is, and this bullet should not be the one place that deviates. Also worth recording that you re-derived the causal claim by pulling |
Follow-up to the review on #313, which flagged in passing that
cargo test --workspace --all-featurescannot compile. Checking it turned up a contradiction: that review also said plaincargo test --workspace"passes clean", whileCLAUDE.mdsays it "FAILS to compile". Both halves measured onmain(c1682ba) today.CLAUDE.mdbefore this PRcargo test --workspacecargo test -p pg-coreunresolved import crate::testcargo test --workspace --all-featureswebis wasm32-onlycargo test -p pg-core --all-featuresThe documented failure did not disappear, it moved.
pg-core's tests are still gated behind itstestfeature, andcargo test -p pg-corestill fails oncrate::test::TestSetupexactly as described. What rescues the workspace build is feature unification:cryptify/Cargo.tomldev-depends onpg-corewithfeatures = ["rust", "stream", "test"], so the feature is on for every member —cargo tree -e features -p pg-core --workspaceshowspg-core feature "test". That has only been true sincecryptifyjoined the workspace on 2026-07-31, which is why the old note was accurate when written. It is one member's dev-dep, not a workspace property, so it reverts if that line changes — worth saying rather than just flipping "fails" to "passes".The
--all-featureshalf is new information and the sharper trap, sinceCLAUDE.mdalready recommends--all-featuresin two places (the CI matrices forpkg/cli/ffi, and the api_gate suite). The distinguishing axis is not per-crate versus workspace-wide, as an earlier draft of this PR claimed:cargo test -p pg-core --all-featuresfails the same way, so scoping does not make it safe. What makes those two recommendations safe is thatpkg,cliandffideclare no[features]section at all, so--all-featuresis a no-op for them, and the api_gate suite lives inpg-pkg.pg-coreis the only workspace member with a[features]section, so it is the only one--all-featurescan break — via itscompile_error!atpg-core/src/client/web/mod.rs:19.Reproduce: