~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Rust 1.100, and the paths its coverage finds untaken

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:ci/rust-1.100

What changes

CI and the image build on Rust 1.100, up from 1.98. check, test and e2e run on rust:1.100, each with RUSTUP_TOOLCHAIN: "1.100.0". Without that, the cached /usr/local/rustup keeps the default of the first image that filled it, and runs would still build with 1.98. The image's Rust stage is rust:1.100-bookworm (docs/deploying.md). Before measuring coverage, test deletes target/llvm-cov-target/debug/deps: Cargo 1.100 builds test binaries under debug/build/, so the ones the cache kept in debug/deps are stale.

The coverage gate stays at 100%. On Linux, Rust 1.100's coverage counts paths 1.98 didn't: 58 lines and 1 function. Every test passed. Each kind is fixed at its cause:

  • Log fields counted twice. axum's default tower-log turns on tracing's log feature, which writes each event's fields a second time, for the log crate. 1.100 counted that never-taken copy, so fields of events that were logged (tests/serve.rs reads "serving" back) showed as never run. axum is now its defaults minus tower-log; nothing here reads the log crate.
  • In-process test hosts had no subscriber, so their events' fields were never evaluated. tests/common now installs one, writing every group_host event into nothing.
  • A ? alone on a line, after a call no test makes fail. The value is bound first, as AGENTS.md already says (api.rs, logs.rs, mcp.rs, migration.rs, sites.rs, store.rs, token_writes.rs).
  • The closing } of an if with no else now counts as the path where it doesn't hold. Tests take each such path:
    • a viewer, an account being moved, or a group's session with no handle or DID document;
    • a group with no displayName, or no profile;
    • an MCP request with no state, and an https redirect URI;
    • overlapping scopes;
    • a blob still referenced elsewhere when a record or a space goes;
    • switching accounts in a browser signed out of one;
    • an account import with no address;
    • an inbox invite's subject in a group's activity;
    • a union member that isn't an object.
  • Two branches that can't happen are gone. A group always has an address (group_handle.rs and sites.rs already expect one), and a group's view and its profile's view are always objects, so merge goes.

AGENTS.md says what 1.100's coverage counts: the } of an if with no else, counted on CI's Linux toolchain and not on the Mac's; and a function built more than once, counted by the most lines a single build of it runs.

Why

To keep up with stable, so that CI checks what just runs locally (stable, 1.100), without lowering the gate.

How it was checked

  • CI on e3e9318: every check passes, and test reports 100% of lines and functions.
  • Reproduced in Linux rust:1.100 containers (the Mac toolchain doesn't show these):
    • the tower-log double count, the } of an if with no else, and the ? alone on a line, each in a small crate;
    • the two misses the report gives no line for, by cargo llvm-cov report --json over the suite.

Shortcomings

The image's build on 1.100 is first tried by deploy, after merge. One step in opensocial/tests/commands.rs changed. It used to check that importing an account with no address is refused when its own name is taken here. It now imports with no address first, then again under another address. The refusal itself is still tested in tests/import.rs, and the command's "can't move here" message by another step of the same test.

Approved

This moves check, test and e2e and the Dockerfile's Rust stage from 1.98 to 1.100. It sets RUSTUP_TOOLCHAIN in each workflow and clears the stale llvm-cov-target/debug/deps before coverage. docs/deploying.md is updated to match.

I read all five changed files and found nothing to change. The image tag, the pinned toolchain and the docs line agree with each other. The rm -rf is harmless when the directory is missing. The env blocks sit correctly in check.yml and test.yml, and e2e.yml extends its existing one. web, lexicons and docs were skipped or queued at review time, and check, test and e2e were still queued. I haven't seen the toolchain line in a log or the coverage gate pass. Please confirm both when those runs finish. Per the body, the image build is first tried by deploy after merge.

Approved

Since my approval, the pull's own change is in test.yml. The unconditional rm -rf target/llvm-cov-target/debug/deps is gone. In its place, the step records rustc -vV in target/llvm-cov-target/rustc and wipes the whole coverage target when that differs. That is sturdier than the one-off delete, because it also covers the next toolchain bump. I checked the shell. A missing stamp file counts as a mismatch, so the first run clears and rebuilds. mkdir -p then recreates the directory before the stamp is written. The stamp file sits beside the build output and shouldn't affect cargo-llvm-cov. The rest of the range is the base's changes, so I didn't review it as part of this pull. check, test, e2e and docs were still queued when I looked, and web and lexicons were skipped. I still haven't seen the 1.100 toolchain line in a log or the coverage gate pass on a cold or stale cache. Please confirm both when test finishes.

Approved

The pull still moves check, test, e2e and the Dockerfile's Rust stage to 1.100. It pins RUSTUP_TOOLCHAIN in each workflow, and docs/deploying.md agrees. I read the pull's own diff (five files).

Since my approval, test.yml went back from the stamp-file check (rustc -vV compared, then a wipe of the coverage target) to a plain rm -rf target/llvm-cov-target/debug/deps. That matches the body now, and it is harmless when the directory is missing. It handles this bump only. A later toolchain change would need the same manual delete again. That's a trade-off, not a bug, so I'm not asking for changes.

docs passed, and web and lexicons were skipped. check, test and e2e were still running when I looked. I haven't seen the 1.100 toolchain line in a log or the 100% coverage gate pass on the stale cache. Please confirm both when test finishes. Per the body, the image build is first tried by deploy after merge.

Approved

My approval at 337dd6e still stands for the toolchain change. That covers the 1.100 image, RUSTUP_TOOLCHAIN in each workflow, the rm -rf of debug/deps, the Dockerfile and docs/deploying.md.

Since then the pull has gained changes its title and body don't describe. I checked them and found nothing wrong.

  • axum features: Cargo.toml now lists axum's default features without tower-log. I compared the list with axum 0.8's defaults and it matches, plus ws. Cargo.lock drops only tracing from tower and log from tracing, as expected.
  • Error-propagation refactors: the ? calls in api.rs, logs.rs, mcp.rs, migration.rs, sites.rs, store.rs and token_writes.rs are split into a separate statement. The behaviour is the same. The aim is to keep coverage from counting error-path regions as unrun.
  • Test logging: tests/common/mod.rs installs a sink tracing subscriber once. tracing and tracing-subscriber are already dependencies of the crate.

Please add a line to the body about these, since a reader of "CI and the image build on Rust 1.100" wouldn't expect them. That is not a blocker.

At this commit check passed, and docs, web and lexicons passed or were skipped. test and e2e were still running when I looked. I haven't seen the 100% coverage gate pass. Please confirm it when test finishes, because it's the check most likely to be affected by these changes. Per the body, the image build is first tried by deploy after merge.

Approved

The pull still approves at cf4a92c. All checks pass at this head: check, test (the coverage gate), e2e and docs. web and lexicons were skipped. That answers my earlier request to confirm the gate. The body now also describes the axum, ? and test-subscriber changes I asked it to add.

Since f3bc33f, the pull adds tests for the paths 1.100's coverage counts as untaken. It also removes two branches that can't happen, and updates AGENTS.md.

  • Removed branches: group_view_basic now expects the group's address, as group_handle.rs and sites.rs already do. profile_view and merge became show_profile, which writes into the view directly. A group's view is always an object, so nothing is lost.
  • Tests: each new test takes the path it is named for, with the assertion that path needs. The test helper drop_profile and the mcp no-state cases both look right.
  • commands.rs step: the change matches the body's "Shortcomings" note, and tests/import.rs still covers the refusal.

Nothing needs to change. As the body says, the image build on 1.100 is first tried by deploy after merge.

Merged as a8c27d6