FAILURE MAP
← Case archive

FA-7446 / DNS resolution / Open access

Dns srv priority is selected before weight · case 01

Dns srv priority is selected before weight.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The faulty implementation uses `max(records,key=lambda r:r[2],default=(None,))[0]` for the dns-srv-priority-is-selected-before-weight decision.

VERIFIED REPAIR

Apply the explicit dns-srv-priority-is-selected-before-weight contract, including the tested boundary and negative cases.

Unsuccessful approach: The attempted repair uses `min(records,key=lambda r:r[1],default=(None,))[0]` and still violates a separate fixture.

Case contract

Given records, draw, dns srv priority is selected before weight. Return the protocol decision or transformed value; fields are validated and fixtures state boundary outcomes.

Why this case matters

This deterministic dns resolution model isolates the dns-srv-priority-is-selected-before-weight policy at a network component boundary.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(records, draw):
    return max(records,key=lambda r:r[2],default=(None,))[0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve([('a', 10, 1), ('b', 10, 3), ('bad', 20, 100)], 1), 'b')", "check('fixture 2', solve([('a', 10, 1), ('bad', 20, 100)], 0), 'a')", "check('fixture 3', solve([], 0), None)", "check('fixture 4', solve([('a', 0, 1)], 0), 'a')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 2badaFailed
fixture 3NoneNonePassed
fixture 4aaPassed
fixture 1badbFailed

SHA-256 / 75a371ec80459996e1b7d4ecbdec438c93882e4bbc727da9abb85e0ed882338a

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(records, draw):
    return min(records,key=lambda r:r[1],default=(None,))[0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve([('a', 10, 1), ('b', 10, 3), ('bad', 20, 100)], 1), 'b')", "check('fixture 2', solve([('a', 10, 1), ('bad', 20, 100)], 0), 'a')", "check('fixture 3', solve([], 0), None)", "check('fixture 4', solve([('a', 0, 1)], 0), 'a')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 2aaPassed
fixture 3NoneNonePassed
fixture 4aaPassed
fixture 1abFailed

SHA-256 / 9fc89b0df87dca87727a98f54c37f154cb9d4ae9909b22e9845ebacf2c5c55c5

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(records, draw):
    return next((r[0] for i,r in enumerate([r for r in records if r[1] == min(x[1] for x in records)]) if draw < sum(x[2] for x in [r for r in records if r[1] == min(x[1] for x in records)][:i+1])),None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve([('a', 10, 1), ('b', 10, 3), ('bad', 20, 100)], 1), 'b')", "check('fixture 2', solve([('a', 10, 1), ('bad', 20, 100)], 0), 'a')", "check('fixture 3', solve([], 0), None)", "check('fixture 4', solve([('a', 0, 1)], 0), 'a')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 2aaPassed
fixture 3NoneNonePassed
fixture 4aaPassed
fixture 1bbPassed

SHA-256 / 75f41a816de8e85987d821f017e2803e50dc1d294978d7864d6f85125cd09f62

Verification & scope

Bounded deterministic policy model over validated inputs; not a complete protocol stack or an interoperability claim. The five variants rotate the same explicit fixture set. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:38:12.253625+00:00.

Case digest / 4a70228b775c5f5407719a9a18da3017f6cb4e41e8b6d899677d50464b0ab2a8