test(build): close authoring diagnostic mutants

Assert exact selector-target and unknown-attribute InvalidData diagnostics and prove invalid scope IDs fail closed in unkeyed-loop diagnostics.

req: locality/001

req: locality/002

req: htmx_equivalents/003

req: convention/009

req: diagnostics/002

req: test/021
This commit is contained in:
slhx agent
2026-07-17 06:36:15 +02:00
parent a6f287e477
commit 31534a538b
2 changed files with 27 additions and 29 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
- [ ] **State:** In progress — the package-native capped xtask entry point is reachable, rejects unknown packages, propagates mutest failure, and mutation-tests `hemx-axum`, `hemx-core`, `hemx-js`, and the full `hemx-test` package cleanly; full package closure remains. - [ ] **State:** In progress — the package-native capped xtask entry point is reachable, rejects unknown packages, propagates mutest failure, and mutation-tests `hemx-axum`, `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. - **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. - **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-build`, `hemx-derive`, and `hemx-lsp` outside already-clean focused contracts. The current `hemx-build` frontier now also mutation-proves all 112 static attribute-value mutants and all 21 keyed-scope ancestry mutants: exact `InvalidData` diagnostics cover missing/empty/invalid values, valid boundaries reach `AppBuilder::run`, nested keyed resources lower as keyed, and invalid/sibling scopes stay unkeyed or fail closed. The remaining package frontier starts at unknown/selector attributes and unkeyed-loop diagnostic formatting. The complete 470-mutant `hemx-axum` package gate now 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-build`, `hemx-derive`, and `hemx-lsp` outside already-clean focused contracts. The current `hemx-build` frontier now also mutation-proves all 43 unknown/selector-attribute and unkeyed-loop diagnostic mutants, with exact `InvalidData` paths/guidance and invalid-scope fail-closed behavior. The remaining package frontier starts at generated-target deduplication, identifier/canonical-symbol helpers, and residual internal diagnostics before another full package gate. The complete 470-mutant `hemx-axum` package gate now 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 - **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 ## 3. Elect and enforce the release license policy
+26 -28
View File
@@ -3754,6 +3754,14 @@ fn main() {{
assert!(is_inside_keyed_for(&surface, nested_scope)); assert!(is_inside_keyed_for(&surface, nested_scope));
assert!(!is_inside_keyed_for(&surface, sibling_scope)); assert!(!is_inside_keyed_for(&surface, sibling_scope));
assert!(!is_inside_keyed_for(&surface, ScopeId(u32::MAX))); assert!(!is_inside_keyed_for(&surface, ScopeId(u32::MAX)));
assert!(unkeyed_generated_target_diagnostic_for_scope(
&surface,
ScopeId(u32::MAX),
Path::new("todo.heml"),
"slot",
"missing",
)
.is_none());
let _ = std::fs::remove_dir_all(base); let _ = std::fs::remove_dir_all(base);
} }
@@ -3777,24 +3785,21 @@ fn main() {{
let out = base.join("out"); let out = base.join("out");
let _ = std::fs::remove_dir_all(&base); let _ = std::fs::remove_dir_all(&base);
std::fs::create_dir_all(&templates).unwrap(); std::fs::create_dir_all(&templates).unwrap();
std::fs::write(templates.join("target.heml"), template).unwrap(); let template_path = templates.join("target.heml");
std::fs::write(&template_path, template).unwrap();
let err = app() let err = app()
.template_dir(&templates) .template_dir(&templates)
.out_dir(&out) .out_dir(&out)
.run() .run()
.unwrap_err(); .unwrap_err();
assert!( assert_eq!(err.kind(), io::ErrorKind::InvalidData);
err.to_string().contains(attr), assert_eq!(
"missing attr in diagnostic: {err}" err.to_string(),
); format!(
assert!( "{}: `{attr}` is selector-style targeting; hemx uses generated resources instead. Add data-hemx-slot to the local element and return an effect for that generated slot.",
err.to_string().contains("selector-style targeting"), template_path.display()
"missing selector diagnostic: {err}" )
);
assert!(
err.to_string().contains("data-hemx-slot"),
"missing suggested slot fix: {err}"
); );
let _ = std::fs::remove_dir_all(&base); let _ = std::fs::remove_dir_all(&base);
@@ -3809,8 +3814,9 @@ fn main() {{
let out = base.join("out"); let out = base.join("out");
let _ = std::fs::remove_dir_all(&base); let _ = std::fs::remove_dir_all(&base);
std::fs::create_dir_all(&templates).unwrap(); std::fs::create_dir_all(&templates).unwrap();
let template_path = templates.join("typo.heml");
std::fs::write( std::fs::write(
templates.join("typo.heml"), &template_path,
r#"<button data-hemx-handle="save" data-hemx-pendig-class="busy">Save</button>"#, r#"<button data-hemx-handle="save" data-hemx-pendig-class="busy">Save</button>"#,
) )
.unwrap(); .unwrap();
@@ -3820,21 +3826,13 @@ fn main() {{
.out_dir(&out) .out_dir(&out)
.run() .run()
.unwrap_err(); .unwrap_err();
assert!( assert_eq!(err.kind(), io::ErrorKind::InvalidData);
err.to_string().contains("data-hemx-pendig-class"), assert_eq!(
"missing attr in diagnostic: {err}" err.to_string(),
); format!(
assert!( "{}: unknown hemx attribute `data-hemx-pendig-class`; check the spelling or use a non-hemx data-* attribute for app-specific metadata",
err.to_string().contains("unknown hemx attribute"), template_path.display()
"missing unknown-attr diagnostic: {err}" )
);
assert!(
err.to_string().contains("check the spelling"),
"missing spelling guidance: {err}"
);
assert!(
err.to_string().contains("non-hemx data-*"),
"missing app metadata guidance: {err}"
); );
let _ = std::fs::remove_dir_all(&base); let _ = std::fs::remove_dir_all(&base);