open-standards/wai/http-conformance/falsify/intersection.patch
Transaction Science 909312ce15 wai: falsification patches for the fix round, and the four the rewrite moved, regenerated
New: threshold-all, refusal-ends, reuse-stale, plus-sign, dispatch-layer,
union-no-layer, wai-prefix-case, dup-caps, record-alt, base-unanswered, each
naming the corpus cases it must fail. accept-gzip, trust-content-range,
skip-on-absent and intersection are the same defects written against the
current code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 09:35:08 -04:00

17 lines
931 B
Diff

# must fail: union_O9
# the union is the floor, the intersection (codecs::union_of)
diff --git a/wai/wai-rs/src/http_binding/codecs.rs b/wai/wai-rs/src/http_binding/codecs.rs
index 530ae822..97e32ca4 100644
--- a/wai/wai-rs/src/http_binding/codecs.rs
+++ b/wai/wai-rs/src/http_binding/codecs.rs
@@ -338,8 +338,9 @@ pub fn union_of(objects: &[SeqObject]) -> Result<Element, CodecsError> {
let each = described(objects)?;
let prefix = objects.iter().map(|o| if o.head.version == Version::Wai2 { Prefix::Wai2 } else { Prefix::Wai1 }).max().unwrap_or(Prefix::Wai1);
let mut alts: Vec<Alt> = Vec::new();
+ let all = each.clone();
for e in each {
- for a in e.alts {
+ for a in e.alts.into_iter().filter(|a| all.iter().all(|o| o.alts.iter().any(|x| x.cap == a.cap))) {
match alts.iter_mut().find(|x| x.cap == a.cap) {
Some(x) => {
for p in a.plus {