feat(model): shipped joins the evidence vector as a within-tier weight; v5 baseline

v5 (parameter-fed carried confirmed by the exact flow): pmpro 69, wpstatistics 172, mwwpform 68,
vampi 16. Reading the recorded head of each order: every region ahead of a CVE is in its tier on a tied
or higher score, and 10 of the 67 ahead of MW WP Form's are test-mail.php. The build's own word on what
is product was on the region and not in the vector; it is now, at -2.0 for an unshipped file. Orders
only, never promotes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG
This commit is contained in:
Marius Ciepluch
2026-09-11 13:45:00 +02:00
co-authored by Claude Fable 5.1
parent 983eda5886
commit 2de873274f
4 changed files with 3493 additions and 0 deletions
File diff suppressed because it is too large Load Diff
+7
View File
@@ -32,6 +32,9 @@ WEIGHTS: dict[str, float] = {
"source_near": 1.0, # a modelled source within the arbiter's callDepth "source_near": 1.0, # a modelled source within the arbiter's callDepth
"entry": 0.5, # parameters untrusted by contract "entry": 0.5, # parameters untrusted by contract
"access_declared_public": 1.0, "access_declared_public": 1.0,
# A file the build does not ship: tests, fixtures, examples. Measured: 10 of the 67 regions ahead of
# MW WP Form's CVE were test-mail.php.
"unshipped": -2.0,
} }
OPEN_SINK_CAP = 5 OPEN_SINK_CAP = 5
CLEANSED_SINK_CAP = 3 CLEANSED_SINK_CAP = 3
@@ -66,6 +69,7 @@ class Evidence:
access_declared_public: bool = False # declared, not inferred -- "no decorator found" is not "public" access_declared_public: bool = False # declared, not inferred -- "no decorator found" is not "public"
carried: bool | None = None # stage one of the two-stage join, the STRONG form; None where it was not computed carried: bool | None = None # stage one of the two-stage join, the STRONG form; None where it was not computed
carried_weak: bool = False # the weak form: a field assigned from a parameter of its method. Orders, never promotes. carried_weak: bool = False # the weak form: a field assigned from a parameter of its method. Orders, never promotes.
shipped: bool = True # the project's own build declaration names this file (regions.shipped); tests and fixtures are not
bound_names: tuple[str, ...] = field(default=()) # sink names the shape test treats as bound at arity >= 2 bound_names: tuple[str, ...] = field(default=()) # sink names the shape test treats as bound at arity >= 2
@property @property
@@ -114,6 +118,7 @@ class Evidence:
+ (w["source_near"] if self.source_near else 0.0) + (w["source_near"] if self.source_near else 0.0)
+ (w["entry"] if self.entry else 0.0) + (w["entry"] if self.entry else 0.0)
+ (w["access_declared_public"] if self.access_declared_public else 0.0) + (w["access_declared_public"] if self.access_declared_public else 0.0)
+ (w["unshipped"] if not self.shipped else 0.0)
) )
@property @property
@@ -129,6 +134,7 @@ def evidence_from_rows(
access_declared_public: bool = False, access_declared_public: bool = False,
carried: bool | None = None, carried: bool | None = None,
bound_names: Sequence[str] = (), bound_names: Sequence[str] = (),
shipped: bool = True,
) -> Evidence | None: ) -> Evidence | None:
"""Read the query's evidence rows for one request. ``None`` when the query did not answer. """Read the query's evidence rows for one request. ``None`` when the query did not answer.
@@ -165,6 +171,7 @@ def evidence_from_rows(
if "carried" in summary if "carried" in summary
else carried, else carried,
carried_weak=str(summary.get("carriedKind", "")) == "parameter", carried_weak=str(summary.get("carriedKind", "")) == "parameter",
shipped=shipped,
bound_names=tuple(bound_names), bound_names=tuple(bound_names),
) )
+1
View File
@@ -397,6 +397,7 @@ def _evidence_pass(
# the brief names it as the field to thread through next. # the brief names it as the field to thread through next.
access_declared_public=region.rank >= 1.0, access_declared_public=region.rank >= 1.0,
bound_names=getattr(spec, "safe_shape_sinks", ()), bound_names=getattr(spec, "safe_shape_sinks", ()),
shipped=bool(getattr(region, "shipped", True)),
) )
if evidence is not None: if evidence is not None:
out[_pair_key(region, spec)] = evidence out[_pair_key(region, spec)] = evidence
+12
View File
@@ -175,3 +175,15 @@ def test_carried_provenance_promotes_only_when_source_fed() -> None:
assert weak is not None and weak.tier == TIER_OPEN and weak.carried is False and weak.carried_weak assert weak is not None and weak.tier == TIER_OPEN and weak.carried is False and weak.carried_weak
assert none is not None and none.tier == TIER_OPEN and not none.carried_weak assert none is not None and none.tier == TIER_OPEN and not none.carried_weak
assert weak.score - none.score == WEIGHTS["carried_weak"] assert weak.score - none.score == WEIGHTS["carried_weak"]
def test_an_unshipped_file_orders_after_a_shipped_one_in_the_same_tier() -> None:
"""`shipped` is the build's own word on what is product; a test fixture with the same sink and source
is not where the bug ships. Orders only: the tier is unchanged."""
from openultrasast.model.evidence import WEIGHTS, Evidence, SinkEvidence
sink = SinkEvidence(code="q(1)", line=1, method="m", arity=1, arg0_literal=False, cleansed_on_call=False)
product = Evidence(sinks=(sink,), source_local=True, shipped=True)
fixture = Evidence(sinks=(sink,), source_local=True, shipped=False)
assert product.tier == fixture.tier
assert product.score - fixture.score == -WEIGHTS["unshipped"]