test(axum): prove page response semantics

Close the first hemx-axum mutation class by proving page-mode detection and response constructor fingerprint behavior through the public integration API.

req: page_swap/001

req: abi/005
This commit is contained in:
slhx agent
2026-07-16 23:59:51 +02:00
parent d74810db4b
commit dc7c82f7ee
2 changed files with 29 additions and 1 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-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-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-axum`, `hemx-build`, `hemx-derive`, and `hemx-lsp` outside already-clean focused contracts. - **Blocked by:** none; broad survivors currently remain in `hemx-axum`, `hemx-build`, `hemx-derive`, and `hemx-lsp` outside already-clean focused contracts; the next `hemx-axum` slice now proves page-mode and response-constructor semantics, while form/registry/rejection paths remain.
- **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
+28
View File
@@ -118,6 +118,14 @@ fn page_mode_detects_partial_header() {
#[test] #[test]
fn page_request_wraps_full_pages_and_leaves_partials_unwrapped() { fn page_request_wraps_full_pages_and_leaves_partials_unwrapped() {
// req: test/005 // req: test/005
assert!(!PageRequest {
mode: PageMode::Full
}
.is_partial());
assert!(PageRequest {
mode: PageMode::Partial
}
.is_partial());
let full = PageRequest { let full = PageRequest {
mode: PageMode::Full, mode: PageMode::Full,
} }
@@ -209,6 +217,26 @@ fn page_request_wraps_safe_html_full_pages_and_leaves_partials_unwrapped() {
); );
} }
#[test]
fn page_response_constructors_preserve_mode_and_optional_fingerprint() {
let full = PageResponse::full("<html>Full</html>");
assert_eq!(full.mode, PageMode::Full);
assert_eq!(full.html, "<html>Full</html>");
assert_eq!(full.fingerprint, None);
let partial = PageResponse::partial("<main>Partial</main>");
assert_eq!(partial.mode, PageMode::Partial);
assert_eq!(partial.html, "<main>Partial</main>");
assert_eq!(partial.fingerprint, None);
let fingerprint = BuildFingerprint(42);
assert_eq!(
partial.fingerprint(fingerprint).fingerprint,
Some(fingerprint)
);
// test req: page_swap/001 req: abi/005
}
#[test] #[test]
fn partial_page_response_sets_partial_and_title_headers() { fn partial_page_response_sets_partial_and_title_headers() {
let response = PageResponse::partial("<main>Docs</main>") let response = PageResponse::partial("<main>Docs</main>")