From a59e9b0bfe0b43dadf55a6dc002899b67488e097 Mon Sep 17 00:00:00 2001 From: slhx agent Date: Fri, 17 Jul 2026 14:11:55 +0200 Subject: [PATCH] test(derive): close second mutation shard Match public Form paths with one unambiguous segment pattern and record clean hemx-derive shard 2/8 proof. req: derive_handler/004 req: test/022 req: test/023 --- PLAN.md | 2 +- hemx-derive/src/lib.rs | 21 ++++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/PLAN.md b/PLAN.md index db9931e..d3e13e6 100644 --- a/PLAN.md +++ b/PLAN.md @@ -21,7 +21,7 @@ - [ ] **State:** In progress — the package-native capped xtask entry point is reachable, rejects unknown packages and invalid shards, propagates mutest failure, and mutation-tests `hemx-axum`, `hemx-build`, `hemx-core`, `hemx-js`, and the full `hemx-test` package cleanly; full package closure remains. - **User value:** maintainers can run one bounded repository command and trust that meaningful Rust logic across every mutation-applicable library is either killed or explicitly justified. - **Build:** add a capped `hemx-xtask` mutation command that invokes `/opt/repositories/mutest`/`mutest` through package-native test targets rather than the broken workspace-wide example path; enumerate only current mutation-applicable library/proc-macro packages; finish adversarial tests or simplify code until every survivor is classified; keep equivalent, invariant-only, and infrastructure-inapplicable classifications inspectable and minimal; document the exact local release command in the existing readiness surface. -- **Blocked by:** none; broad survivors currently remain in `hemx-derive` and `hemx-lsp` outside already-clean focused contracts. The xtask mutation runner now creates shard output parents before invoking mutest, fixing first-use failure for newly sharded packages. `hemx-derive` public shard `1/8` is clean through deterministic partitions `1/16` (31 mutants: 24 caught, 7 unviable) and `9/16` (31 mutants: 28 caught, 3 unviable) after exact client-handler mode/signature/codegen, generated-file diagnostics, form generic bounds, and malformed symbol-manifest coverage; shards `2/8` through `8/8` remain. The mutation entry point accepts validated one-based `SHARD/TOTAL` operands, maps them to native zero-based shards, uses shard-specific output directories, grants repo-owned compiler probes a 120-second floor, and preserves the unsharded gate. All eight deterministic `hemx-build` shards now pass: 1,304 mutants total, 1,070 caught and 234 unviable, including final shard `8/8` with 159 mutants (139 caught, 20 unviable). The complete 470-mutant `hemx-axum` package gate passes with 262 caught and 208 unviable after public page/form/multipart/registry/response/runtime proofs and narrow classification of infallible header parsing and streamed multipart unwrap-equivalent mutants. +- **Blocked by:** none; broad survivors currently remain in `hemx-derive` and `hemx-lsp` outside already-clean focused contracts. The xtask mutation runner now creates shard output parents before invoking mutest, fixing first-use failure for newly sharded packages. `hemx-derive` public shards `1/8` and `2/8` are clean. Shard `1/8` passed through deterministic partitions `1/16` (31 mutants: 24 caught, 7 unviable) and `9/16` (31 mutants: 28 caught, 3 unviable); shard `2/8` passed with 61 mutants (46 caught, 15 unviable) after exact client-handler mode/signature/codegen, generated-file diagnostics, form generic bounds, malformed symbol manifests, and unambiguous `Form` path matching; shards `3/8` through `8/8` remain. The mutation entry point accepts validated one-based `SHARD/TOTAL` operands, maps them to native zero-based shards, uses shard-specific output directories, grants repo-owned compiler probes a 120-second floor, and preserves the unsharded gate. All eight deterministic `hemx-build` shards now pass: 1,304 mutants total, 1,070 caught and 234 unviable, including final shard `8/8` with 159 mutants (139 caught, 20 unviable). The complete 470-mutant `hemx-axum` package gate passes with 262 caught and 208 unviable after public page/form/multipart/registry/response/runtime proofs and narrow classification of infallible header parsing and streamed multipart unwrap-equivalent mutants. - **Proof:** the new xtask mutation command exits zero within its documented bound, covers each applicable package, emits no unexplained missed mutant, and a deliberate adjacent mutation makes it fail. `cargo run -p hemx-xtask -- test` remains green. req: test/020 req: test/021 ## 3. Elect and enforce the release license policy diff --git a/hemx-derive/src/lib.rs b/hemx-derive/src/lib.rs index 80338fe..2c06319 100644 --- a/hemx-derive/src/lib.rs +++ b/hemx-derive/src/lib.rs @@ -289,22 +289,13 @@ fn form_model_type(ty: &Type) -> Option { let Type::Path(path) = ty else { return None; }; - let mut segments = path.path.segments.iter(); - let first = segments.next()?; - let last = path - .path - .segments - .last() - .expect("path has at least one segment"); - let path_is_form = if path.path.segments.len() == 1 { - first.ident == "Form" - } else { - first.ident == "hemx" && last.ident == "Form" + let segments = path.path.segments.iter().collect::>(); + let form = match segments.as_slice() { + [form] if form.ident == "Form" => form, + [hemx, .., form] if hemx.ident == "hemx" && form.ident == "Form" => form, + _ => return None, }; - if !path_is_form { - return None; - } - let PathArguments::AngleBracketed(args) = &last.arguments else { + let PathArguments::AngleBracketed(args) = &form.arguments else { return None; }; args.args.iter().find_map(|arg| match arg {