From f42f277c7992508f2aafdc9ce42a34f737f84fac Mon Sep 17 00:00:00 2001
From: Per Nyfelt
Date: Mon, 16 Nov 2026 17:29:05 +0100
Subject: [PATCH 1/7] Prepare native license resolution evidence and upstream
questions
---
req/phase8-4-implementation-report.md | 9 +
req/phase8-4-native-license-audit.md | 4 +
req/phase8-4-native-license-resolution.md | 120 ++++++++++
req/phase8-4-release-checklist.md | 2 +
.../code-comparison.json | 216 ++++++++++++++++++
.../juffa-erf-bsd-sample.txt | 62 +++++
.../juffa-erfinv-bsd-sample.txt | 60 +++++
.../research.json | 138 +++++++++++
.../upstream-request-draft.md | 35 +++
9 files changed, 646 insertions(+)
create mode 100644 req/phase8-4-native-license-resolution.md
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/research.json
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md
diff --git a/req/phase8-4-implementation-report.md b/req/phase8-4-implementation-report.md
index 486fec07..59e14f80 100644
--- a/req/phase8-4-implementation-report.md
+++ b/req/phase8-4-implementation-report.md
@@ -120,6 +120,15 @@ URL-bound cache and verified all 57 URL/digest pairs plus three rebuilt JARs. Fo
evidence records this warm-cache check separately from the prior cold run. Both legal findings
remain open and `--require-clear` still exits 1.
+The [license resolution investigation](phase8-4-native-license-resolution.md) follows
+PR #100's merge on 2026-11-16. It retains Juffa's explicitly BSD-licensed forum samples,
+records their differences from the shipped implementations, reviews the original Cephes
+correspondence and prepares an unsent provenance request. It does not establish an additional
+grant or close either legal finding. Validation confirms the comparison inputs and retained
+file hashes and reproduces the unchanged audit result (57 URL/digest pairs, releaseReady false,
+expected exit 1). This follow-up changes only documentation and research evidence; the 74-test
+and native Gradle results above remain evidence for PR #100's implementation, not a new run.
+
## Review corrections (2026-11-15)
The minimum-host workflow now creates its Gradle home through `GITHUB_ENV` at step scope;
diff --git a/req/phase8-4-native-license-audit.md b/req/phase8-4-native-license-audit.md
index d826fb48..50166be8 100644
--- a/req/phase8-4-native-license-audit.md
+++ b/req/phase8-4-native-license-audit.md
@@ -93,6 +93,10 @@ libraries to the reviewed bundle.
## Open findings
+The [resolution investigation](phase8-4-native-license-resolution.md) records primary-source
+follow-up, comparisons with Juffa's BSD samples and an unsent request for upstream provenance.
+It supplies review material; both findings below remain open.
+
### NATIVE-LICENSE-1: Juffa `erf` / `erfinv` provenance
The pinned Metal `erf.h` explicitly says its error function is based on
diff --git a/req/phase8-4-native-license-resolution.md b/req/phase8-4-native-license-resolution.md
new file mode 100644
index 00000000..8ce6eef8
--- /dev/null
+++ b/req/phase8-4-native-license-resolution.md
@@ -0,0 +1,120 @@
+# Phase 8.4 native license resolution review
+
+Investigation date: 2026-11-16. Baseline: PR #100 merge
+`ee807c99e89f06f63ef326e2bbb976b7cb247989`.
+
+The next release step is an owner/legal decision on the two findings in the
+[native audit](phase8-4-native-license-audit.md). This investigation found useful primary
+sources, but did not establish an applicable additional grant for the shipped code.
+Both findings and the license release gate remain open.
+
+The recommended next action is to ask MLX maintainers for the relevant provenance and
+permission records, using the [prepared request](plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md)
+after owner review. No request has been posted or sent. Native code, pins, bindings, notices,
+artifact hashes and the publication flow are unchanged.
+
+## Juffa implementations: the BSD samples differ
+
+Juffa published explicit BSD-2-Clause code in his NVIDIA forum posts for
+[`erff`](https://forums.developer.nvidia.com/t/optimized-version-of-single-precision-error-function-erff/40977/1)
+and [`erfinvf`](https://forums.developer.nvidia.com/t/a-very-compact-implementation-of-the-inverse-error-function-erfinvf/61961/1).
+The captured code samples retain their complete copyright, conditions and disclaimer under
+the [evidence directory](plans/evidence/native-license-resolution-2026-11-16/).
+
+| Material | Shipped MLX version | BSD forum sample | Result |
+| --- | --- | --- | --- |
+| Metal `erf` | Threshold `0.927734375`; first polynomial coefficient `-1.72853470e-5` | Threshold `1.0`; first coefficient `2.58907676e-5` | Different sample |
+| Metal/CPU `erfinv` | Natural logarithm; threshold magnitude `6.125`; tail first coefficient `3.03697567e-10` | CUDA approximate base-two logarithm; threshold `-8.8359375`; first coefficient `1.50166858e-11` | Different sample and evaluation |
+
+The [comparison record](plans/evidence/native-license-resolution-2026-11-16/code-comparison.json)
+captures signed decimal floating literals from the named functions and identifies every input
+by SHA-256. The Metal inverse function's literal sequence matches
+[Stack Overflow answer 49743348](https://stackoverflow.com/a/49743348); the CPU inverse
+function has the same literal multiset with its threshold placed later in the function.
+The Metal error function's literals are a multiset subset of
+[answer 35148199](https://stackoverflow.com/a/35148199), whose alternative exponential branch
+adds another literal. These are bounded lexical observations, not proofs of equivalent
+program behavior or of copyright/license scope. The existing audit's source attribution
+and matching coefficients still support treating these as provenance questions.
+
+Neither captured BSD sample has the shipped function's literal sequence. Their common author,
+similar algorithms and grants allowing modifications do not themselves establish the rights
+under which MLX incorporated these particular Stack Overflow-derived versions. The two specific
+answer comment lists were also fetched completely; no licensing/permission keyword was found
+in those comments. This does not establish the absence of a grant elsewhere.
+
+The pinned file's [history](https://api.github.com/repos/ml-explore/mlx/commits?path=mlx/backend/metal/kernels/erf.h&per_page=100&sha=36969c094354086e15d2a327a9c50feb20b9cf11)
+has four commits. The latest is the
+[`expm1f` substitution](https://github.com/ml-explore/mlx/commit/634b148dd4203f80b8cc8db3e33452a91785fad8)
+from [PR #3025](https://github.com/ml-explore/mlx/pull/3025). That PR describes a numerical
+change and had no issue-thread comments when checked; it does not provide an additional
+license grant. A public history entry named `copyright + ack` is also not a substitute
+for the underlying permission record. The research manifest records this bounded history check.
+
+## Cephes: original correspondence needs a scope decision
+
+The original [2004 correspondence](https://lists.debian.org/debian-legal/2004/12/msg00295.html)
+contains Moshier's response to a request about distributing Cephes in particular packages.
+He distinguishes the terms of his own distribution from permission for another distribution
+and supplies example BSD boilerplate. This is stronger context than a third-party notice
+claiming BSD, but it does not explicitly identify MLX, fastermath, NEON math or a blanket
+grant to every downstream recipient of the original Netlib code.
+
+The [direct reply](https://lists.debian.org/debian-legal/2004/12/msg00297.html), by Brian
+Thomas Sniffen rather than Moshier, discusses using excerpts actually distributed with that
+boilerplate and porting modifications if needed. That is a contemporary interpretation,
+not a fresh grant from the copyright holder. It does not establish the path by which the
+Cephes-derived material reached the pinned MLX SIMD implementation.
+
+The existing Netlib permission statement and immediate BSD/zlib notices remain packaged.
+The owner/legal reviewer must decide whether those records already cover this distribution,
+or obtain an applicable grant or a documented licensed provenance chain. This investigation
+does not label the material prohibited, GPL-only or automatically BSD-licensed.
+
+## Resolution choices
+
+| Route | Concrete evidence needed before closing the finding |
+| --- | --- |
+| Ask upstream for an applicable grant/provenance record (recommended) | Identify exact functions/files, original copyright holder, granted terms and downstream scope; retain the response or immutable source record and package its required notices |
+| Review the existing permissions | For Juffa, determine the applicable license/version, adaptation boundary and obligations for compiled MLX and Metal code; for Cephes, document why the original permission or a traced licensed distribution covers the actual derived material |
+| Separately review a native implementation or source change | Establish a licensed replacement and validate numerical behavior, fixtures, both precision modes, kernel execution and the complete rebuilt artifact; repeat the audit and candidate verification |
+
+The Juffa answers' recorded license is CC BY-SA 4.0. Its official
+[legal code](https://creativecommons.org/licenses/by-sa/4.0/legalcode.en) distinguishes
+attribution, modification notices, the adapter's license for adapted material and downstream
+restrictions (sections 2 and 3). A link to that license alone does not establish that all
+conditions for this compiled distribution have been met. The software-specific integration
+and adaptation boundary require review; this document does not infer that all of jmlx becomes
+CC-licensed. Creative Commons' [software FAQ](https://creativecommons.org/faq/#can-i-apply-a-creative-commons-license-to-software)
+recommends software licenses for code and explains some differences from CC terms. Its
+recommendation does not itself cancel the existing license or supply an alternative grant.
+
+The first route preserves the reviewed native tuple and avoids choosing new licensing terms
+or changing numerical implementations during release preparation. If the requested records
+cannot be established, the owner can choose a reviewed compliance or replacement route.
+
+## Evidence and validation
+
+The [research manifest](plans/evidence/native-license-resolution-2026-11-16/research.json)
+records source URLs, content projections and hashes. It identifies live pages as mutable;
+their hashes capture what was reviewed, not an assurance of unchanged future responses.
+Only the two explicitly BSD-licensed samples and derived comparison facts are retained here;
+Stack Overflow answer bodies and correspondence HTML are referenced rather than recopied.
+The original audit retains the Stack Overflow body hashes and licenses.
+
+Comparison method: extract the named function using balanced braces from these particular
+inputs, strip C/C++ comments, collect signed decimal floating literals, remove `f`/`F` suffixes
+and normalize with Python's `decimal.Decimal`. The comparison does not parse arbitrary C++
+and excludes integer/hexadecimal literals. Code input hashes and all seven extracted function
+hashes are recorded, so readers can check the exact variants being compared. The two BSD
+samples are reference evidence only and are not built or added to the native artifacts.
+
+Validation checks source hashes against the existing audit, the five recorded comparison
+results and every retained sample/report digest. The unchanged audit command still produces
+the same result as PR #100's follow-up evidence, including `releaseReady: false` and both
+finding IDs; `--require-clear` exits 1. No new runtime test or legal clearance is claimed.
+
+Posting the prepared request is a separate third-party communication and requires the owner's
+explicit instruction. The draft asks for provenance rather than asserting an upstream license
+violation. A subsequent response must be reviewed against the actual code and bundle before
+either finding is removed from the release gate.
diff --git a/req/phase8-4-release-checklist.md b/req/phase8-4-release-checklist.md
index be6da128..5b7b372b 100644
--- a/req/phase8-4-release-checklist.md
+++ b/req/phase8-4-release-checklist.md
@@ -41,6 +41,8 @@ BellSoft 21.0.12.1; the matching-toolchain audit reproduces every JAR exactly. T
The [2026-11-16 source audit](phase8-4-native-license-audit.md) expands the packaged
inventory to 26 entries. Two provenance findings (Juffa `erf`/`erfinv` and Cephes)
still prevent closing this gate; successful notice checks do not resolve them.
+ The [resolution review](phase8-4-native-license-resolution.md) compares alternative BSD
+ samples and original permission correspondence and prepares an unsent upstream request.
- [ ] Verify current official Portal size limits/accounting against actual signed bundle.
- [x] Integrate released upstream plugin 2.6.0 and verify the clean historical 8.1 fixture.
[Compatibility evidence](phase8-4-plugin-2.6.0-compatibility.md) records the unpushed scratch
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json b/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json
new file mode 100644
index 00000000..8a54e9b6
--- /dev/null
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json
@@ -0,0 +1,216 @@
+{
+ "schema": 1,
+ "date": "2026-11-16",
+ "method": "Extract each named function by balanced braces from the captured, hash-identified input. Strip C/C++ comments, collect signed decimal floating literals in order, strip f/F suffixes and normalize with Python decimal.Decimal. Integer and hexadecimal literals are not included. This bounded lexical comparison is not a C++ parser, semantic equivalence proof or licensing determination.",
+ "records": [
+ {
+ "id": "mlx-metal-erf",
+ "source": "https://github.com/ml-explore/mlx/blob/36969c094354086e15d2a327a9c50feb20b9cf11/mlx/backend/metal/kernels/erf.h",
+ "inputSha256": "31d88004390bbe08636c5f64a3cb3180ebc8d79a89267347de9f6c33aba0e9f9",
+ "inputProjection": "file bytes",
+ "function": "erf",
+ "functionSha256": "f50baff75da5feebd0781fc6917a072d28340c70ccb11da5b61dff636afd47f5",
+ "decimalFloatingLiterals": [
+ "0.927734375",
+ "-0.0000172853470",
+ "0.000383197126",
+ "-0.00388396438",
+ "0.0242546219",
+ "-0.106777877",
+ "-0.634846687",
+ "-0.128717512",
+ "-0.000596761703",
+ "0.00499119423",
+ "-0.0267681349",
+ "0.112819925",
+ "-0.376125336",
+ "0.128379166"
+ ]
+ },
+ {
+ "id": "mlx-metal-erfinv",
+ "source": "https://github.com/ml-explore/mlx/blob/36969c094354086e15d2a327a9c50feb20b9cf11/mlx/backend/metal/kernels/erf.h",
+ "inputSha256": "31d88004390bbe08636c5f64a3cb3180ebc8d79a89267347de9f6c33aba0e9f9",
+ "inputProjection": "file bytes",
+ "function": "erfinv",
+ "functionSha256": "65ef253b3827aa7f498c96b5cde9ae7b3da71f680d604b7b0e993cf167a48eaf",
+ "decimalFloatingLiterals": [
+ "0.0",
+ "1.0",
+ "6.125",
+ "3.03697567E-10",
+ "2.93243101E-8",
+ "0.00000122150334",
+ "0.0000284108955",
+ "0.000393552968",
+ "0.00302698812",
+ "0.00483185798",
+ "-0.264646143",
+ "0.840016484",
+ "5.43877832E-9",
+ "1.43285448E-7",
+ "0.00000122774793",
+ "1.12963626E-7",
+ "-0.0000561530760",
+ "-0.000147697632",
+ "0.00231468678",
+ "0.0115392581",
+ "-0.232015476",
+ "0.886226892"
+ ]
+ },
+ {
+ "id": "mlx-cpu-erfinv",
+ "source": "https://github.com/ml-explore/mlx/blob/36969c094354086e15d2a327a9c50feb20b9cf11/mlx/backend/cpu/simd/math.h",
+ "inputSha256": "5dbe79caa33a228d1354b2621876dc0fb3629dd6733c8ee4ebd0471790b0a94a",
+ "inputProjection": "file bytes",
+ "function": "erfinv",
+ "functionSha256": "337b001675c24fe12d75abd29189b0445a2bc666044b2fa761394fed5f30fe36",
+ "decimalFloatingLiterals": [
+ "0.0",
+ "1.0",
+ "3.03697567E-10",
+ "2.93243101E-8",
+ "0.00000122150334",
+ "0.0000284108955",
+ "0.000393552968",
+ "0.00302698812",
+ "0.00483185798",
+ "-0.264646143",
+ "0.840016484",
+ "5.43877832E-9",
+ "1.43285448E-7",
+ "0.00000122774793",
+ "1.12963626E-7",
+ "-0.0000561530760",
+ "-0.000147697632",
+ "0.00231468678",
+ "0.0115392581",
+ "-0.232015476",
+ "0.886226892",
+ "6.125"
+ ]
+ },
+ {
+ "id": "stackoverflow-erf",
+ "source": "https://stackoverflow.com/a/35148199",
+ "inputSha256": "3ce60857933485ca4c39fc48a30b369aa4987d748835ee286fb77020d948a7fe",
+ "inputProjection": "longest HTML code element decoded as UTF-8",
+ "function": "my_erff",
+ "functionSha256": "727d4a07a43cec85670deae43708ba8f1c88ba474745262e7327df5f26125bb9",
+ "decimalFloatingLiterals": [
+ "0.927734375",
+ "-0.0000172853470",
+ "0.000383197126",
+ "-0.00388396438",
+ "0.0242546219",
+ "-0.106777877",
+ "-0.634846687",
+ "-0.128717512",
+ "1.0",
+ "-0.000596761703",
+ "0.00499119423",
+ "-0.0267681349",
+ "0.112819925",
+ "-0.376125336",
+ "0.128379166"
+ ]
+ },
+ {
+ "id": "stackoverflow-erfinv",
+ "source": "https://stackoverflow.com/a/49743348",
+ "inputSha256": "338badc7951f1991cad00e0881d1d2bf38e35337ad8bd7405ac0982380ec4725",
+ "inputProjection": "longest HTML code element decoded as UTF-8",
+ "function": "my_erfinvf",
+ "functionSha256": "361e8d3356760cb646b9313584e52057ff5f055f2e9b71074637ab8eafaf37a5",
+ "decimalFloatingLiterals": [
+ "0.0",
+ "1.0",
+ "6.125",
+ "3.03697567E-10",
+ "2.93243101E-8",
+ "0.00000122150334",
+ "0.0000284108955",
+ "0.000393552968",
+ "0.00302698812",
+ "0.00483185798",
+ "-0.264646143",
+ "0.840016484",
+ "5.43877832E-9",
+ "1.43285448E-7",
+ "0.00000122774793",
+ "1.12963626E-7",
+ "-0.0000561530760",
+ "-0.000147697632",
+ "0.00231468678",
+ "0.0115392581",
+ "-0.232015476",
+ "0.886226892"
+ ]
+ },
+ {
+ "id": "bsd-forum-erf",
+ "source": "https://forums.developer.nvidia.com/t/40977/1",
+ "inputSha256": "cf24268b5b339f51c4e271223354fcf6906369f3bec318d0f19e841187cceded",
+ "inputProjection": "longest HTML code element decoded as UTF-8",
+ "function": "my_erff",
+ "functionSha256": "3496fe833efeb5128f4f2b9babd5a73dadc1f0bf463380b1fddfacbca18d954a",
+ "decimalFloatingLiterals": [
+ "1.0",
+ "0.0000258907676",
+ "-0.000564874616",
+ "0.00566795561",
+ "-0.0351759829",
+ "0.154329389",
+ "0.915674746",
+ "0.628459513",
+ "1.0",
+ "-0.000558853149",
+ "0.00490735564",
+ "-0.0267030653",
+ "0.112799220",
+ "-0.376123011",
+ "0.128379121"
+ ]
+ },
+ {
+ "id": "bsd-forum-erfinv",
+ "source": "https://forums.developer.nvidia.com/t/61961/1",
+ "inputSha256": "d477d7ecfc31535ae74560c87d04713b749ea2750654845233f368f4ab81cbe6",
+ "inputProjection": "longest HTML code element decoded as UTF-8",
+ "function": "my_erfinvf",
+ "functionSha256": "c036166484743da16caa5282cf88af487cd5d81c94f2cb74275d641f304c3a39",
+ "decimalFloatingLiterals": [
+ "1.0",
+ "-8.8359375",
+ "1.50166858E-11",
+ "2.10561724E-9",
+ "1.27291500E-7",
+ "0.00000429223974",
+ "0.0000860039654",
+ "0.000949774636",
+ "0.00188959786",
+ "-0.185239315",
+ "0.836782515",
+ "0.0",
+ "2.00998329E-10",
+ "7.63788321E-9",
+ "9.44120231E-8",
+ "1.27279494E-8",
+ "-0.00000898369126",
+ "-0.0000340910883",
+ "0.000770850747",
+ "0.00554407062",
+ "-0.160820886",
+ "0.886226892"
+ ]
+ }
+ ],
+ "checks": {
+ "metalInverseLiteralSequenceMatchesStackOverflow": true,
+ "cpuInverseLiteralMultisetMatchesStackOverflow": true,
+ "metalErfLiteralMultisetIsSubsetOfStackOverflow": true,
+ "bsdErfLiteralSequenceMatchesShipped": false,
+ "bsdInverseLiteralSequenceMatchesShipped": false
+ }
+}
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt b/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt
new file mode 100644
index 00000000..2ec4ce68
--- /dev/null
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2016-2021, Norbert Juffa
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* compute error function. max ulp error = 1.29532 */
+__device__ float my_erff (float a)
+{
+ float r, s, t, u;
+
+ t = fabsf (a);
+ s = a * a;
+ if (t > 1.0f) {
+ // ulp error = 1.03872
+ r = 2.58907676e-5f; // 0x1.b26000p-16
+ r = fmaf (r, t, -5.64874616e-4f); // -0x1.282830p-11
+ u = 5.66795561e-3f; // 0x1.737484p-8
+ u = fmaf (u, t, -3.51759829e-2f); // -0x1.202962p-5
+ r = fmaf (r, s, u);
+ r = fmaf (r, t, 1.54329389e-1f); // 0x1.3c110cp-3
+ r = fmaf (r, t, 9.15674746e-1f); // 0x1.d4d352p-1
+ r = fmaf (r, t, 6.28459513e-1f); // 0x1.41c572p-1
+ r = fmaf (r, t, t);
+ r = -r;
+ asm ("ex2.approx.ftz.f32 %0,%0;" : "+f"(r));
+ r = 1.0f - r;
+ r = __int_as_float (__float_as_int(a) & 0x80000000 | __float_as_int(r));
+ } else {
+ // ulp error = 1.29532
+ r = -5.58853149e-4f; // -0x1.250000p-11
+ r = fmaf (r, s, 4.90735564e-3f); // 0x1.419bc4p-8
+ r = fmaf (r, s, -2.67030653e-2f); // -0x1.b580c6p-6
+ r = fmaf (r, s, 1.12799220e-1f); // 0x1.ce068ep-4
+ r = fmaf (r, s, -3.76123011e-1f); // -0x1.812664p-2
+ r = fmaf (r, s, 1.28379121e-1f); // 0x1.06eba2p-3
+ r = fmaf (r, a, a);
+ }
+ return r;
+}
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt b/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt
new file mode 100644
index 00000000..e6c55bd3
--- /dev/null
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt
@@ -0,0 +1,60 @@
+/*
+ Copyright (c) 2017-2018, Norbert Juffa
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* compute the inverse of the error function. Maximum error = 2.446816 ulp */
+__device__ float my_erfinvf (float a)
+{
+ float p, r, t;
+ t = fmaf (a, -a, 1.0f);
+ asm ("lg2.approx.ftz.f32 %0,%0;" : "+f"(t));
+ if (t < -8.8359375f) { // max ulp err = 2.446816
+ p = 1.50166858e-11f; // 0x1.082d24p-36
+ p = fmaf (p, t, 2.10561724e-09f); // 0x1.2164d2p-29
+ p = fmaf (p, t, 1.27291500e-07f); // 0x1.115b3ep-23
+ p = fmaf (p, t, 4.29223974e-06f); // 0x1.200c1ep-18
+ p = fmaf (p, t, 8.60039654e-05f); // 0x1.68ba0ep-14
+ p = fmaf (p, t, 9.49774636e-04f); // 0x1.f1f498p-11
+ p = fmaf (p, t, 1.88959786e-03f); // 0x1.ef58c4p-10
+ p = fmaf (p, t, -1.85239315e-01f); // -0x1.7b5ec0p-3
+ p = fmaf (p, t, 8.36782515e-01f); // 0x1.ac6ec2p-1
+ r = fmaf (p, a, 0.0f);
+ } else { // max ulp err = 2.443247
+ p = 2.00998329e-10f; // 0x1.ba0000p-33
+ p = fmaf (p, t, 7.63788321e-09f); // 0x1.066f88p-27
+ p = fmaf (p, t, 9.44120231e-08f); // 0x1.957f1ep-24
+ p = fmaf (p, t, 1.27279494e-08f); // 0x1.b5543ap-27
+ p = fmaf (p, t, -8.98369126e-06f); // -0x1.2d7152p-17
+ p = fmaf (p, t, -3.40910883e-05f); // -0x1.1dfa0ep-15
+ p = fmaf (p, t, 7.70850747e-04f); // 0x1.9425d6p-11
+ p = fmaf (p, t, 5.54407062e-03f); // 0x1.6b5612p-8
+ p = fmaf (p, t, -1.60820886e-01f); // -0x1.495c76p-3
+ p = fmaf (p, t, 8.86226892e-01f); // 0x1.c5bf88p-1
+ r = a * p;
+ }
+ return r;
+}
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/research.json b/req/plans/evidence/native-license-resolution-2026-11-16/research.json
new file mode 100644
index 00000000..085f2970
--- /dev/null
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/research.json
@@ -0,0 +1,138 @@
+{
+ "schema": 1,
+ "date": "2026-11-16",
+ "baselineSha": "ee807c99e89f06f63ef326e2bbb976b7cb247989",
+ "status": "owner-legal-review-required",
+ "releaseGateClosed": false,
+ "sources": [
+ {
+ "id": "bsd-forum-erf",
+ "url": "https://forums.developer.nvidia.com/t/40977/1",
+ "apiUrl": "https://forums.developer.nvidia.com/t/40977.json",
+ "postId": 190213,
+ "postVersion": 2,
+ "updatedAt": "2021-11-12T23:16:50.729Z",
+ "projection": "longest code element in post_stream.posts[0].cooked, HTML-decoded, UTF-8 encoded",
+ "sha256": "cf24268b5b339f51c4e271223354fcf6906369f3bec318d0f19e841187cceded",
+ "retainedPath": "req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt",
+ "disposition": "BSD-2-Clause grant in this sample; not established as applicable to the different shipped function"
+ },
+ {
+ "id": "bsd-forum-erfinv",
+ "url": "https://forums.developer.nvidia.com/t/61961/1",
+ "apiUrl": "https://forums.developer.nvidia.com/t/61961.json",
+ "postId": 300099,
+ "postVersion": 1,
+ "updatedAt": "2020-05-06T17:35:53.152Z",
+ "projection": "longest code element in post_stream.posts[0].cooked, HTML-decoded, UTF-8 encoded",
+ "sha256": "d477d7ecfc31535ae74560c87d04713b749ea2750654845233f368f4ab81cbe6",
+ "retainedPath": "req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt",
+ "disposition": "BSD-2-Clause grant in this sample; not established as applicable to the different shipped function"
+ },
+ {
+ "id": "cephes-email",
+ "url": "https://lists.debian.org/debian-legal/2004/12/msg00295.html",
+ "projection": "complete HTML response bytes at review time",
+ "sha256": "3a9f8b9032e320544df870e7706b7fc69184c1058c187aaddd74dc0302a071d7",
+ "retainedPath": null,
+ "note": "Live page may change; hash identifies the reviewed response, not an immutable upstream URL. Full HTML is not committed; retain citations rather than a new redistribution of correspondence or site content."
+ },
+ {
+ "id": "cephes-followup",
+ "url": "https://lists.debian.org/debian-legal/2004/12/msg00297.html",
+ "projection": "complete HTML response bytes at review time",
+ "sha256": "5339e44536e481f05e7717527625f43464f9b1600f07a5f13e5d2aed6843f9cb",
+ "retainedPath": null,
+ "note": "Live page may change; hash identifies the reviewed response, not an immutable upstream URL. Full HTML is not committed; retain citations rather than a new redistribution of correspondence or site content."
+ },
+ {
+ "id": "cc-legalcode",
+ "url": "https://creativecommons.org/licenses/by-sa/4.0/legalcode.en",
+ "projection": "complete HTML response bytes at review time",
+ "sha256": "47c0a954c88d793bdefe92fb007ae3c038fb3807f1a27083433d01aa7542c0d8",
+ "retainedPath": null,
+ "note": "Live page may change; hash identifies the reviewed response, not an immutable upstream URL. Full HTML is not committed; retain citations rather than a new redistribution of correspondence or site content."
+ },
+ {
+ "id": "cc-faq",
+ "url": "https://creativecommons.org/faq/",
+ "projection": "complete HTML response bytes at review time",
+ "sha256": "d4ffb015ad13ce12eb060979abf835caa5c2ce2ef5d928e6af1885845db99c02",
+ "retainedPath": null,
+ "note": "Live page may change; hash identifies the reviewed response, not an immutable upstream URL. Full HTML is not committed; retain citations rather than a new redistribution of correspondence or site content."
+ },
+ {
+ "id": "erf-answer-comments",
+ "url": "https://api.stackexchange.com/2.3/answers/35148199/comments?site=stackoverflow&filter=withbody&pagesize=100",
+ "projection": "ordered records containing comment_id, creation_date, body, owner.user_id",
+ "sha256": "6e71966d58d42b16ab61817b37ea595fe03e2acfb33f66129842af459787b45b",
+ "count": 16,
+ "hasMore": false,
+ "licenseKeywordMatch": false,
+ "retainedPath": null,
+ "disposition": "No licensing keyword matched in these fetched comments; this is a bounded observation, not proof that no grant exists elsewhere."
+ },
+ {
+ "id": "erfinv-answer-comments",
+ "url": "https://api.stackexchange.com/2.3/answers/49743348/comments?site=stackoverflow&filter=withbody&pagesize=100",
+ "projection": "ordered records containing comment_id, creation_date, body, owner.user_id",
+ "sha256": "a3d35031fe28152f103a3cfc43c51e95220e32a3500f1bbd90f269fc723dbbdc",
+ "count": 6,
+ "hasMore": false,
+ "licenseKeywordMatch": false,
+ "retainedPath": null,
+ "disposition": "No licensing keyword matched in these fetched comments; this is a bounded observation, not proof that no grant exists elsewhere."
+ }
+ ],
+ "codeComparison": "req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json",
+ "codeComparisonSha256": "b6497c840640ed9069b50e23f6e464b1a434f737fa623cb96686f975fa31d7dd",
+ "unresolvedFindingIds": [
+ "NATIVE-LICENSE-1",
+ "NATIVE-LICENSE-2"
+ ],
+ "nativePinsAndPayloadChanged": false,
+ "thirdPartyContactMade": false,
+ "validation": {
+ "lexicalComparisons": "five expected true/false results confirmed",
+ "sourceScope": "Pinned MLX files hash-match the committed audit; source comments fetched completely for both specific Stack Overflow answers. Forum code samples retain their explicit BSD text.",
+ "auditExitCode": 1,
+ "auditResultEqualsFollowupEvidence": true,
+ "auditEvidencePath": "req/plans/evidence/native-license-audit-2026-11-16/followup-source-verification.json",
+ "auditEvidenceSha256": "e6f34e6d83d1e387956728cf14eda4f6fe46fd1e9d8f9bfc6eb6fd759f37e1c9",
+ "releaseReady": false,
+ "sourceUrlDigestPairs": 57,
+ "sourceChecks": "All MLX comparison input file hashes and both Stack Overflow body hashes match the committed audit.",
+ "nativeAndArtifactHashesMatchMergedAudit": true
+ },
+ "upstreamHistory": {
+ "source": "https://api.github.com/repos/ml-explore/mlx/commits?path=mlx/backend/metal/kernels/erf.h&per_page=100&sha=36969c094354086e15d2a327a9c50feb20b9cf11",
+ "commits": [
+ {
+ "sha": "634b148dd4203f80b8cc8db3e33452a91785fad8",
+ "subject": "Optimize erf function with expm1f in Metal backend (#3025)"
+ },
+ {
+ "sha": "226748b3e7f280e204c1af61b031588853e4ad88",
+ "subject": "JIT compile option for binary minimization (#1091)"
+ },
+ {
+ "sha": "46a39e5b1ff92d93833d9710ef64db207ce274ea",
+ "subject": "copyright + ack"
+ },
+ {
+ "sha": "d1f86272a27b5a0729378ac75bb03727c7c0e553",
+ "subject": "angelos's commit files"
+ }
+ ],
+ "latestPullRequest": "https://github.com/ml-explore/mlx/pull/3025",
+ "latestPullRequestCommentsChecked": "https://api.github.com/repos/ml-explore/mlx/issues/3025/comments",
+ "latestPullRequestCommentCountAtReview": 0,
+ "disposition": "The latest PR describes a numerical substitution, not a grant for the other functions; public file history alone does not establish a separate permission record."
+ },
+ "retainedFiles": {
+ "req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json": "b6497c840640ed9069b50e23f6e464b1a434f737fa623cb96686f975fa31d7dd",
+ "req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt": "cf24268b5b339f51c4e271223354fcf6906369f3bec318d0f19e841187cceded",
+ "req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt": "d477d7ecfc31535ae74560c87d04713b749ea2750654845233f368f4ab81cbe6",
+ "req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md": "cf27edbab32784ece7938ed9fb5a6e29ec39b756334d0677b004a40ad8ae32a6"
+ }
+}
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md b/req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md
new file mode 100644
index 00000000..966ab4b7
--- /dev/null
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md
@@ -0,0 +1,35 @@
+# Draft provenance request to MLX maintainers
+
+Prepared 2026-11-16 for owner review; not posted or sent. Review the current upstream
+contribution guidance and adapt the wording before submission.
+
+Suggested title: Licensing provenance for error-function and CPU SIMD adaptations
+
+We are preparing jmlx's first distribution of a macOS ARM64 native artifact containing the
+`mlx-metal` 0.32.4 wheel and mlx-c. Our review uses MLX commit
+`36969c094354086e15d2a327a9c50feb20b9cf11` and wheel SHA-256
+`514df92d41a286895d2564b4b18f4da45096bd7a4a0c47e1042f345ad5a7f936`.
+Could you point us to the applicable permission/provenance records for two adaptations?
+
+1. [`mlx/backend/metal/kernels/erf.h`](https://github.com/ml-explore/mlx/blob/36969c094354086e15d2a327a9c50feb20b9cf11/mlx/backend/metal/kernels/erf.h)
+ cites [Juffa's error-function answer](https://stackoverflow.com/a/35148199).
+ The inverse-function coefficients also match
+ [his inverse-error-function answer](https://stackoverflow.com/a/49743348), including
+ the CPU version in
+ [`mlx/backend/cpu/simd/math.h`](https://github.com/ml-explore/mlx/blob/36969c094354086e15d2a327a9c50feb20b9cf11/mlx/backend/cpu/simd/math.h).
+ The answer records currently declare CC BY-SA 4.0. We found Juffa's BSD-licensed
+ NVIDIA forum samples, but those have different coefficients/evaluations. Is there an
+ alternative grant covering the exact versions incorporated in MLX, or guidance on
+ attribution and licensing of these adaptations in distributed dylibs and Metal kernels?
+ We are not assuming that `expm1f.h`'s BSD notice covers the other functions.
+
+2. The same CPU SIMD header traces its exponential and sine/cosine approximations through
+ fastermath and NEON math to Cephes. We retain the immediate BSD/zlib notices and the
+ [original Cephes permission statement](https://www.netlib.org/cephes/readme).
+ Can you identify the licensed source distribution or permission record covering this
+ particular provenance chain, including any additional attribution required downstream?
+
+We are seeking clarification to package accurate notices and terms, not asserting a
+license violation. If another rights holder must answer part of this, a pointer to the
+appropriate provenance/contact route would help. We are holding our native publication
+while these two questions remain open.
From 75ce00c8dedfc5379a3af17099b567363bedd508 Mon Sep 17 00:00:00 2001
From: Per Nyfelt
Date: Mon, 16 Nov 2026 17:29:47 +0100
Subject: [PATCH 2/7] Normalize retained sample whitespace and record original
digests
---
req/phase8-4-native-license-resolution.md | 2 ++
.../code-comparison.json | 12 +++++-----
.../juffa-erf-bsd-sample.txt | 16 +++++++-------
.../juffa-erfinv-bsd-sample.txt | 14 ++++++------
.../research.json | 22 ++++++++++---------
5 files changed, 35 insertions(+), 31 deletions(-)
diff --git a/req/phase8-4-native-license-resolution.md b/req/phase8-4-native-license-resolution.md
index 8ce6eef8..54f40c50 100644
--- a/req/phase8-4-native-license-resolution.md
+++ b/req/phase8-4-native-license-resolution.md
@@ -20,6 +20,8 @@ Juffa published explicit BSD-2-Clause code in his NVIDIA forum posts for
and [`erfinvf`](https://forums.developer.nvidia.com/t/a-very-compact-implementation-of-the-inverse-error-function-erfinvf/61961/1).
The captured code samples retain their complete copyright, conditions and disclaimer under
the [evidence directory](plans/evidence/native-license-resolution-2026-11-16/).
+Only trailing whitespace is removed and a final LF is retained; the manifest records the
+raw extracted-code hash separately from each normalized retained sample's hash.
| Material | Shipped MLX version | BSD forum sample | Result |
| --- | --- | --- | --- |
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json b/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json
index 8a54e9b6..5740d996 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json
@@ -151,10 +151,10 @@
{
"id": "bsd-forum-erf",
"source": "https://forums.developer.nvidia.com/t/40977/1",
- "inputSha256": "cf24268b5b339f51c4e271223354fcf6906369f3bec318d0f19e841187cceded",
- "inputProjection": "longest HTML code element decoded as UTF-8",
+ "inputSha256": "2bb462ea7debd5deb0b069b6218061e8dcd37cc9dc020e790338082a1fbff09c",
+ "inputProjection": "longest code element in post_stream.posts[0].cooked, HTML-decoded, UTF-8 encoded; strip trailing whitespace from each line and keep one final LF",
"function": "my_erff",
- "functionSha256": "3496fe833efeb5128f4f2b9babd5a73dadc1f0bf463380b1fddfacbca18d954a",
+ "functionSha256": "7ee5db9c2e6f12b81d400f9577970fd69800c84a5a281b6c826997eadc597b1f",
"decimalFloatingLiterals": [
"1.0",
"0.0000258907676",
@@ -176,10 +176,10 @@
{
"id": "bsd-forum-erfinv",
"source": "https://forums.developer.nvidia.com/t/61961/1",
- "inputSha256": "d477d7ecfc31535ae74560c87d04713b749ea2750654845233f368f4ab81cbe6",
- "inputProjection": "longest HTML code element decoded as UTF-8",
+ "inputSha256": "8f1c6fa6aabff58fd6138bb8b2b8e9e6cef2598966ac49dd8f05a592309063c3",
+ "inputProjection": "longest code element in post_stream.posts[0].cooked, HTML-decoded, UTF-8 encoded; strip trailing whitespace from each line and keep one final LF",
"function": "my_erfinvf",
- "functionSha256": "c036166484743da16caa5282cf88af487cd5d81c94f2cb74275d641f304c3a39",
+ "functionSha256": "4ab5badc979ec2e31c22aef0491834dcc85226ce4fa636c1e493c86f44c9b715",
"decimalFloatingLiterals": [
"1.0",
"-8.8359375",
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt b/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt
index 2ec4ce68..fdd58019 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt
@@ -2,26 +2,26 @@
Copyright (c) 2016-2021, Norbert Juffa
All rights reserved.
- Redistribution and use in source and binary forms, with or without
+ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- 1. Redistributions of source code must retain the above copyright
+ 1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@@ -30,7 +30,7 @@
__device__ float my_erff (float a)
{
float r, s, t, u;
-
+
t = fabsf (a);
s = a * a;
if (t > 1.0f) {
@@ -57,6 +57,6 @@ __device__ float my_erff (float a)
r = fmaf (r, s, -3.76123011e-1f); // -0x1.812664p-2
r = fmaf (r, s, 1.28379121e-1f); // 0x1.06eba2p-3
r = fmaf (r, a, a);
- }
+ }
return r;
}
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt b/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt
index e6c55bd3..56a60a53 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt
@@ -2,26 +2,26 @@
Copyright (c) 2017-2018, Norbert Juffa
All rights reserved.
- Redistribution and use in source and binary forms, with or without
+ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- 1. Redistributions of source code must retain the above copyright
+ 1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@@ -55,6 +55,6 @@ __device__ float my_erfinvf (float a)
p = fmaf (p, t, -1.60820886e-01f); // -0x1.495c76p-3
p = fmaf (p, t, 8.86226892e-01f); // 0x1.c5bf88p-1
r = a * p;
- }
+ }
return r;
}
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/research.json b/req/plans/evidence/native-license-resolution-2026-11-16/research.json
index 085f2970..6f916389 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/research.json
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/research.json
@@ -12,10 +12,11 @@
"postId": 190213,
"postVersion": 2,
"updatedAt": "2021-11-12T23:16:50.729Z",
- "projection": "longest code element in post_stream.posts[0].cooked, HTML-decoded, UTF-8 encoded",
- "sha256": "cf24268b5b339f51c4e271223354fcf6906369f3bec318d0f19e841187cceded",
+ "projection": "longest code element in post_stream.posts[0].cooked, HTML-decoded, UTF-8 encoded; strip trailing whitespace from each line and keep one final LF",
+ "sha256": "2bb462ea7debd5deb0b069b6218061e8dcd37cc9dc020e790338082a1fbff09c",
"retainedPath": "req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt",
- "disposition": "BSD-2-Clause grant in this sample; not established as applicable to the different shipped function"
+ "disposition": "BSD-2-Clause grant in this sample; not established as applicable to the different shipped function",
+ "rawCodeSha256": "cf24268b5b339f51c4e271223354fcf6906369f3bec318d0f19e841187cceded"
},
{
"id": "bsd-forum-erfinv",
@@ -24,10 +25,11 @@
"postId": 300099,
"postVersion": 1,
"updatedAt": "2020-05-06T17:35:53.152Z",
- "projection": "longest code element in post_stream.posts[0].cooked, HTML-decoded, UTF-8 encoded",
- "sha256": "d477d7ecfc31535ae74560c87d04713b749ea2750654845233f368f4ab81cbe6",
+ "projection": "longest code element in post_stream.posts[0].cooked, HTML-decoded, UTF-8 encoded; strip trailing whitespace from each line and keep one final LF",
+ "sha256": "8f1c6fa6aabff58fd6138bb8b2b8e9e6cef2598966ac49dd8f05a592309063c3",
"retainedPath": "req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt",
- "disposition": "BSD-2-Clause grant in this sample; not established as applicable to the different shipped function"
+ "disposition": "BSD-2-Clause grant in this sample; not established as applicable to the different shipped function",
+ "rawCodeSha256": "d477d7ecfc31535ae74560c87d04713b749ea2750654845233f368f4ab81cbe6"
},
{
"id": "cephes-email",
@@ -85,7 +87,7 @@
}
],
"codeComparison": "req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json",
- "codeComparisonSha256": "b6497c840640ed9069b50e23f6e464b1a434f737fa623cb96686f975fa31d7dd",
+ "codeComparisonSha256": "4dcd736c873b74a26597b3be0a8a56316771788a3cecf1676f3fa0b6fb68cfe5",
"unresolvedFindingIds": [
"NATIVE-LICENSE-1",
"NATIVE-LICENSE-2"
@@ -130,9 +132,9 @@
"disposition": "The latest PR describes a numerical substitution, not a grant for the other functions; public file history alone does not establish a separate permission record."
},
"retainedFiles": {
- "req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json": "b6497c840640ed9069b50e23f6e464b1a434f737fa623cb96686f975fa31d7dd",
- "req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt": "cf24268b5b339f51c4e271223354fcf6906369f3bec318d0f19e841187cceded",
- "req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt": "d477d7ecfc31535ae74560c87d04713b749ea2750654845233f368f4ab81cbe6",
+ "req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json": "4dcd736c873b74a26597b3be0a8a56316771788a3cecf1676f3fa0b6fb68cfe5",
+ "req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt": "2bb462ea7debd5deb0b069b6218061e8dcd37cc9dc020e790338082a1fbff09c",
+ "req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt": "8f1c6fa6aabff58fd6138bb8b2b8e9e6cef2598966ac49dd8f05a592309063c3",
"req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md": "cf27edbab32784ece7938ed9fb5a6e29ec39b756334d0677b004a40ad8ae32a6"
}
}
From e4aeb1ba6ea80540560b2b0bde052dc3ddbc4a4b Mon Sep 17 00:00:00 2001
From: Per Nyfelt
Date: Mon, 16 Nov 2026 17:56:56 +0100
Subject: [PATCH 3/7] Track upstream MLX license provenance request 4902
---
req/phase8-4-implementation-report.md | 4 +++-
req/phase8-4-native-license-audit.md | 3 ++-
req/phase8-4-native-license-resolution.md | 18 ++++++++++--------
req/phase8-4-release-checklist.md | 4 +++-
.../research.json | 18 +++++++++++++++---
.../upstream-issue.json | 9 +++++++++
.../upstream-request-draft.md | 5 +++--
7 files changed, 45 insertions(+), 16 deletions(-)
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/upstream-issue.json
diff --git a/req/phase8-4-implementation-report.md b/req/phase8-4-implementation-report.md
index 59e14f80..6644b33c 100644
--- a/req/phase8-4-implementation-report.md
+++ b/req/phase8-4-implementation-report.md
@@ -123,7 +123,9 @@ remain open and `--require-clear` still exits 1.
The [license resolution investigation](phase8-4-native-license-resolution.md) follows
PR #100's merge on 2026-11-16. It retains Juffa's explicitly BSD-licensed forum samples,
records their differences from the shipped implementations, reviews the original Cephes
-correspondence and prepares an unsent provenance request. It does not establish an additional
+correspondence and prepares a provenance request. The owner subsequently submitted
+[MLX issue #4902](https://github.com/ml-explore/mlx/issues/4902), which has no comments at this
+check. The investigation and submission do not establish an additional
grant or close either legal finding. Validation confirms the comparison inputs and retained
file hashes and reproduces the unchanged audit result (57 URL/digest pairs, releaseReady false,
expected exit 1). This follow-up changes only documentation and research evidence; the 74-test
diff --git a/req/phase8-4-native-license-audit.md b/req/phase8-4-native-license-audit.md
index 50166be8..7a1c9bb0 100644
--- a/req/phase8-4-native-license-audit.md
+++ b/req/phase8-4-native-license-audit.md
@@ -94,7 +94,8 @@ libraries to the reviewed bundle.
## Open findings
The [resolution investigation](phase8-4-native-license-resolution.md) records primary-source
-follow-up, comparisons with Juffa's BSD samples and an unsent request for upstream provenance.
+follow-up, comparisons with Juffa's BSD samples and the owner's submitted
+[upstream provenance request #4902](https://github.com/ml-explore/mlx/issues/4902).
It supplies review material; both findings below remain open.
### NATIVE-LICENSE-1: Juffa `erf` / `erfinv` provenance
diff --git a/req/phase8-4-native-license-resolution.md b/req/phase8-4-native-license-resolution.md
index 54f40c50..457860fb 100644
--- a/req/phase8-4-native-license-resolution.md
+++ b/req/phase8-4-native-license-resolution.md
@@ -8,10 +8,12 @@ The next release step is an owner/legal decision on the two findings in the
sources, but did not establish an applicable additional grant for the shipped code.
Both findings and the license release gate remain open.
-The recommended next action is to ask MLX maintainers for the relevant provenance and
-permission records, using the [prepared request](plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md)
-after owner review. No request has been posted or sent. Native code, pins, bindings, notices,
-artifact hashes and the publication flow are unchanged.
+The owner submitted [MLX issue #4902](https://github.com/ml-explore/mlx/issues/4902) on
+2026-11-16, covering both provenance questions. It is open with no comments at this check;
+the next action is to review any upstream response against the exact code and license terms.
+The [prepared request](plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md)
+is retained as a historical draft; the owner posted an adapted version. Native code, pins,
+bindings, notices, artifact hashes and the publication flow are unchanged.
## Juffa implementations: the BSD samples differ
@@ -116,7 +118,7 @@ results and every retained sample/report digest. The unchanged audit command sti
the same result as PR #100's follow-up evidence, including `releaseReady: false` and both
finding IDs; `--require-clear` exits 1. No new runtime test or legal clearance is claimed.
-Posting the prepared request is a separate third-party communication and requires the owner's
-explicit instruction. The draft asks for provenance rather than asserting an upstream license
-violation. A subsequent response must be reviewed against the actual code and bundle before
-either finding is removed from the release gate.
+The owner posted the provenance request as `perNyfelt` at `2026-11-16T16:54:53Z`.
+The assistant did not post an issue or comment. The request asks for provenance rather than
+asserting an upstream license violation. A subsequent response must be reviewed against the
+actual code and bundle before either finding is removed from the release gate.
diff --git a/req/phase8-4-release-checklist.md b/req/phase8-4-release-checklist.md
index 5b7b372b..eec67135 100644
--- a/req/phase8-4-release-checklist.md
+++ b/req/phase8-4-release-checklist.md
@@ -42,7 +42,9 @@ BellSoft 21.0.12.1; the matching-toolchain audit reproduces every JAR exactly. T
inventory to 26 entries. Two provenance findings (Juffa `erf`/`erfinv` and Cephes)
still prevent closing this gate; successful notice checks do not resolve them.
The [resolution review](phase8-4-native-license-resolution.md) compares alternative BSD
- samples and original permission correspondence and prepares an unsent upstream request.
+ samples and original permission correspondence. The owner submitted
+ [MLX issue #4902](https://github.com/ml-explore/mlx/issues/4902); awaiting an upstream response
+ and review of any applicable grant or compliance decision.
- [ ] Verify current official Portal size limits/accounting against actual signed bundle.
- [x] Integrate released upstream plugin 2.6.0 and verify the clean historical 8.1 fixture.
[Compatibility evidence](phase8-4-plugin-2.6.0-compatibility.md) records the unpushed scratch
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/research.json b/req/plans/evidence/native-license-resolution-2026-11-16/research.json
index 6f916389..2cfd54c5 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/research.json
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/research.json
@@ -2,7 +2,7 @@
"schema": 1,
"date": "2026-11-16",
"baselineSha": "ee807c99e89f06f63ef326e2bbb976b7cb247989",
- "status": "owner-legal-review-required",
+ "status": "awaiting-upstream-response-and-owner-legal-review",
"releaseGateClosed": false,
"sources": [
{
@@ -93,7 +93,7 @@
"NATIVE-LICENSE-2"
],
"nativePinsAndPayloadChanged": false,
- "thirdPartyContactMade": false,
+ "thirdPartyContactMade": true,
"validation": {
"lexicalComparisons": "five expected true/false results confirmed",
"sourceScope": "Pinned MLX files hash-match the committed audit; source comments fetched completely for both specific Stack Overflow answers. Forum code samples retain their explicit BSD text.",
@@ -135,6 +135,18 @@
"req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json": "4dcd736c873b74a26597b3be0a8a56316771788a3cecf1676f3fa0b6fb68cfe5",
"req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt": "2bb462ea7debd5deb0b069b6218061e8dcd37cc9dc020e790338082a1fbff09c",
"req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt": "8f1c6fa6aabff58fd6138bb8b2b8e9e6cef2598966ac49dd8f05a592309063c3",
- "req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md": "cf27edbab32784ece7938ed9fb5a6e29ec39b756334d0677b004a40ad8ae32a6"
+ "req/plans/evidence/native-license-resolution-2026-11-16/upstream-issue.json": "7fedbe67a65c707f1497c92f5bd8767e5400d7a7eb572819143ef898690b298b",
+ "req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md": "bacd91b6ba82ea6b64f350eadffa9b2e1844e7328081dc594874e5a0249aaa55"
+ },
+ "thirdPartyContact": {
+ "url": "https://github.com/ml-explore/mlx/issues/4902",
+ "number": 4902,
+ "title": "Licensing provenance for error-function and CPU SIMD adaptations",
+ "author": "perNyfelt",
+ "createdAt": "2026-11-16T16:54:53Z",
+ "stateAtCheck": "open",
+ "commentsAtCheck": 0,
+ "actor": "owner",
+ "assistantPosted": false
}
}
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/upstream-issue.json b/req/plans/evidence/native-license-resolution-2026-11-16/upstream-issue.json
new file mode 100644
index 00000000..72c4415f
--- /dev/null
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/upstream-issue.json
@@ -0,0 +1,9 @@
+{
+ "url": "https://github.com/ml-explore/mlx/issues/4902",
+ "number": 4902,
+ "title": "Licensing provenance for error-function and CPU SIMD adaptations",
+ "author": "perNyfelt",
+ "createdAt": "2026-11-16T16:54:53Z",
+ "stateAtCheck": "open",
+ "commentsAtCheck": 0
+}
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md b/req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md
index 966ab4b7..cc0c2774 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md
@@ -1,7 +1,8 @@
# Draft provenance request to MLX maintainers
-Prepared 2026-11-16 for owner review; not posted or sent. Review the current upstream
-contribution guidance and adapt the wording before submission.
+Historical draft prepared 2026-11-16 for owner review. The owner submitted an adapted version
+as [MLX issue #4902](https://github.com/ml-explore/mlx/issues/4902) at 16:54:53 UTC that day.
+This file preserves the preparation draft, not the posted issue's exact wording.
Suggested title: Licensing provenance for error-function and CPU SIMD adaptations
From 5a8aa2f66ff6be3647b9c75af897538551981515 Mon Sep 17 00:00:00 2001
From: Per Nyfelt
Date: Mon, 16 Nov 2026 18:09:56 +0100
Subject: [PATCH 4/7] Make native license research projections reproducible
---
req/phase8-4-implementation-report.md | 10 +-
req/phase8-4-native-license-resolution.md | 46 +++-
.../code-comparison.json | 6 +-
.../compare_literals.py | 208 ++++++++++++++++++
.../reproduction-result.json | 24 ++
.../research.json | 65 +++++-
.../review-release-selftests.log | 84 +++++++
.../tests/test_license_resolution.py | 92 ++++++++
8 files changed, 522 insertions(+), 13 deletions(-)
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/reproduction-result.json
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/review-release-selftests.log
create mode 100644 tools/release-all/tests/test_license_resolution.py
diff --git a/req/phase8-4-implementation-report.md b/req/phase8-4-implementation-report.md
index 6644b33c..6a6963d0 100644
--- a/req/phase8-4-implementation-report.md
+++ b/req/phase8-4-implementation-report.md
@@ -128,9 +128,17 @@ correspondence and prepares a provenance request. The owner subsequently submitt
check. The investigation and submission do not establish an additional
grant or close either legal finding. Validation confirms the comparison inputs and retained
file hashes and reproduces the unchanged audit result (57 URL/digest pairs, releaseReady false,
-expected exit 1). This follow-up changes only documentation and research evidence; the 74-test
+expected exit 1). The initial investigation changed only documentation and research evidence;
+the 74-test
and native Gradle results above remain evidence for PR #100's implementation, not a new run.
+PR #101 review corrections commit the dated `compare_literals.py` verifier and record its
+digest, exact comment record shape/JSON serialization and function/literal extraction rules.
+Fresh downloads reproduce the original two comment hashes and all five comparison results;
+offline replay produces the identical report. The scope now explicitly excludes PyTorch-derived
+CPU `erf` from the Juffa comparison. Five new regressions bring release selftests to 79, all
+passing in 49.296 seconds. Native code/notices and both open legal findings are unchanged.
+
## Review corrections (2026-11-15)
The minimum-host workflow now creates its Gradle home through `GITHUB_ENV` at step scope;
diff --git a/req/phase8-4-native-license-resolution.md b/req/phase8-4-native-license-resolution.md
index 457860fb..125ac7c8 100644
--- a/req/phase8-4-native-license-resolution.md
+++ b/req/phase8-4-native-license-resolution.md
@@ -17,6 +17,10 @@ bindings, notices, artifact hashes and the publication flow are unchanged.
## Juffa implementations: the BSD samples differ
+CPU `erf` is outside this Juffa comparison: its SIMD implementation cites PyTorch's
+Abramowitz–Stegun approximation and is already covered by the packaged PyTorch notice.
+The Juffa scope is Metal `erf` and Metal/CPU `erfinv`, rather than every function in `simd/math.h`.
+
Juffa published explicit BSD-2-Clause code in his NVIDIA forum posts for
[`erff`](https://forums.developer.nvidia.com/t/optimized-version-of-single-precision-error-function-erff/40977/1)
and [`erfinvf`](https://forums.developer.nvidia.com/t/a-very-compact-implementation-of-the-inverse-error-function-erfinvf/61961/1).
@@ -106,13 +110,49 @@ Only the two explicitly BSD-licensed samples and derived comparison facts are re
Stack Overflow answer bodies and correspondence HTML are referenced rather than recopied.
The original audit retains the Stack Overflow body hashes and licenses.
-Comparison method: extract the named function using balanced braces from these particular
-inputs, strip C/C++ comments, collect signed decimal floating literals, remove `f`/`F` suffixes
-and normalize with Python's `decimal.Decimal`. The comparison does not parse arbitrary C++
+Comparison method: extract text starting at the function name (excluding the return type),
+through its balanced closing brace, from these particular inputs. Strip C/C++ comments,
+collect decimal floating literals, remove `f`/`F` suffixes and normalize with Python's
+`decimal.Decimal`. An optional plus/minus sign is included only when directly attached to
+the numeric token, as specified by `FLOAT_LITERAL_PATTERN` in the committed script.
+A separated minus sign is not treated as part of the literal. The comparison does not parse
+arbitrary C++
and excludes integer/hexadecimal literals. Code input hashes and all seven extracted function
hashes are recorded, so readers can check the exact variants being compared. The two BSD
samples are reference evidence only and are not built or added to the native artifacts.
+The committed [comparison and projection script](plans/evidence/native-license-resolution-2026-11-16/compare_literals.py)
+reproduces all seven function records, five checks and both comment-list hashes. From the
+repository root with Python 3.11+:
+
+```sh
+python3 req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py \
+ --inputs build/releaseAll/license-resolution-inputs --fetch-missing \
+ --output build/releaseAll/license-resolution-reproduction.json
+```
+
+The script downloads missing inputs into a URL/digest-bound cache; omit `--fetch-missing`
+to verify the cached responses offline. It checks the original audit's complete Stack Overflow
+answer-body hashes before extracting their longest HTML-decoded code blocks, and validates
+every function input/hash/literal record against `code-comparison.json`. The retained BSD
+samples need no download. Changed projected content fails with a contextual error.
+
+For each comment response, preserve the API `items` array order. Project each item to exactly
+`{"comment_id": item["comment_id"], "creation_date": item["creation_date"],
+"body": item["body"], "ownerUserId": item.get("owner", {}).get("user_id")}`.
+`body` remains the raw HTML string; the owner field is flattened to `ownerUserId`, and a
+missing owner/user ID becomes JSON null. Serialize the complete list as
+`json.dumps(records, sort_keys=True, separators=(",", ":"), ensure_ascii=True).encode("utf-8")`,
+with no trailing newline. Both original hashes are preserved. The manifest records this exact
+format and the script's digest. Partial comment pages are rejected rather than silently hashed.
+
+The review rerun reproduced both original comment hashes and all five checks from fresh
+downloads, then produced an identical report offline. Five focused regressions cover exact
+serialization/order, incomplete responses, function/sign boundaries, HTML/body extraction and
+URL-bound input integrity. All 79 release selftests passed (49.296 seconds); the research
+manifest retains the verifier/test digests and reproduction result. No native runtime code,
+notices, license findings or numerical implementations changed.
+
Validation checks source hashes against the existing audit, the five recorded comparison
results and every retained sample/report digest. The unchanged audit command still produces
the same result as PR #100's follow-up evidence, including `releaseReady: false` and both
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json b/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json
index 5740d996..87ce5380 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json
@@ -1,7 +1,7 @@
{
"schema": 1,
"date": "2026-11-16",
- "method": "Extract each named function by balanced braces from the captured, hash-identified input. Strip C/C++ comments, collect signed decimal floating literals in order, strip f/F suffixes and normalize with Python decimal.Decimal. Integer and hexadecimal literals are not included. This bounded lexical comparison is not a C++ parser, semantic equivalence proof or licensing determination.",
+ "method": "Extract text beginning at the function name (excluding return type), through its balanced closing brace. Strip C/C++ comments, collect decimal floating literals with the exact recorded regex, strip f/F suffixes and normalize with str(decimal.Decimal(token)). A sign is included only when directly attached to the token. Integer and hexadecimal literals are excluded. This bounded lexical comparison is not a C++ parser, semantic equivalence proof or licensing determination.",
"records": [
{
"id": "mlx-metal-erf",
@@ -212,5 +212,7 @@
"metalErfLiteralMultisetIsSubsetOfStackOverflow": true,
"bsdErfLiteralSequenceMatchesShipped": false,
"bsdInverseLiteralSequenceMatchesShipped": false
- }
+ },
+ "functionPattern": "\\b\\s*\\([^)]*\\)\\s*\\{",
+ "literalPattern": "(?© Björn
",
+ "owner": {"user_id": 7, "display_name": "ignored"}, "score": 12},
+ {"comment_id": 1, "creation_date": 10, "body": "plain"}]}
+ expected = (b'[{"body":"\\u00a9 Bj\\u00f6rn
","comment_id":2,"creation_date":20,'
+ b'"ownerUserId":7},{"body":"plain","comment_id":1,"creation_date":10,'
+ b'"ownerUserId":null}]')
+ self.assertEqual(C.comment_projection(json.dumps(document).encode("utf-8")), expected)
+ document["items"].reverse()
+ self.assertNotEqual(C.comment_projection(json.dumps(document).encode("utf-8")), expected)
+
+ def test_comment_projection_rejects_partial_or_malformed_responses(self):
+ documents = [[], {"error_id": 502}, {"has_more": True, "items": []},
+ {"items": []}, {"has_more": False, "items": None},
+ {"has_more": False, "items": [{"body": None}]},
+ {"has_more": False, "items": [{"body": "x", "owner": None}]}]
+ for document in documents:
+ with self.subTest(document=document), self.assertRaises(ValueError):
+ C.comment_projection(json.dumps(document).encode("utf-8"))
+
+ def test_extraction_starts_at_name_and_only_attached_signs_are_literals(self):
+ source = ("float sample(float a);\n"
+ "template float sample(float a) {\n"
+ " // ignored -9.0f\n if (a) { a = -1.0f + 2.0e-3F; }\n"
+ " return a - 3.0f + 4 + 0x12;\n}\nfloat other() { return 8.0f; }")
+ function = C.function_text(source, "sample")
+ self.assertTrue(function.startswith("sample(float a) {"))
+ self.assertTrue(function.endswith("}"))
+ self.assertNotIn("other", function)
+ self.assertEqual(C.literals(function), ["-1.0", "0.0020", "3.0"])
+ for source in ("float sample(float a);", "float sample(float a) { return 1.0f;"):
+ with self.subTest(source=source), self.assertRaises(ValueError):
+ C.function_text(source, "sample")
+
+ def test_answer_projection_decodes_longest_code_and_checks_full_body_digest(self):
+ body = "text
xfloat f() { return 1.0f < 2.0f; }
"
+ raw = json.dumps({"items": [{"body": body}]}).encode("utf-8")
+ self.assertEqual(C.answer_code(raw, C.digest(body.encode("utf-8"))),
+ b"float f() { return 1.0f < 2.0f; }")
+ with self.assertRaisesRegex(ValueError, "body differs"):
+ C.answer_code(raw, "0" * 64)
+ with self.assertRaisesRegex(ValueError, "unexpected Stack Exchange answer"):
+ C.answer_code(b'{"items":[]}', "0" * 64)
+
+ def test_url_bound_inputs_rehash_hits_and_never_cache_failed_projection(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ inputs = Path(temporary)
+ payload = b"example"
+ expected = hashlib.sha256(payload).hexdigest()
+ urls = ["https://example.invalid/one", "https://example.invalid/two"]
+ with patch.object(C.urllib.request, "urlopen", side_effect=[io.BytesIO(payload),
+ io.BytesIO(payload)]) as fetch:
+ for url in urls:
+ self.assertEqual(C.read_source(url, expected, lambda raw: raw, inputs, True), payload)
+ self.assertEqual(fetch.call_count, 2)
+ with patch.object(C.urllib.request, "urlopen", side_effect=AssertionError("unexpected fetch")):
+ for url in urls:
+ C.read_source(url, expected, lambda raw: raw, inputs, False)
+ for path in inputs.iterdir():
+ path.write_bytes(b"corrupt")
+ with self.assertRaisesRegex(ValueError, "projected source digest differs"):
+ C.read_source(urls[0], expected, lambda raw: raw, inputs, False)
+ with patch.object(C.urllib.request, "urlopen", return_value=io.BytesIO(b"wrong")):
+ with self.assertRaisesRegex(ValueError, "projected source digest differs"):
+ C.read_source("https://example.invalid/three", expected, lambda raw: raw, inputs, True)
+ self.assertEqual(len(list(inputs.iterdir())), 2)
+
+
+if __name__ == "__main__":
+ unittest.main()
From 19d3b76039c20fae43a3fcd6ff22397f49a89932 Mon Sep 17 00:00:00 2001
From: Per Nyfelt
Date: Mon, 16 Nov 2026 21:05:15 +0100
Subject: [PATCH 5/7] Clarify recipe limits and handle malformed research
evidence
---
req/phase8-4-implementation-report.md | 7 ++
req/phase8-4-native-license-resolution.md | 17 +++-
.../code-comparison.json | 2 +-
.../compare_literals.py | 8 +-
.../followup-release-selftests.log | 85 +++++++++++++++++++
.../research.json | 50 +++++++++--
.../tests/test_license_resolution.py | 38 ++++++++-
7 files changed, 192 insertions(+), 15 deletions(-)
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/followup-release-selftests.log
diff --git a/req/phase8-4-implementation-report.md b/req/phase8-4-implementation-report.md
index 6a6963d0..7e73ae68 100644
--- a/req/phase8-4-implementation-report.md
+++ b/req/phase8-4-implementation-report.md
@@ -139,6 +139,13 @@ offline replay produces the identical report. The scope now explicitly excludes
CPU `erf` from the Juffa comparison. Five new regressions bring release selftests to 79, all
passing in 49.296 seconds. Native code/notices and both open legal findings are unchanged.
+The recipe follow-up documents that exponent-only floating forms are excluded by the
+decimal-point pattern, with no such forms in the seven recorded function inputs. Missing
+research sources and unexpected evidence types now produce contextual CLI errors without
+tracebacks; the live selftest dependency on the dated recipe path is explicitly documented.
+All 80 release selftests passed (50.066 seconds), including six focused recipe tests.
+Cached-input replay preserves the original seven records, five checks and both comment hashes.
+
## Review corrections (2026-11-15)
The minimum-host workflow now creates its Gradle home through `GITHUB_ENV` at step scope;
diff --git a/req/phase8-4-native-license-resolution.md b/req/phase8-4-native-license-resolution.md
index 125ac7c8..ba92b404 100644
--- a/req/phase8-4-native-license-resolution.md
+++ b/req/phase8-4-native-license-resolution.md
@@ -115,9 +115,10 @@ through its balanced closing brace, from these particular inputs. Strip C/C++ co
collect decimal floating literals, remove `f`/`F` suffixes and normalize with Python's
`decimal.Decimal`. An optional plus/minus sign is included only when directly attached to
the numeric token, as specified by `FLOAT_LITERAL_PATTERN` in the committed script.
-A separated minus sign is not treated as part of the literal. The comparison does not parse
-arbitrary C++
-and excludes integer/hexadecimal literals. Code input hashes and all seven extracted function
+A separated minus sign is not treated as part of the literal. The pattern requires a decimal
+point, so exponent-only decimal floating forms such as `1e-5f` are also excluded; none occurs
+in the seven recorded function inputs. The comparison does not parse arbitrary C++ and
+excludes integer/hexadecimal literals. Code input hashes and all seven extracted function
hashes are recorded, so readers can check the exact variants being compared. The two BSD
samples are reference evidence only and are not built or added to the native artifacts.
@@ -131,6 +132,10 @@ python3 req/plans/evidence/native-license-resolution-2026-11-16/compare_literals
--output build/releaseAll/license-resolution-reproduction.json
```
+Release selftests import this dated recipe. Moving or archiving the evidence folder requires
+retaining the recipe or updating the test's `RECIPE` path and recorded evidence/verifier paths
+in the same change.
+
The script downloads missing inputs into a URL/digest-bound cache; omit `--fetch-missing`
to verify the cached responses offline. It checks the original audit's complete Stack Overflow
answer-body hashes before extracting their longest HTML-decoded code blocks, and validates
@@ -153,6 +158,12 @@ URL-bound input integrity. All 79 release selftests passed (49.296 seconds); the
manifest retains the verifier/test digests and reproduction result. No native runtime code,
notices, license findings or numerical implementations changed.
+The limits/error-handling follow-up documents the decimal-point requirement and adds a CLI
+regression for missing research source IDs and unexpected evidence value types. These failures
+now report `license comparison: …` without a traceback. Cached-input replay preserves all
+seven function records, five checks and both original comment hashes; the legal findings stay open.
+All 80 release selftests passed (50.066 seconds), including six focused recipe tests.
+
Validation checks source hashes against the existing audit, the five recorded comparison
results and every retained sample/report digest. The unchanged audit command still produces
the same result as PR #100's follow-up evidence, including `releaseReady: false` and both
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json b/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json
index 87ce5380..17fd6297 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json
@@ -1,7 +1,7 @@
{
"schema": 1,
"date": "2026-11-16",
- "method": "Extract text beginning at the function name (excluding return type), through its balanced closing brace. Strip C/C++ comments, collect decimal floating literals with the exact recorded regex, strip f/F suffixes and normalize with str(decimal.Decimal(token)). A sign is included only when directly attached to the token. Integer and hexadecimal literals are excluded. This bounded lexical comparison is not a C++ parser, semantic equivalence proof or licensing determination.",
+ "method": "Extract text beginning at the function name (excluding return type), through its balanced closing brace. Strip C/C++ comments, collect decimal floating literals with the exact recorded regex, strip f/F suffixes and normalize with str(decimal.Decimal(token)). A sign is included only when directly attached to the token. The pattern requires a decimal point: exponent-only forms such as 1e-5f are excluded, along with integer and hexadecimal literals. None of the seven recorded function inputs contains an exponent-only form. This bounded lexical comparison is not a C++ parser, semantic equivalence proof or licensing determination.",
"records": [
{
"id": "mlx-metal-erf",
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py b/req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py
index 75c31787..c9e5bb1e 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py
@@ -158,8 +158,12 @@ def verify(root, inputs, fetch_missing=False):
audit_sources = {entry["source"]: entry["sha256"] for entry in audit["sourceEvidence"]}
records, comments = [], []
for entry in expected["records"]:
+ if not isinstance(entry, dict) or not isinstance(entry.get("id"), str):
+ raise ValueError("comparison record must have a string id")
if entry["id"].startswith("bsd-forum-"):
- source = next(item for item in research["sources"] if item["id"] == entry["id"])
+ source = next((item for item in research["sources"] if item["id"] == entry["id"]), None)
+ if source is None:
+ raise ValueError(f"research source missing for comparison record: {entry['id']}")
data = (root / source["retainedPath"]).read_bytes()
if digest(data) != source["sha256"] or digest(data) != entry["inputSha256"]:
raise ValueError(f"retained BSD sample differs: {entry['id']}")
@@ -204,5 +208,5 @@ def main():
if __name__ == "__main__":
try:
main()
- except (ValueError, OSError, KeyError) as error:
+ except (ValueError, OSError, KeyError, TypeError) as error:
raise SystemExit(f"license comparison: {error}") from error
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/followup-release-selftests.log b/req/plans/evidence/native-license-resolution-2026-11-16/followup-release-selftests.log
new file mode 100644
index 00000000..806b8c29
--- /dev/null
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/followup-release-selftests.log
@@ -0,0 +1,85 @@
+test_main_checks_environment_before_consumer_or_output_creation (test_bundle_smoke.BundleSmokeTest.test_main_checks_environment_before_consumer_or_output_creation) ... ok
+test_main_explains_that_legacy_preliminary_records_must_be_regenerated (test_bundle_smoke.BundleSmokeTest.test_main_explains_that_legacy_preliminary_records_must_be_regenerated) ... ok
+test_minimum_host_accepts_patch_releases_and_rejects_other_minor_versions (test_bundle_smoke.BundleSmokeTest.test_minimum_host_accepts_patch_releases_and_rejects_other_minor_versions) ... ok
+test_minimum_host_requires_physical_arm64_and_complete_identity (test_bundle_smoke.BundleSmokeTest.test_minimum_host_requires_physical_arm64_and_complete_identity) ... ok
+test_other_macos_reports_require_at_least_supported_minor (test_bundle_smoke.BundleSmokeTest.test_other_macos_reports_require_at_least_supported_minor) ... ok
+test_task_outcomes_and_configuration_cache_reuse (test_collector.CollectorTest.test_task_outcomes_and_configuration_cache_reuse) ... ok
+test_class_and_documentation_changes_survive (test_compare_publications.ComparePublicationsTest.test_class_and_documentation_changes_survive) ... ok
+test_cli_require_equal_writes_report_and_returns_verdict (test_compare_publications.ComparePublicationsTest.test_cli_require_equal_writes_report_and_returns_verdict) ... ok
+test_dependency_and_gradle_provenance_changes_survive_normalization (test_compare_publications.ComparePublicationsTest.test_dependency_and_gradle_provenance_changes_survive_normalization) ... ok
+test_duplicate_archive_entries_are_rejected (test_compare_publications.ComparePublicationsTest.test_duplicate_archive_entries_are_rejected) ... ok
+test_expected_set_requires_all_five_files_per_module (test_compare_publications.ComparePublicationsTest.test_expected_set_requires_all_five_files_per_module) ... ok
+test_extra_artifact_is_rejected (test_compare_publications.ComparePublicationsTest.test_extra_artifact_is_rejected) ... ok
+test_missing_artifact_is_rejected (test_compare_publications.ComparePublicationsTest.test_missing_artifact_is_rejected) ... ok
+test_missing_metadata_fields_have_context (test_compare_publications.ComparePublicationsTest.test_missing_metadata_fields_have_context) ... ok
+test_nested_artifact_record_is_rejected (test_compare_publications.ComparePublicationsTest.test_nested_artifact_record_is_rejected) ... ok
+test_normalization_never_deflates_even_for_deflated_inputs (test_compare_publications.ComparePublicationsTest.test_normalization_never_deflates_even_for_deflated_inputs) ... ok
+test_only_archive_order_timestamps_and_matching_metadata_hashes_are_normalized (test_compare_publications.ComparePublicationsTest.test_only_archive_order_timestamps_and_matching_metadata_hashes_are_normalized) ... ok
+test_pom_and_module_formatting_differences_survive (test_compare_publications.ComparePublicationsTest.test_pom_and_module_formatting_differences_survive) ... ok
+test_publications_shape_is_validated (test_compare_publications.ComparePublicationsTest.test_publications_shape_is_validated) ... ok
+test_stale_metadata_cannot_be_blessed_by_recomputed_hashes (test_compare_publications.ComparePublicationsTest.test_stale_metadata_cannot_be_blessed_by_recomputed_hashes) ... ok
+test_unexpected_url_record_is_rejected (test_compare_publications.ComparePublicationsTest.test_unexpected_url_record_is_rejected) ... ok
+test_wrong_checksum_is_rejected_even_when_size_matches (test_compare_publications.ComparePublicationsTest.test_wrong_checksum_is_rejected_even_when_size_matches) ... ok
+test_zip_metadata_differences_survive (test_compare_publications.ComparePublicationsTest.test_zip_metadata_differences_survive) ... ok
+test_actual_plugin_bundle_replacement_is_rejected_even_if_receipt_copy_is_verified (test_final_receipt.FinalReceiptTest.test_actual_plugin_bundle_replacement_is_rejected_even_if_receipt_copy_is_verified) ... ok
+test_all_macos_acceptance_reports_require_supported_os (test_final_receipt.FinalReceiptTest.test_all_macos_acceptance_reports_require_supported_os) ... ok
+test_cached_task_cannot_claim_passed (test_final_receipt.FinalReceiptTest.test_cached_task_cannot_claim_passed) ... ok
+test_final_valid_and_preliminary_rejected (test_final_receipt.FinalReceiptTest.test_final_valid_and_preliminary_rejected) ... ok
+test_minimum_host_requires_supported_minor_and_accepts_patch_releases (test_final_receipt.FinalReceiptTest.test_minimum_host_requires_supported_minor_and_accepts_patch_releases) ... ok
+test_missing_reports_changed_plan_and_logs_block_upload (test_final_receipt.FinalReceiptTest.test_missing_reports_changed_plan_and_logs_block_upload) ... ok
+test_plugin_digests_are_reviewed_record_anchors_after_full_verification (test_final_receipt.FinalReceiptTest.test_plugin_digests_are_reviewed_record_anchors_after_full_verification) ... ok
+test_plugin_digests_cli_stdout_contract (test_final_receipt.FinalReceiptTest.test_plugin_digests_cli_stdout_contract) ... ok
+test_real_bundle_check_does_not_authorize_a_different_plugin_upload_file (test_final_receipt.FinalReceiptTest.test_real_bundle_check_does_not_authorize_a_different_plugin_upload_file) ... ok
+test_receipt_cannot_select_a_different_upload_path (test_final_receipt.FinalReceiptTest.test_receipt_cannot_select_a_different_upload_path) ... ok
+test_report_cannot_invent_runtime_properties (test_final_receipt.FinalReceiptTest.test_report_cannot_invent_runtime_properties) ... ok
+test_answer_projection_decodes_longest_code_and_checks_full_body_digest (test_license_resolution.LicenseResolutionTest.test_answer_projection_decodes_longest_code_and_checks_full_body_digest) ... ok
+test_cli_reports_missing_sources_and_unexpected_json_types_without_tracebacks (test_license_resolution.LicenseResolutionTest.test_cli_reports_missing_sources_and_unexpected_json_types_without_tracebacks) ... ok
+test_comment_projection_has_exact_ascii_serialization_and_api_order (test_license_resolution.LicenseResolutionTest.test_comment_projection_has_exact_ascii_serialization_and_api_order) ... ok
+test_comment_projection_rejects_partial_or_malformed_responses (test_license_resolution.LicenseResolutionTest.test_comment_projection_rejects_partial_or_malformed_responses) ... ok
+test_extraction_starts_at_name_and_only_attached_signs_are_literals (test_license_resolution.LicenseResolutionTest.test_extraction_starts_at_name_and_only_attached_signs_are_literals) ... ok
+test_url_bound_inputs_rehash_hits_and_never_cache_failed_projection (test_license_resolution.LicenseResolutionTest.test_url_bound_inputs_rehash_hits_and_never_cache_failed_projection) ... ok
+test_all_three_artifacts_require_every_reviewed_text (test_native_licenses.NativeLicensesTest.test_all_three_artifacts_require_every_reviewed_text) ... ok
+test_corrupt_cache_and_changed_wheel_fail (test_native_licenses.NativeLicensesTest.test_corrupt_cache_and_changed_wheel_fail) ... ok
+test_distinct_urls_with_shared_digest_are_fetched_independently (test_native_licenses.NativeLicensesTest.test_distinct_urls_with_shared_digest_are_fetched_independently) ... ok
+test_fragments_and_line_ranges_must_be_valid_and_in_the_component_section (test_native_licenses.NativeLicensesTest.test_fragments_and_line_ranges_must_be_valid_and_in_the_component_section) ... ok
+test_github_rewrite_and_atomic_cache_write_then_read_only_hit (test_native_licenses.NativeLicensesTest.test_github_rewrite_and_atomic_cache_write_then_read_only_hit) ... ok
+test_interrupted_cache_replace_leaves_no_partial_entry (test_native_licenses.NativeLicensesTest.test_interrupted_cache_replace_leaves_no_partial_entry) ... ok
+test_inventory_cannot_drop_any_required_text (test_native_licenses.NativeLicensesTest.test_inventory_cannot_drop_any_required_text) ... ok
+test_license_equals_rules_remain_inside_the_component_section (test_native_licenses.NativeLicensesTest.test_license_equals_rules_remain_inside_the_component_section) ... ok
+test_main_jar_scans_other_entries_but_keeps_native_payload_validation_separate (test_native_licenses.NativeLicensesTest.test_main_jar_scans_other_entries_but_keeps_native_payload_validation_separate) ... ok
+test_native_cli_checks_companion_notices_and_personal_paths (test_native_licenses.NativeLicensesTest.test_native_cli_checks_companion_notices_and_personal_paths) ... ok
+test_native_main_missing_reviewed_text_fails_before_payload_parsing (test_native_licenses.NativeLicensesTest.test_native_main_missing_reviewed_text_fails_before_payload_parsing) ... ok
+test_non_utf8_locale_reads_notices_as_utf8 (test_native_licenses.NativeLicensesTest.test_non_utf8_locale_reads_notices_as_utf8) ... ok
+test_notice_hash_update_cannot_hide_missing_upstream_attribution (test_native_licenses.NativeLicensesTest.test_notice_hash_update_cannot_hide_missing_upstream_attribution) ... ok
+test_require_clear_cli_writes_findings_and_exits_nonzero (test_native_licenses.NativeLicensesTest.test_require_clear_cli_writes_findings_and_exits_nonzero) ... ok
+test_stack_exchange_body_and_unexpected_responses (test_native_licenses.NativeLicensesTest.test_stack_exchange_body_and_unexpected_responses) ... ok
+test_valid_sources_and_texts_do_not_clear_unresolved_findings (test_native_licenses.NativeLicensesTest.test_valid_sources_and_texts_do_not_clear_unresolved_findings) ... ok
+test_wheel_member_has_its_own_digest_and_packaged_text_check (test_native_licenses.NativeLicensesTest.test_wheel_member_has_its_own_digest_and_packaged_text_check) ... ok
+test_unstaged_local_jar_succeeds_but_combined_publish_fails (test_native_publish.NativePublishTest.test_unstaged_local_jar_succeeds_but_combined_publish_fails) ... ok
+test_reviewed_hashes_and_receipt_gate_protect_the_actual_upload (test_plugin_upload.PluginUploadTest.test_reviewed_hashes_and_receipt_gate_protect_the_actual_upload) ... ok
+test_bundle_digest_tag_and_path_checks (test_release_inputs.ReleaseInputsTest.test_bundle_digest_tag_and_path_checks) ... ok
+test_invalid_manifest_variants (test_release_inputs.ReleaseInputsTest.test_invalid_manifest_variants) ... ok
+test_macho_minimum_and_malformed_commands (test_release_inputs.ReleaseInputsTest.test_macho_minimum_and_malformed_commands) ... ok
+test_native_target_and_local_paths_are_blocking (test_release_inputs.ReleaseInputsTest.test_native_target_and_local_paths_are_blocking) ... ok
+test_notice_wheel_digest_is_checked_against_bootstrap_not_only_its_inventory_hash (test_release_inputs.ReleaseInputsTest.test_notice_wheel_digest_is_checked_against_bootstrap_not_only_its_inventory_hash) ... ok
+test_preflight_does_not_probe_until_local_versions_are_valid (test_release_inputs.ReleaseInputsTest.test_preflight_does_not_probe_until_local_versions_are_valid) ... ok
+test_selection_and_duplicates (test_release_inputs.ReleaseInputsTest.test_selection_and_duplicates) ... ok
+test_archive_filter_requirement_is_reported_before_io (test_reproduce_audit.ReproduceAuditTest.test_archive_filter_requirement_is_reported_before_io) ... ok
+test_archive_requires_one_jdk_and_rejects_path_traversal (test_reproduce_audit.ReproduceAuditTest.test_archive_requires_one_jdk_and_rejects_path_traversal) ... ok
+test_central_download_hash_is_checked (test_reproduce_audit.ReproduceAuditTest.test_central_download_hash_is_checked) ... ok
+test_environment_removes_injection_and_controls_locale (test_reproduce_audit.ReproduceAuditTest.test_environment_removes_injection_and_controls_locale) ... ok
+test_every_daemon_and_compiler_javadoc_identity_is_checked (test_reproduce_audit.ReproduceAuditTest.test_every_daemon_and_compiler_javadoc_identity_is_checked) ... ok
+test_git_ignores_caller_config_and_environment_injection (test_reproduce_audit.ReproduceAuditTest.test_git_ignores_caller_config_and_environment_injection) ... ok
+test_gradle_version_is_checked (test_reproduce_audit.ReproduceAuditTest.test_gradle_version_is_checked) ... ok
+test_jdk_archive_is_verified_before_extraction (test_reproduce_audit.ReproduceAuditTest.test_jdk_archive_is_verified_before_extraction) ... ok
+test_result_requires_exact_artifacts_and_verdict (test_reproduce_audit.ReproduceAuditTest.test_result_requires_exact_artifacts_and_verdict) ... ok
+test_source_assignment_and_missing_source_no_fallback (test_resolution.ResolutionTest.test_source_assignment_and_missing_source_no_fallback) ... ok
+test_extraction_failure_cleans_partial_repository (test_runner_cleanup.RunnerCleanupTest.test_extraction_failure_cleans_partial_repository) ... ok
+test_clt_only_does_not_require_xcodebuild (test_runtime_evidence.RuntimeEvidenceTest.test_clt_only_does_not_require_xcodebuild) ... ok
+test_explicit_java_home_returns_measured_vendor_build_and_path (test_runtime_evidence.RuntimeEvidenceTest.test_explicit_java_home_returns_measured_vendor_build_and_path) ... ok
+test_xcodebuild_failure_falls_back_to_clt_metadata (test_runtime_evidence.RuntimeEvidenceTest.test_xcodebuild_failure_falls_back_to_clt_metadata) ... ok
+
+----------------------------------------------------------------------
+Ran 80 tests in 50.066s
+
+OK
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/research.json b/req/plans/evidence/native-license-resolution-2026-11-16/research.json
index 1e677566..141e888a 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/research.json
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/research.json
@@ -103,7 +103,7 @@
}
],
"codeComparison": "req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json",
- "codeComparisonSha256": "82b1fc70bf3c31aef76345d3926af9665b458fbf1c2d1e48c5268fb644769622",
+ "codeComparisonSha256": "a2dec69a5b92599ef94723025a1b4c91d7cb13a9823ab815f55d74e652bc9086",
"unresolvedFindingIds": [
"NATIVE-LICENSE-1",
"NATIVE-LICENSE-2"
@@ -123,11 +123,23 @@
"nativeAndArtifactHashesMatchMergedAudit": true,
"reproduction": "Committed verifier reproduced both original comment-list digests, seven function records and five recorded comparison results from fresh primary-source downloads.",
"releaseSelftests": {
+ "tests": 80,
+ "seconds": 50.066,
+ "result": "passed",
+ "log": "req/plans/evidence/native-license-resolution-2026-11-16/followup-release-selftests.log"
+ },
+ "literalLimit": {
+ "requiresDecimalPoint": true,
+ "exponentOnlyLiteralsInRecordedFunctions": 0,
+ "functionRecordsChecked": 7
+ },
+ "initialRecipeReleaseSelftests": {
"tests": 79,
"seconds": 49.296,
"result": "passed",
"log": "req/plans/evidence/native-license-resolution-2026-11-16/review-release-selftests.log"
- }
+ },
+ "malformedEvidenceCli": "Missing research source, non-iterable sources and invalid comparison record types all exit with a license comparison prefix and no traceback."
},
"upstreamHistory": {
"source": "https://api.github.com/repos/ml-explore/mlx/commits?path=mlx/backend/metal/kernels/erf.h&per_page=100&sha=36969c094354086e15d2a327a9c50feb20b9cf11",
@@ -155,8 +167,9 @@
"disposition": "The latest PR describes a numerical substitution, not a grant for the other functions; public file history alone does not establish a separate permission record."
},
"retainedFiles": {
- "req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json": "82b1fc70bf3c31aef76345d3926af9665b458fbf1c2d1e48c5268fb644769622",
- "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py": "34aeee398535b364c11c9e28b17db00e9a11d8a85d78872697520e90dc4f715c",
+ "req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json": "a2dec69a5b92599ef94723025a1b4c91d7cb13a9823ab815f55d74e652bc9086",
+ "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py": "9c96aec5fc79d1fd0a3068188185a74f8978ef55f98ee3faab45a9a7e8efa4f8",
+ "req/plans/evidence/native-license-resolution-2026-11-16/followup-release-selftests.log": "485ebdd39ccfcf2f5c3c02a5973d2de2d3ea7133054e14653381600792fd84f8",
"req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt": "2bb462ea7debd5deb0b069b6218061e8dcd37cc9dc020e790338082a1fbff09c",
"req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt": "8f1c6fa6aabff58fd6138bb8b2b8e9e6cef2598966ac49dd8f05a592309063c3",
"req/plans/evidence/native-license-resolution-2026-11-16/reproduction-result.json": "873f948dc1f4f7bc45e09ae28b2c3aa7b1b2b992f6dbcb3c51adce1aee2ef5d1",
@@ -176,6 +189,31 @@
"assistantPosted": false
},
"reproduction": {
+ "script": "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py",
+ "sha256": "9c96aec5fc79d1fd0a3068188185a74f8978ef55f98ee3faab45a9a7e8efa4f8",
+ "command": [
+ "python3",
+ "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py",
+ "--inputs",
+ "build/releaseAll/license-resolution-inputs",
+ "--fetch-missing",
+ "--output",
+ "build/releaseAll/license-resolution-reproduction.json"
+ ],
+ "result": "req/plans/evidence/native-license-resolution-2026-11-16/reproduction-result.json",
+ "networkInputsInitiallyEmpty": false,
+ "cache": "Prior URL/digest-bound inputs revalidated offline; no fresh source fetch was needed for limits/error-handling changes.",
+ "functionRecords": 7,
+ "comparisonChecks": 5,
+ "commentHashMatches": 2,
+ "resultIdenticalToInitialReproduction": true,
+ "originalCommentHashesPreserved": true
+ },
+ "verificationTools": {
+ "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py": "9c96aec5fc79d1fd0a3068188185a74f8978ef55f98ee3faab45a9a7e8efa4f8",
+ "tools/release-all/tests/test_license_resolution.py": "037cae1eb341f2ffdd50eac672d49ea6f885a726223b24d1348466e57e9e84ff"
+ },
+ "initialReproduction": {
"script": "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py",
"sha256": "34aeee398535b364c11c9e28b17db00e9a11d8a85d78872697520e90dc4f715c",
"command": [
@@ -195,9 +233,5 @@
"offlineResultIdentical": true,
"downloadedInputResponses": 6,
"originalCommentHashesPreserved": true
- },
- "verificationTools": {
- "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py": "34aeee398535b364c11c9e28b17db00e9a11d8a85d78872697520e90dc4f715c",
- "tools/release-all/tests/test_license_resolution.py": "ab3db6c6689fbf709eb4a9b81cf8f66f5726ce90df5d2b3ccbf16665b28fb4d9"
}
}
diff --git a/tools/release-all/tests/test_license_resolution.py b/tools/release-all/tests/test_license_resolution.py
index 17c703a3..4e4ba238 100644
--- a/tools/release-all/tests/test_license_resolution.py
+++ b/tools/release-all/tests/test_license_resolution.py
@@ -1,10 +1,16 @@
-"""The dated comparison recipe preserves exact projections and extraction boundaries."""
+"""The dated comparison recipe preserves exact projections and extraction boundaries.
+
+These live release selftests import the recipe from the dated evidence folder below.
+Archiving or moving that folder requires updating RECIPE and the recorded verifier/evidence
+paths in the same change, or retaining the recipe at its current path.
+"""
import hashlib
import importlib.util
import io
import json
from pathlib import Path
+import subprocess
import sys
import tempfile
import unittest
@@ -50,6 +56,7 @@ def test_extraction_starts_at_name_and_only_attached_signs_are_literals(self):
self.assertTrue(function.endswith("}"))
self.assertNotIn("other", function)
self.assertEqual(C.literals(function), ["-1.0", "0.0020", "3.0"])
+ self.assertEqual(C.literals("1e-5f 2E3f 3.0f"), ["3.0"])
for source in ("float sample(float a);", "float sample(float a) { return 1.0f;"):
with self.subTest(source=source), self.assertRaises(ValueError):
C.function_text(source, "sample")
@@ -87,6 +94,35 @@ def test_url_bound_inputs_rehash_hits_and_never_cache_failed_projection(self):
C.read_source("https://example.invalid/three", expected, lambda raw: raw, inputs, True)
self.assertEqual(len(list(inputs.iterdir())), 2)
+ def test_cli_reports_missing_sources_and_unexpected_json_types_without_tracebacks(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ root = Path(temporary)
+ folder = root / "req/plans/evidence/fixture"
+ folder.mkdir(parents=True)
+ recipe = folder / "compare_literals.py"
+ recipe.write_bytes(RECIPE.read_bytes())
+ (root / "req/phase8-4-native-license-audit.json").write_text('{"sourceEvidence":[]}')
+ cases = [
+ ({"sources": []}, {"records": [{"id": "bsd-forum-missing"}]},
+ "research source missing for comparison record: bsd-forum-missing"),
+ ({"sources": None}, {"records": [{"id": "bsd-forum-erf"}]},
+ "not iterable"),
+ ({"sources": []}, {"records": [None]}, "comparison record must have a string id"),
+ ({"sources": []}, {"records": [{"id": 1}]}, "comparison record must have a string id"),
+ ]
+ for research, comparison, message in cases:
+ with self.subTest(research=research, comparison=comparison):
+ (folder / "research.json").write_text(json.dumps(research), encoding="utf-8")
+ (folder / "code-comparison.json").write_text(json.dumps(comparison), encoding="utf-8")
+ result = subprocess.run(
+ [sys.executable, str(recipe), "--root", str(root), "--inputs", str(root / "inputs"),
+ "--output", str(root / "output.json")], capture_output=True, text=True,
+ encoding="utf-8", timeout=15)
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn("license comparison: ", result.stderr)
+ self.assertIn(message, result.stderr)
+ self.assertNotIn("Traceback", result.stderr)
+
if __name__ == "__main__":
unittest.main()
From d780c39023f64558ac2e1a4e2e59cc710dbb99d0 Mon Sep 17 00:00:00 2001
From: Per Nyfelt
Date: Mon, 16 Nov 2026 21:28:02 +0100
Subject: [PATCH 6/7] Validate research source IDs and handle incomplete HTTP
responses
---
req/phase8-4-implementation-report.md | 8 ++
req/phase8-4-native-license-resolution.md | 10 +++
.../compare_literals.py | 13 ++-
.../input-validation-release-selftests.log | 86 +++++++++++++++++++
.../research.json | 43 +++++++---
.../tests/test_license_resolution.py | 36 +++++++-
6 files changed, 181 insertions(+), 15 deletions(-)
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/input-validation-release-selftests.log
diff --git a/req/phase8-4-implementation-report.md b/req/phase8-4-implementation-report.md
index 7e73ae68..5b69c98e 100644
--- a/req/phase8-4-implementation-report.md
+++ b/req/phase8-4-implementation-report.md
@@ -146,6 +146,14 @@ tracebacks; the live selftest dependency on the dated recipe path is explicitly
All 80 release selftests passed (50.066 seconds), including six focused recipe tests.
Cached-input replay preserves the original seven records, five checks and both comment hashes.
+The source-ID/HTTP follow-up validates all research source IDs before using them and catches
+`http.client.HTTPException` during fetches. CLI regressions include null/non-string source
+IDs and an injected `IncompleteRead` from response reading, with no partial cache/report.
+The recorded latest command now exactly matches the offline invocation without
+`--fetch-missing`. All 81 release selftests passed (68.461 seconds), including seven focused
+recipe tests. Results and both legal findings remain unchanged; no live truncated transfer
+is claimed by the fault-injection test.
+
## Review corrections (2026-11-15)
The minimum-host workflow now creates its Gradle home through `GITHUB_ENV` at step scope;
diff --git a/req/phase8-4-native-license-resolution.md b/req/phase8-4-native-license-resolution.md
index ba92b404..50f61343 100644
--- a/req/phase8-4-native-license-resolution.md
+++ b/req/phase8-4-native-license-resolution.md
@@ -141,6 +141,8 @@ to verify the cached responses offline. It checks the original audit's complete
answer-body hashes before extracting their longest HTML-decoded code blocks, and validates
every function input/hash/literal record against `code-comparison.json`. The retained BSD
samples need no download. Changed projected content fails with a contextual error.
+The latest offline command in `research.json` omits `--fetch-missing` and was executed with
+its recorded input/output paths. `initialReproduction` retains the earlier first-download command.
For each comment response, preserve the API `items` array order. Project each item to exactly
`{"comment_id": item["comment_id"], "creation_date": item["creation_date"],
@@ -164,6 +166,14 @@ now report `license comparison: …` without a traceback. Cached-input replay pr
seven function records, five checks and both original comment hashes; the legal findings stay open.
All 80 release selftests passed (50.066 seconds), including six focused recipe tests.
+The source-ID/HTTP follow-up validates every research source as an object with a string ID
+before comparison or comment processing. The CLI also catches `http.client.HTTPException`,
+including `IncompleteRead`. A fault-injection test raises `IncompleteRead` from response
+reading and verifies the prefixed error and absence of a partial cache entry/report; it does
+not claim to reproduce a live truncated transfer. The validation record lists the malformed
+evidence cases actually tested rather than claiming to cover all possible evidence edits.
+All 81 release selftests passed (68.461 seconds), including seven focused recipe tests.
+
Validation checks source hashes against the existing audit, the five recorded comparison
results and every retained sample/report digest. The unchanged audit command still produces
the same result as PR #100's follow-up evidence, including `releaseReady: false` and both
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py b/req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py
index c9e5bb1e..0e9c5945 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py
@@ -5,6 +5,7 @@
from collections import Counter
from decimal import Decimal
import hashlib
+import http.client
from html.parser import HTMLParser
import json
import os
@@ -156,12 +157,18 @@ def verify(root, inputs, fetch_missing=False):
expected = json.loads((folder / "code-comparison.json").read_bytes())
audit = json.loads((root / "req/phase8-4-native-license-audit.json").read_bytes())
audit_sources = {entry["source"]: entry["sha256"] for entry in audit["sourceEvidence"]}
+ sources = research["sources"]
+ if not isinstance(sources, list):
+ raise ValueError("research sources must be a list")
+ for source in sources:
+ if not isinstance(source, dict) or not isinstance(source.get("id"), str):
+ raise ValueError("research source must have a string id")
records, comments = [], []
for entry in expected["records"]:
if not isinstance(entry, dict) or not isinstance(entry.get("id"), str):
raise ValueError("comparison record must have a string id")
if entry["id"].startswith("bsd-forum-"):
- source = next((item for item in research["sources"] if item["id"] == entry["id"]), None)
+ source = next((item for item in sources if item["id"] == entry["id"]), None)
if source is None:
raise ValueError(f"research source missing for comparison record: {entry['id']}")
data = (root / source["retainedPath"]).read_bytes()
@@ -183,7 +190,7 @@ def verify(root, inputs, fetch_missing=False):
checks = comparison_checks(records)
if checks != expected["checks"]:
raise ValueError("literal comparison results differ from the recorded five checks")
- for entry in research["sources"]:
+ for entry in sources:
if entry["id"].endswith("-answer-comments"):
data = read_source(entry["url"], entry["sha256"], comment_projection, inputs, fetch_missing)
count = len(json.loads(data))
@@ -208,5 +215,5 @@ def main():
if __name__ == "__main__":
try:
main()
- except (ValueError, OSError, KeyError, TypeError) as error:
+ except (ValueError, OSError, KeyError, TypeError, http.client.HTTPException) as error:
raise SystemExit(f"license comparison: {error}") from error
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/input-validation-release-selftests.log b/req/plans/evidence/native-license-resolution-2026-11-16/input-validation-release-selftests.log
new file mode 100644
index 00000000..294886bd
--- /dev/null
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/input-validation-release-selftests.log
@@ -0,0 +1,86 @@
+test_main_checks_environment_before_consumer_or_output_creation (test_bundle_smoke.BundleSmokeTest.test_main_checks_environment_before_consumer_or_output_creation) ... ok
+test_main_explains_that_legacy_preliminary_records_must_be_regenerated (test_bundle_smoke.BundleSmokeTest.test_main_explains_that_legacy_preliminary_records_must_be_regenerated) ... ok
+test_minimum_host_accepts_patch_releases_and_rejects_other_minor_versions (test_bundle_smoke.BundleSmokeTest.test_minimum_host_accepts_patch_releases_and_rejects_other_minor_versions) ... ok
+test_minimum_host_requires_physical_arm64_and_complete_identity (test_bundle_smoke.BundleSmokeTest.test_minimum_host_requires_physical_arm64_and_complete_identity) ... ok
+test_other_macos_reports_require_at_least_supported_minor (test_bundle_smoke.BundleSmokeTest.test_other_macos_reports_require_at_least_supported_minor) ... ok
+test_task_outcomes_and_configuration_cache_reuse (test_collector.CollectorTest.test_task_outcomes_and_configuration_cache_reuse) ... ok
+test_class_and_documentation_changes_survive (test_compare_publications.ComparePublicationsTest.test_class_and_documentation_changes_survive) ... ok
+test_cli_require_equal_writes_report_and_returns_verdict (test_compare_publications.ComparePublicationsTest.test_cli_require_equal_writes_report_and_returns_verdict) ... ok
+test_dependency_and_gradle_provenance_changes_survive_normalization (test_compare_publications.ComparePublicationsTest.test_dependency_and_gradle_provenance_changes_survive_normalization) ... ok
+test_duplicate_archive_entries_are_rejected (test_compare_publications.ComparePublicationsTest.test_duplicate_archive_entries_are_rejected) ... ok
+test_expected_set_requires_all_five_files_per_module (test_compare_publications.ComparePublicationsTest.test_expected_set_requires_all_five_files_per_module) ... ok
+test_extra_artifact_is_rejected (test_compare_publications.ComparePublicationsTest.test_extra_artifact_is_rejected) ... ok
+test_missing_artifact_is_rejected (test_compare_publications.ComparePublicationsTest.test_missing_artifact_is_rejected) ... ok
+test_missing_metadata_fields_have_context (test_compare_publications.ComparePublicationsTest.test_missing_metadata_fields_have_context) ... ok
+test_nested_artifact_record_is_rejected (test_compare_publications.ComparePublicationsTest.test_nested_artifact_record_is_rejected) ... ok
+test_normalization_never_deflates_even_for_deflated_inputs (test_compare_publications.ComparePublicationsTest.test_normalization_never_deflates_even_for_deflated_inputs) ... ok
+test_only_archive_order_timestamps_and_matching_metadata_hashes_are_normalized (test_compare_publications.ComparePublicationsTest.test_only_archive_order_timestamps_and_matching_metadata_hashes_are_normalized) ... ok
+test_pom_and_module_formatting_differences_survive (test_compare_publications.ComparePublicationsTest.test_pom_and_module_formatting_differences_survive) ... ok
+test_publications_shape_is_validated (test_compare_publications.ComparePublicationsTest.test_publications_shape_is_validated) ... ok
+test_stale_metadata_cannot_be_blessed_by_recomputed_hashes (test_compare_publications.ComparePublicationsTest.test_stale_metadata_cannot_be_blessed_by_recomputed_hashes) ... ok
+test_unexpected_url_record_is_rejected (test_compare_publications.ComparePublicationsTest.test_unexpected_url_record_is_rejected) ... ok
+test_wrong_checksum_is_rejected_even_when_size_matches (test_compare_publications.ComparePublicationsTest.test_wrong_checksum_is_rejected_even_when_size_matches) ... ok
+test_zip_metadata_differences_survive (test_compare_publications.ComparePublicationsTest.test_zip_metadata_differences_survive) ... ok
+test_actual_plugin_bundle_replacement_is_rejected_even_if_receipt_copy_is_verified (test_final_receipt.FinalReceiptTest.test_actual_plugin_bundle_replacement_is_rejected_even_if_receipt_copy_is_verified) ... ok
+test_all_macos_acceptance_reports_require_supported_os (test_final_receipt.FinalReceiptTest.test_all_macos_acceptance_reports_require_supported_os) ... ok
+test_cached_task_cannot_claim_passed (test_final_receipt.FinalReceiptTest.test_cached_task_cannot_claim_passed) ... ok
+test_final_valid_and_preliminary_rejected (test_final_receipt.FinalReceiptTest.test_final_valid_and_preliminary_rejected) ... ok
+test_minimum_host_requires_supported_minor_and_accepts_patch_releases (test_final_receipt.FinalReceiptTest.test_minimum_host_requires_supported_minor_and_accepts_patch_releases) ... ok
+test_missing_reports_changed_plan_and_logs_block_upload (test_final_receipt.FinalReceiptTest.test_missing_reports_changed_plan_and_logs_block_upload) ... ok
+test_plugin_digests_are_reviewed_record_anchors_after_full_verification (test_final_receipt.FinalReceiptTest.test_plugin_digests_are_reviewed_record_anchors_after_full_verification) ... ok
+test_plugin_digests_cli_stdout_contract (test_final_receipt.FinalReceiptTest.test_plugin_digests_cli_stdout_contract) ... ok
+test_real_bundle_check_does_not_authorize_a_different_plugin_upload_file (test_final_receipt.FinalReceiptTest.test_real_bundle_check_does_not_authorize_a_different_plugin_upload_file) ... ok
+test_receipt_cannot_select_a_different_upload_path (test_final_receipt.FinalReceiptTest.test_receipt_cannot_select_a_different_upload_path) ... ok
+test_report_cannot_invent_runtime_properties (test_final_receipt.FinalReceiptTest.test_report_cannot_invent_runtime_properties) ... ok
+test_answer_projection_decodes_longest_code_and_checks_full_body_digest (test_license_resolution.LicenseResolutionTest.test_answer_projection_decodes_longest_code_and_checks_full_body_digest) ... ok
+test_cli_reports_incomplete_http_read_without_caching_partial_response (test_license_resolution.LicenseResolutionTest.test_cli_reports_incomplete_http_read_without_caching_partial_response) ... ok
+test_cli_reports_missing_sources_and_unexpected_json_types_without_tracebacks (test_license_resolution.LicenseResolutionTest.test_cli_reports_missing_sources_and_unexpected_json_types_without_tracebacks) ... ok
+test_comment_projection_has_exact_ascii_serialization_and_api_order (test_license_resolution.LicenseResolutionTest.test_comment_projection_has_exact_ascii_serialization_and_api_order) ... ok
+test_comment_projection_rejects_partial_or_malformed_responses (test_license_resolution.LicenseResolutionTest.test_comment_projection_rejects_partial_or_malformed_responses) ... ok
+test_extraction_starts_at_name_and_only_attached_signs_are_literals (test_license_resolution.LicenseResolutionTest.test_extraction_starts_at_name_and_only_attached_signs_are_literals) ... ok
+test_url_bound_inputs_rehash_hits_and_never_cache_failed_projection (test_license_resolution.LicenseResolutionTest.test_url_bound_inputs_rehash_hits_and_never_cache_failed_projection) ... ok
+test_all_three_artifacts_require_every_reviewed_text (test_native_licenses.NativeLicensesTest.test_all_three_artifacts_require_every_reviewed_text) ... ok
+test_corrupt_cache_and_changed_wheel_fail (test_native_licenses.NativeLicensesTest.test_corrupt_cache_and_changed_wheel_fail) ... ok
+test_distinct_urls_with_shared_digest_are_fetched_independently (test_native_licenses.NativeLicensesTest.test_distinct_urls_with_shared_digest_are_fetched_independently) ... ok
+test_fragments_and_line_ranges_must_be_valid_and_in_the_component_section (test_native_licenses.NativeLicensesTest.test_fragments_and_line_ranges_must_be_valid_and_in_the_component_section) ... ok
+test_github_rewrite_and_atomic_cache_write_then_read_only_hit (test_native_licenses.NativeLicensesTest.test_github_rewrite_and_atomic_cache_write_then_read_only_hit) ... ok
+test_interrupted_cache_replace_leaves_no_partial_entry (test_native_licenses.NativeLicensesTest.test_interrupted_cache_replace_leaves_no_partial_entry) ... ok
+test_inventory_cannot_drop_any_required_text (test_native_licenses.NativeLicensesTest.test_inventory_cannot_drop_any_required_text) ... ok
+test_license_equals_rules_remain_inside_the_component_section (test_native_licenses.NativeLicensesTest.test_license_equals_rules_remain_inside_the_component_section) ... ok
+test_main_jar_scans_other_entries_but_keeps_native_payload_validation_separate (test_native_licenses.NativeLicensesTest.test_main_jar_scans_other_entries_but_keeps_native_payload_validation_separate) ... ok
+test_native_cli_checks_companion_notices_and_personal_paths (test_native_licenses.NativeLicensesTest.test_native_cli_checks_companion_notices_and_personal_paths) ... ok
+test_native_main_missing_reviewed_text_fails_before_payload_parsing (test_native_licenses.NativeLicensesTest.test_native_main_missing_reviewed_text_fails_before_payload_parsing) ... ok
+test_non_utf8_locale_reads_notices_as_utf8 (test_native_licenses.NativeLicensesTest.test_non_utf8_locale_reads_notices_as_utf8) ... ok
+test_notice_hash_update_cannot_hide_missing_upstream_attribution (test_native_licenses.NativeLicensesTest.test_notice_hash_update_cannot_hide_missing_upstream_attribution) ... ok
+test_require_clear_cli_writes_findings_and_exits_nonzero (test_native_licenses.NativeLicensesTest.test_require_clear_cli_writes_findings_and_exits_nonzero) ... ok
+test_stack_exchange_body_and_unexpected_responses (test_native_licenses.NativeLicensesTest.test_stack_exchange_body_and_unexpected_responses) ... ok
+test_valid_sources_and_texts_do_not_clear_unresolved_findings (test_native_licenses.NativeLicensesTest.test_valid_sources_and_texts_do_not_clear_unresolved_findings) ... ok
+test_wheel_member_has_its_own_digest_and_packaged_text_check (test_native_licenses.NativeLicensesTest.test_wheel_member_has_its_own_digest_and_packaged_text_check) ... ok
+test_unstaged_local_jar_succeeds_but_combined_publish_fails (test_native_publish.NativePublishTest.test_unstaged_local_jar_succeeds_but_combined_publish_fails) ... ok
+test_reviewed_hashes_and_receipt_gate_protect_the_actual_upload (test_plugin_upload.PluginUploadTest.test_reviewed_hashes_and_receipt_gate_protect_the_actual_upload) ... ok
+test_bundle_digest_tag_and_path_checks (test_release_inputs.ReleaseInputsTest.test_bundle_digest_tag_and_path_checks) ... ok
+test_invalid_manifest_variants (test_release_inputs.ReleaseInputsTest.test_invalid_manifest_variants) ... ok
+test_macho_minimum_and_malformed_commands (test_release_inputs.ReleaseInputsTest.test_macho_minimum_and_malformed_commands) ... ok
+test_native_target_and_local_paths_are_blocking (test_release_inputs.ReleaseInputsTest.test_native_target_and_local_paths_are_blocking) ... ok
+test_notice_wheel_digest_is_checked_against_bootstrap_not_only_its_inventory_hash (test_release_inputs.ReleaseInputsTest.test_notice_wheel_digest_is_checked_against_bootstrap_not_only_its_inventory_hash) ... ok
+test_preflight_does_not_probe_until_local_versions_are_valid (test_release_inputs.ReleaseInputsTest.test_preflight_does_not_probe_until_local_versions_are_valid) ... ok
+test_selection_and_duplicates (test_release_inputs.ReleaseInputsTest.test_selection_and_duplicates) ... ok
+test_archive_filter_requirement_is_reported_before_io (test_reproduce_audit.ReproduceAuditTest.test_archive_filter_requirement_is_reported_before_io) ... ok
+test_archive_requires_one_jdk_and_rejects_path_traversal (test_reproduce_audit.ReproduceAuditTest.test_archive_requires_one_jdk_and_rejects_path_traversal) ... ok
+test_central_download_hash_is_checked (test_reproduce_audit.ReproduceAuditTest.test_central_download_hash_is_checked) ... ok
+test_environment_removes_injection_and_controls_locale (test_reproduce_audit.ReproduceAuditTest.test_environment_removes_injection_and_controls_locale) ... ok
+test_every_daemon_and_compiler_javadoc_identity_is_checked (test_reproduce_audit.ReproduceAuditTest.test_every_daemon_and_compiler_javadoc_identity_is_checked) ... ok
+test_git_ignores_caller_config_and_environment_injection (test_reproduce_audit.ReproduceAuditTest.test_git_ignores_caller_config_and_environment_injection) ... ok
+test_gradle_version_is_checked (test_reproduce_audit.ReproduceAuditTest.test_gradle_version_is_checked) ... ok
+test_jdk_archive_is_verified_before_extraction (test_reproduce_audit.ReproduceAuditTest.test_jdk_archive_is_verified_before_extraction) ... ok
+test_result_requires_exact_artifacts_and_verdict (test_reproduce_audit.ReproduceAuditTest.test_result_requires_exact_artifacts_and_verdict) ... ok
+test_source_assignment_and_missing_source_no_fallback (test_resolution.ResolutionTest.test_source_assignment_and_missing_source_no_fallback) ... ok
+test_extraction_failure_cleans_partial_repository (test_runner_cleanup.RunnerCleanupTest.test_extraction_failure_cleans_partial_repository) ... ok
+test_clt_only_does_not_require_xcodebuild (test_runtime_evidence.RuntimeEvidenceTest.test_clt_only_does_not_require_xcodebuild) ... ok
+test_explicit_java_home_returns_measured_vendor_build_and_path (test_runtime_evidence.RuntimeEvidenceTest.test_explicit_java_home_returns_measured_vendor_build_and_path) ... ok
+test_xcodebuild_failure_falls_back_to_clt_metadata (test_runtime_evidence.RuntimeEvidenceTest.test_xcodebuild_failure_falls_back_to_clt_metadata) ... ok
+
+----------------------------------------------------------------------
+Ran 81 tests in 68.461s
+
+OK
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/research.json b/req/plans/evidence/native-license-resolution-2026-11-16/research.json
index 141e888a..d0f8638b 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/research.json
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/research.json
@@ -123,10 +123,10 @@
"nativeAndArtifactHashesMatchMergedAudit": true,
"reproduction": "Committed verifier reproduced both original comment-list digests, seven function records and five recorded comparison results from fresh primary-source downloads.",
"releaseSelftests": {
- "tests": 80,
- "seconds": 50.066,
+ "tests": 81,
+ "seconds": 68.461,
"result": "passed",
- "log": "req/plans/evidence/native-license-resolution-2026-11-16/followup-release-selftests.log"
+ "log": "req/plans/evidence/native-license-resolution-2026-11-16/input-validation-release-selftests.log"
},
"literalLimit": {
"requiresDecimalPoint": true,
@@ -139,7 +139,30 @@
"result": "passed",
"log": "req/plans/evidence/native-license-resolution-2026-11-16/review-release-selftests.log"
},
- "malformedEvidenceCli": "Missing research source, non-iterable sources and invalid comparison record types all exit with a license comparison prefix and no traceback."
+ "malformedEvidenceCli": {
+ "coveredCases": [
+ "missing research source match",
+ "null research source id",
+ "non-string research source id",
+ "research source not an object",
+ "research sources not a list",
+ "comparison record not an object",
+ "comparison record id not a string",
+ "comparison records not iterable"
+ ],
+ "result": "Each tested case exits with a license comparison prefix and no traceback."
+ },
+ "httpResponseFailure": {
+ "testedCase": "Injected http.client.IncompleteRead from response.read() during --fetch-missing",
+ "result": "CLI exits with a license comparison prefix; no input cache entry or output report is created.",
+ "liveTruncatedDownloadReproduced": false
+ },
+ "priorRecipeErrorReleaseSelftests": {
+ "tests": 80,
+ "seconds": 50.066,
+ "result": "passed",
+ "log": "req/plans/evidence/native-license-resolution-2026-11-16/followup-release-selftests.log"
+ }
},
"upstreamHistory": {
"source": "https://api.github.com/repos/ml-explore/mlx/commits?path=mlx/backend/metal/kernels/erf.h&per_page=100&sha=36969c094354086e15d2a327a9c50feb20b9cf11",
@@ -168,8 +191,9 @@
},
"retainedFiles": {
"req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json": "a2dec69a5b92599ef94723025a1b4c91d7cb13a9823ab815f55d74e652bc9086",
- "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py": "9c96aec5fc79d1fd0a3068188185a74f8978ef55f98ee3faab45a9a7e8efa4f8",
+ "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py": "53238f6df2733d1662cfadb3e874a38877c92d5374e7cb672997f249a93faff1",
"req/plans/evidence/native-license-resolution-2026-11-16/followup-release-selftests.log": "485ebdd39ccfcf2f5c3c02a5973d2de2d3ea7133054e14653381600792fd84f8",
+ "req/plans/evidence/native-license-resolution-2026-11-16/input-validation-release-selftests.log": "54faf2252c503680b0255ef849bd4f47577fedb17a88a2b860ef23fdf163b39c",
"req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt": "2bb462ea7debd5deb0b069b6218061e8dcd37cc9dc020e790338082a1fbff09c",
"req/plans/evidence/native-license-resolution-2026-11-16/juffa-erfinv-bsd-sample.txt": "8f1c6fa6aabff58fd6138bb8b2b8e9e6cef2598966ac49dd8f05a592309063c3",
"req/plans/evidence/native-license-resolution-2026-11-16/reproduction-result.json": "873f948dc1f4f7bc45e09ae28b2c3aa7b1b2b992f6dbcb3c51adce1aee2ef5d1",
@@ -190,19 +214,18 @@
},
"reproduction": {
"script": "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py",
- "sha256": "9c96aec5fc79d1fd0a3068188185a74f8978ef55f98ee3faab45a9a7e8efa4f8",
+ "sha256": "53238f6df2733d1662cfadb3e874a38877c92d5374e7cb672997f249a93faff1",
"command": [
"python3",
"req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py",
"--inputs",
"build/releaseAll/license-resolution-inputs",
- "--fetch-missing",
"--output",
"build/releaseAll/license-resolution-reproduction.json"
],
"result": "req/plans/evidence/native-license-resolution-2026-11-16/reproduction-result.json",
"networkInputsInitiallyEmpty": false,
- "cache": "Prior URL/digest-bound inputs revalidated offline; no fresh source fetch was needed for limits/error-handling changes.",
+ "cache": "Previously validated URL/digest-bound cached responses were copied to the recorded --inputs path before this offline command; no --fetch-missing flag or network requests.",
"functionRecords": 7,
"comparisonChecks": 5,
"commentHashMatches": 2,
@@ -210,8 +233,8 @@
"originalCommentHashesPreserved": true
},
"verificationTools": {
- "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py": "9c96aec5fc79d1fd0a3068188185a74f8978ef55f98ee3faab45a9a7e8efa4f8",
- "tools/release-all/tests/test_license_resolution.py": "037cae1eb341f2ffdd50eac672d49ea6f885a726223b24d1348466e57e9e84ff"
+ "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py": "53238f6df2733d1662cfadb3e874a38877c92d5374e7cb672997f249a93faff1",
+ "tools/release-all/tests/test_license_resolution.py": "5336b3e53034eede9465d1a9d48efd3886742d16af8ae5ccb03af32477ebe506"
},
"initialReproduction": {
"script": "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py",
diff --git a/tools/release-all/tests/test_license_resolution.py b/tools/release-all/tests/test_license_resolution.py
index 4e4ba238..d69d7696 100644
--- a/tools/release-all/tests/test_license_resolution.py
+++ b/tools/release-all/tests/test_license_resolution.py
@@ -6,15 +6,17 @@
"""
import hashlib
+import http.client
import importlib.util
import io
import json
from pathlib import Path
+import runpy
import subprocess
import sys
import tempfile
import unittest
-from unittest.mock import patch
+from unittest.mock import MagicMock, patch
RECIPE = (Path(__file__).resolve().parents[3]
/ "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py")
@@ -106,7 +108,11 @@ def test_cli_reports_missing_sources_and_unexpected_json_types_without_traceback
({"sources": []}, {"records": [{"id": "bsd-forum-missing"}]},
"research source missing for comparison record: bsd-forum-missing"),
({"sources": None}, {"records": [{"id": "bsd-forum-erf"}]},
- "not iterable"),
+ "research sources must be a list"),
+ ({"sources": [{"id": None}]}, {"records": []}, "research source must have a string id"),
+ ({"sources": [{"id": 1}]}, {"records": []}, "research source must have a string id"),
+ ({"sources": [None]}, {"records": []}, "research source must have a string id"),
+ ({"sources": []}, {"records": None}, "not iterable"),
({"sources": []}, {"records": [None]}, "comparison record must have a string id"),
({"sources": []}, {"records": [{"id": 1}]}, "comparison record must have a string id"),
]
@@ -123,6 +129,32 @@ def test_cli_reports_missing_sources_and_unexpected_json_types_without_traceback
self.assertIn(message, result.stderr)
self.assertNotIn("Traceback", result.stderr)
+ def test_cli_reports_incomplete_http_read_without_caching_partial_response(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ root = Path(temporary)
+ folder = root / "req/plans/evidence/fixture"
+ folder.mkdir(parents=True)
+ recipe = folder / "compare_literals.py"
+ recipe.write_bytes(RECIPE.read_bytes())
+ (root / "req/phase8-4-native-license-audit.json").write_text('{"sourceEvidence":[]}')
+ (folder / "research.json").write_text('{"sources":[]}')
+ (folder / "code-comparison.json").write_text(json.dumps({"records": [
+ {"id": "mlx-source", "source": "https://example.invalid/truncated", "inputSha256": "0" * 64}]}))
+ response = MagicMock()
+ response.__enter__.return_value = response
+ response.read.side_effect = http.client.IncompleteRead(b"partial", 10)
+ args = [str(recipe), "--root", str(root), "--inputs", str(root / "inputs"),
+ "--fetch-missing", "--output", str(root / "output.json")]
+ with patch.object(sys, "argv", args):
+ with patch.object(C.urllib.request, "urlopen", return_value=response):
+ with self.assertRaises(SystemExit) as stopped:
+ runpy.run_path(str(recipe), run_name="__main__")
+ response.read.assert_called_once_with()
+ self.assertTrue(str(stopped.exception.code).startswith("license comparison: "))
+ self.assertIn("IncompleteRead", str(stopped.exception.code))
+ self.assertFalse((root / "inputs").exists())
+ self.assertFalse((root / "output.json").exists())
+
if __name__ == "__main__":
unittest.main()
From 822860aaea167261396f8b1bb90d0ed1a19777ae Mon Sep 17 00:00:00 2001
From: Per Nyfelt
Date: Mon, 16 Nov 2026 21:46:05 +0100
Subject: [PATCH 7/7] Reject non-string source URLs before encoding or cache
access
---
req/phase8-4-implementation-report.md | 6 ++
req/phase8-4-native-license-resolution.md | 6 ++
.../compare_literals.py | 2 +
.../research.json | 33 +++++--
.../url-validation-release-selftests.log | 87 +++++++++++++++++++
.../url-validation-result.json | 21 +++++
.../tests/test_license_resolution.py | 13 +++
7 files changed, 159 insertions(+), 9 deletions(-)
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/url-validation-release-selftests.log
create mode 100644 req/plans/evidence/native-license-resolution-2026-11-16/url-validation-result.json
diff --git a/req/phase8-4-implementation-report.md b/req/phase8-4-implementation-report.md
index 5b69c98e..1d8c0a05 100644
--- a/req/phase8-4-implementation-report.md
+++ b/req/phase8-4-implementation-report.md
@@ -154,6 +154,12 @@ The recorded latest command now exactly matches the offline invocation without
recipe tests. Results and both legal findings remain unchanged; no live truncated transfer
is claimed by the fault-injection test.
+The URL-type follow-up adds a narrow string check before `read_source` encodes a URL.
+Actual cached-input CLI runs for both a numeric comment `url` and a numeric MLX comparison
+`source` now return the prefixed validation error without a traceback or output report.
+All 82 release selftests passed (50.286 seconds), including eight focused recipe tests.
+Valid-input reproduction remains byte-identical; no native or legal finding changed.
+
## Review corrections (2026-11-15)
The minimum-host workflow now creates its Gradle home through `GITHUB_ENV` at step scope;
diff --git a/req/phase8-4-native-license-resolution.md b/req/phase8-4-native-license-resolution.md
index 50f61343..2e0f00b6 100644
--- a/req/phase8-4-native-license-resolution.md
+++ b/req/phase8-4-native-license-resolution.md
@@ -174,6 +174,12 @@ not claim to reproduce a live truncated transfer. The validation record lists th
evidence cases actually tested rather than claiming to cover all possible evidence edits.
All 81 release selftests passed (68.461 seconds), including seven focused recipe tests.
+The URL-type follow-up rejects non-string URLs in `read_source` before encoding, cache or
+network access. Both a comment source's `url: 123` and a comparison record's `source: 123`
+were exercised through the real CLI with the recorded cached inputs: each produces
+`license comparison: source url must be a string` without a traceback or output report.
+All 82 release selftests passed (50.286 seconds), including eight focused recipe tests.
+
Validation checks source hashes against the existing audit, the five recorded comparison
results and every retained sample/report digest. The unchanged audit command still produces
the same result as PR #100's follow-up evidence, including `releaseReady: false` and both
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py b/req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py
index 0e9c5945..4d3a44c2 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py
@@ -114,6 +114,8 @@ def literals(text):
def read_source(url, expected_digest, project, inputs, fetch_missing):
+ if not isinstance(url, str):
+ raise ValueError("source url must be a string")
cached = inputs / (digest(url.encode("utf-8")) + "-" + expected_digest)
fetched = not cached.is_file()
if fetched:
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/research.json b/req/plans/evidence/native-license-resolution-2026-11-16/research.json
index d0f8638b..7974b4df 100644
--- a/req/plans/evidence/native-license-resolution-2026-11-16/research.json
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/research.json
@@ -123,10 +123,10 @@
"nativeAndArtifactHashesMatchMergedAudit": true,
"reproduction": "Committed verifier reproduced both original comment-list digests, seven function records and five recorded comparison results from fresh primary-source downloads.",
"releaseSelftests": {
- "tests": 81,
- "seconds": 68.461,
+ "tests": 82,
+ "seconds": 50.286,
"result": "passed",
- "log": "req/plans/evidence/native-license-resolution-2026-11-16/input-validation-release-selftests.log"
+ "log": "req/plans/evidence/native-license-resolution-2026-11-16/url-validation-release-selftests.log"
},
"literalLimit": {
"requiresDecimalPoint": true,
@@ -148,7 +148,9 @@
"research sources not a list",
"comparison record not an object",
"comparison record id not a string",
- "comparison records not iterable"
+ "comparison records not iterable",
+ "numeric comment source URL (cached-input CLI)",
+ "numeric MLX comparison source (cached-input CLI)"
],
"result": "Each tested case exits with a license comparison prefix and no traceback."
},
@@ -162,6 +164,17 @@
"seconds": 50.066,
"result": "passed",
"log": "req/plans/evidence/native-license-resolution-2026-11-16/followup-release-selftests.log"
+ },
+ "priorSourceValidationReleaseSelftests": {
+ "tests": 81,
+ "seconds": 68.461,
+ "result": "passed",
+ "log": "req/plans/evidence/native-license-resolution-2026-11-16/input-validation-release-selftests.log"
+ },
+ "urlTypeGuard": {
+ "result": "req/plans/evidence/native-license-resolution-2026-11-16/url-validation-result.json",
+ "message": "source url must be a string",
+ "validatedBefore": "URL encoding, cache access and network access"
}
},
"upstreamHistory": {
@@ -191,7 +204,7 @@
},
"retainedFiles": {
"req/plans/evidence/native-license-resolution-2026-11-16/code-comparison.json": "a2dec69a5b92599ef94723025a1b4c91d7cb13a9823ab815f55d74e652bc9086",
- "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py": "53238f6df2733d1662cfadb3e874a38877c92d5374e7cb672997f249a93faff1",
+ "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py": "d8298ae1b8801c1453760bce3a7b731cbf95c9402e66e8f9ce9297cf85b16f2c",
"req/plans/evidence/native-license-resolution-2026-11-16/followup-release-selftests.log": "485ebdd39ccfcf2f5c3c02a5973d2de2d3ea7133054e14653381600792fd84f8",
"req/plans/evidence/native-license-resolution-2026-11-16/input-validation-release-selftests.log": "54faf2252c503680b0255ef849bd4f47577fedb17a88a2b860ef23fdf163b39c",
"req/plans/evidence/native-license-resolution-2026-11-16/juffa-erf-bsd-sample.txt": "2bb462ea7debd5deb0b069b6218061e8dcd37cc9dc020e790338082a1fbff09c",
@@ -199,7 +212,9 @@
"req/plans/evidence/native-license-resolution-2026-11-16/reproduction-result.json": "873f948dc1f4f7bc45e09ae28b2c3aa7b1b2b992f6dbcb3c51adce1aee2ef5d1",
"req/plans/evidence/native-license-resolution-2026-11-16/review-release-selftests.log": "f04df07b931df3dcb0f9f75fbb951111a7ca215bbfbbcc963f35a57f4078e61b",
"req/plans/evidence/native-license-resolution-2026-11-16/upstream-issue.json": "7fedbe67a65c707f1497c92f5bd8767e5400d7a7eb572819143ef898690b298b",
- "req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md": "bacd91b6ba82ea6b64f350eadffa9b2e1844e7328081dc594874e5a0249aaa55"
+ "req/plans/evidence/native-license-resolution-2026-11-16/upstream-request-draft.md": "bacd91b6ba82ea6b64f350eadffa9b2e1844e7328081dc594874e5a0249aaa55",
+ "req/plans/evidence/native-license-resolution-2026-11-16/url-validation-release-selftests.log": "e773ffaf8d034889d220e880f9f8f209793f4ba5be24ea1538e8ab1e8f9c11ea",
+ "req/plans/evidence/native-license-resolution-2026-11-16/url-validation-result.json": "b0c0be2f0f36f052e2d3fb7e4af9495675dc542eb5ecc05f222adb9f77d5f73e"
},
"thirdPartyContact": {
"url": "https://github.com/ml-explore/mlx/issues/4902",
@@ -214,7 +229,7 @@
},
"reproduction": {
"script": "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py",
- "sha256": "53238f6df2733d1662cfadb3e874a38877c92d5374e7cb672997f249a93faff1",
+ "sha256": "d8298ae1b8801c1453760bce3a7b731cbf95c9402e66e8f9ce9297cf85b16f2c",
"command": [
"python3",
"req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py",
@@ -233,8 +248,8 @@
"originalCommentHashesPreserved": true
},
"verificationTools": {
- "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py": "53238f6df2733d1662cfadb3e874a38877c92d5374e7cb672997f249a93faff1",
- "tools/release-all/tests/test_license_resolution.py": "5336b3e53034eede9465d1a9d48efd3886742d16af8ae5ccb03af32477ebe506"
+ "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py": "d8298ae1b8801c1453760bce3a7b731cbf95c9402e66e8f9ce9297cf85b16f2c",
+ "tools/release-all/tests/test_license_resolution.py": "42e470dc2fcb06b90528dde50aca87daa13ac1f49627995f6de1d268b7cd708d"
},
"initialReproduction": {
"script": "req/plans/evidence/native-license-resolution-2026-11-16/compare_literals.py",
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/url-validation-release-selftests.log b/req/plans/evidence/native-license-resolution-2026-11-16/url-validation-release-selftests.log
new file mode 100644
index 00000000..08179692
--- /dev/null
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/url-validation-release-selftests.log
@@ -0,0 +1,87 @@
+test_main_checks_environment_before_consumer_or_output_creation (test_bundle_smoke.BundleSmokeTest.test_main_checks_environment_before_consumer_or_output_creation) ... ok
+test_main_explains_that_legacy_preliminary_records_must_be_regenerated (test_bundle_smoke.BundleSmokeTest.test_main_explains_that_legacy_preliminary_records_must_be_regenerated) ... ok
+test_minimum_host_accepts_patch_releases_and_rejects_other_minor_versions (test_bundle_smoke.BundleSmokeTest.test_minimum_host_accepts_patch_releases_and_rejects_other_minor_versions) ... ok
+test_minimum_host_requires_physical_arm64_and_complete_identity (test_bundle_smoke.BundleSmokeTest.test_minimum_host_requires_physical_arm64_and_complete_identity) ... ok
+test_other_macos_reports_require_at_least_supported_minor (test_bundle_smoke.BundleSmokeTest.test_other_macos_reports_require_at_least_supported_minor) ... ok
+test_task_outcomes_and_configuration_cache_reuse (test_collector.CollectorTest.test_task_outcomes_and_configuration_cache_reuse) ... ok
+test_class_and_documentation_changes_survive (test_compare_publications.ComparePublicationsTest.test_class_and_documentation_changes_survive) ... ok
+test_cli_require_equal_writes_report_and_returns_verdict (test_compare_publications.ComparePublicationsTest.test_cli_require_equal_writes_report_and_returns_verdict) ... ok
+test_dependency_and_gradle_provenance_changes_survive_normalization (test_compare_publications.ComparePublicationsTest.test_dependency_and_gradle_provenance_changes_survive_normalization) ... ok
+test_duplicate_archive_entries_are_rejected (test_compare_publications.ComparePublicationsTest.test_duplicate_archive_entries_are_rejected) ... ok
+test_expected_set_requires_all_five_files_per_module (test_compare_publications.ComparePublicationsTest.test_expected_set_requires_all_five_files_per_module) ... ok
+test_extra_artifact_is_rejected (test_compare_publications.ComparePublicationsTest.test_extra_artifact_is_rejected) ... ok
+test_missing_artifact_is_rejected (test_compare_publications.ComparePublicationsTest.test_missing_artifact_is_rejected) ... ok
+test_missing_metadata_fields_have_context (test_compare_publications.ComparePublicationsTest.test_missing_metadata_fields_have_context) ... ok
+test_nested_artifact_record_is_rejected (test_compare_publications.ComparePublicationsTest.test_nested_artifact_record_is_rejected) ... ok
+test_normalization_never_deflates_even_for_deflated_inputs (test_compare_publications.ComparePublicationsTest.test_normalization_never_deflates_even_for_deflated_inputs) ... ok
+test_only_archive_order_timestamps_and_matching_metadata_hashes_are_normalized (test_compare_publications.ComparePublicationsTest.test_only_archive_order_timestamps_and_matching_metadata_hashes_are_normalized) ... ok
+test_pom_and_module_formatting_differences_survive (test_compare_publications.ComparePublicationsTest.test_pom_and_module_formatting_differences_survive) ... ok
+test_publications_shape_is_validated (test_compare_publications.ComparePublicationsTest.test_publications_shape_is_validated) ... ok
+test_stale_metadata_cannot_be_blessed_by_recomputed_hashes (test_compare_publications.ComparePublicationsTest.test_stale_metadata_cannot_be_blessed_by_recomputed_hashes) ... ok
+test_unexpected_url_record_is_rejected (test_compare_publications.ComparePublicationsTest.test_unexpected_url_record_is_rejected) ... ok
+test_wrong_checksum_is_rejected_even_when_size_matches (test_compare_publications.ComparePublicationsTest.test_wrong_checksum_is_rejected_even_when_size_matches) ... ok
+test_zip_metadata_differences_survive (test_compare_publications.ComparePublicationsTest.test_zip_metadata_differences_survive) ... ok
+test_actual_plugin_bundle_replacement_is_rejected_even_if_receipt_copy_is_verified (test_final_receipt.FinalReceiptTest.test_actual_plugin_bundle_replacement_is_rejected_even_if_receipt_copy_is_verified) ... ok
+test_all_macos_acceptance_reports_require_supported_os (test_final_receipt.FinalReceiptTest.test_all_macos_acceptance_reports_require_supported_os) ... ok
+test_cached_task_cannot_claim_passed (test_final_receipt.FinalReceiptTest.test_cached_task_cannot_claim_passed) ... ok
+test_final_valid_and_preliminary_rejected (test_final_receipt.FinalReceiptTest.test_final_valid_and_preliminary_rejected) ... ok
+test_minimum_host_requires_supported_minor_and_accepts_patch_releases (test_final_receipt.FinalReceiptTest.test_minimum_host_requires_supported_minor_and_accepts_patch_releases) ... ok
+test_missing_reports_changed_plan_and_logs_block_upload (test_final_receipt.FinalReceiptTest.test_missing_reports_changed_plan_and_logs_block_upload) ... ok
+test_plugin_digests_are_reviewed_record_anchors_after_full_verification (test_final_receipt.FinalReceiptTest.test_plugin_digests_are_reviewed_record_anchors_after_full_verification) ... ok
+test_plugin_digests_cli_stdout_contract (test_final_receipt.FinalReceiptTest.test_plugin_digests_cli_stdout_contract) ... ok
+test_real_bundle_check_does_not_authorize_a_different_plugin_upload_file (test_final_receipt.FinalReceiptTest.test_real_bundle_check_does_not_authorize_a_different_plugin_upload_file) ... ok
+test_receipt_cannot_select_a_different_upload_path (test_final_receipt.FinalReceiptTest.test_receipt_cannot_select_a_different_upload_path) ... ok
+test_report_cannot_invent_runtime_properties (test_final_receipt.FinalReceiptTest.test_report_cannot_invent_runtime_properties) ... ok
+test_answer_projection_decodes_longest_code_and_checks_full_body_digest (test_license_resolution.LicenseResolutionTest.test_answer_projection_decodes_longest_code_and_checks_full_body_digest) ... ok
+test_cli_reports_incomplete_http_read_without_caching_partial_response (test_license_resolution.LicenseResolutionTest.test_cli_reports_incomplete_http_read_without_caching_partial_response) ... ok
+test_cli_reports_missing_sources_and_unexpected_json_types_without_tracebacks (test_license_resolution.LicenseResolutionTest.test_cli_reports_missing_sources_and_unexpected_json_types_without_tracebacks) ... ok
+test_comment_projection_has_exact_ascii_serialization_and_api_order (test_license_resolution.LicenseResolutionTest.test_comment_projection_has_exact_ascii_serialization_and_api_order) ... ok
+test_comment_projection_rejects_partial_or_malformed_responses (test_license_resolution.LicenseResolutionTest.test_comment_projection_rejects_partial_or_malformed_responses) ... ok
+test_extraction_starts_at_name_and_only_attached_signs_are_literals (test_license_resolution.LicenseResolutionTest.test_extraction_starts_at_name_and_only_attached_signs_are_literals) ... ok
+test_non_string_source_urls_fail_before_cache_or_network_access (test_license_resolution.LicenseResolutionTest.test_non_string_source_urls_fail_before_cache_or_network_access) ... ok
+test_url_bound_inputs_rehash_hits_and_never_cache_failed_projection (test_license_resolution.LicenseResolutionTest.test_url_bound_inputs_rehash_hits_and_never_cache_failed_projection) ... ok
+test_all_three_artifacts_require_every_reviewed_text (test_native_licenses.NativeLicensesTest.test_all_three_artifacts_require_every_reviewed_text) ... ok
+test_corrupt_cache_and_changed_wheel_fail (test_native_licenses.NativeLicensesTest.test_corrupt_cache_and_changed_wheel_fail) ... ok
+test_distinct_urls_with_shared_digest_are_fetched_independently (test_native_licenses.NativeLicensesTest.test_distinct_urls_with_shared_digest_are_fetched_independently) ... ok
+test_fragments_and_line_ranges_must_be_valid_and_in_the_component_section (test_native_licenses.NativeLicensesTest.test_fragments_and_line_ranges_must_be_valid_and_in_the_component_section) ... ok
+test_github_rewrite_and_atomic_cache_write_then_read_only_hit (test_native_licenses.NativeLicensesTest.test_github_rewrite_and_atomic_cache_write_then_read_only_hit) ... ok
+test_interrupted_cache_replace_leaves_no_partial_entry (test_native_licenses.NativeLicensesTest.test_interrupted_cache_replace_leaves_no_partial_entry) ... ok
+test_inventory_cannot_drop_any_required_text (test_native_licenses.NativeLicensesTest.test_inventory_cannot_drop_any_required_text) ... ok
+test_license_equals_rules_remain_inside_the_component_section (test_native_licenses.NativeLicensesTest.test_license_equals_rules_remain_inside_the_component_section) ... ok
+test_main_jar_scans_other_entries_but_keeps_native_payload_validation_separate (test_native_licenses.NativeLicensesTest.test_main_jar_scans_other_entries_but_keeps_native_payload_validation_separate) ... ok
+test_native_cli_checks_companion_notices_and_personal_paths (test_native_licenses.NativeLicensesTest.test_native_cli_checks_companion_notices_and_personal_paths) ... ok
+test_native_main_missing_reviewed_text_fails_before_payload_parsing (test_native_licenses.NativeLicensesTest.test_native_main_missing_reviewed_text_fails_before_payload_parsing) ... ok
+test_non_utf8_locale_reads_notices_as_utf8 (test_native_licenses.NativeLicensesTest.test_non_utf8_locale_reads_notices_as_utf8) ... ok
+test_notice_hash_update_cannot_hide_missing_upstream_attribution (test_native_licenses.NativeLicensesTest.test_notice_hash_update_cannot_hide_missing_upstream_attribution) ... ok
+test_require_clear_cli_writes_findings_and_exits_nonzero (test_native_licenses.NativeLicensesTest.test_require_clear_cli_writes_findings_and_exits_nonzero) ... ok
+test_stack_exchange_body_and_unexpected_responses (test_native_licenses.NativeLicensesTest.test_stack_exchange_body_and_unexpected_responses) ... ok
+test_valid_sources_and_texts_do_not_clear_unresolved_findings (test_native_licenses.NativeLicensesTest.test_valid_sources_and_texts_do_not_clear_unresolved_findings) ... ok
+test_wheel_member_has_its_own_digest_and_packaged_text_check (test_native_licenses.NativeLicensesTest.test_wheel_member_has_its_own_digest_and_packaged_text_check) ... ok
+test_unstaged_local_jar_succeeds_but_combined_publish_fails (test_native_publish.NativePublishTest.test_unstaged_local_jar_succeeds_but_combined_publish_fails) ... ok
+test_reviewed_hashes_and_receipt_gate_protect_the_actual_upload (test_plugin_upload.PluginUploadTest.test_reviewed_hashes_and_receipt_gate_protect_the_actual_upload) ... ok
+test_bundle_digest_tag_and_path_checks (test_release_inputs.ReleaseInputsTest.test_bundle_digest_tag_and_path_checks) ... ok
+test_invalid_manifest_variants (test_release_inputs.ReleaseInputsTest.test_invalid_manifest_variants) ... ok
+test_macho_minimum_and_malformed_commands (test_release_inputs.ReleaseInputsTest.test_macho_minimum_and_malformed_commands) ... ok
+test_native_target_and_local_paths_are_blocking (test_release_inputs.ReleaseInputsTest.test_native_target_and_local_paths_are_blocking) ... ok
+test_notice_wheel_digest_is_checked_against_bootstrap_not_only_its_inventory_hash (test_release_inputs.ReleaseInputsTest.test_notice_wheel_digest_is_checked_against_bootstrap_not_only_its_inventory_hash) ... ok
+test_preflight_does_not_probe_until_local_versions_are_valid (test_release_inputs.ReleaseInputsTest.test_preflight_does_not_probe_until_local_versions_are_valid) ... ok
+test_selection_and_duplicates (test_release_inputs.ReleaseInputsTest.test_selection_and_duplicates) ... ok
+test_archive_filter_requirement_is_reported_before_io (test_reproduce_audit.ReproduceAuditTest.test_archive_filter_requirement_is_reported_before_io) ... ok
+test_archive_requires_one_jdk_and_rejects_path_traversal (test_reproduce_audit.ReproduceAuditTest.test_archive_requires_one_jdk_and_rejects_path_traversal) ... ok
+test_central_download_hash_is_checked (test_reproduce_audit.ReproduceAuditTest.test_central_download_hash_is_checked) ... ok
+test_environment_removes_injection_and_controls_locale (test_reproduce_audit.ReproduceAuditTest.test_environment_removes_injection_and_controls_locale) ... ok
+test_every_daemon_and_compiler_javadoc_identity_is_checked (test_reproduce_audit.ReproduceAuditTest.test_every_daemon_and_compiler_javadoc_identity_is_checked) ... ok
+test_git_ignores_caller_config_and_environment_injection (test_reproduce_audit.ReproduceAuditTest.test_git_ignores_caller_config_and_environment_injection) ... ok
+test_gradle_version_is_checked (test_reproduce_audit.ReproduceAuditTest.test_gradle_version_is_checked) ... ok
+test_jdk_archive_is_verified_before_extraction (test_reproduce_audit.ReproduceAuditTest.test_jdk_archive_is_verified_before_extraction) ... ok
+test_result_requires_exact_artifacts_and_verdict (test_reproduce_audit.ReproduceAuditTest.test_result_requires_exact_artifacts_and_verdict) ... ok
+test_source_assignment_and_missing_source_no_fallback (test_resolution.ResolutionTest.test_source_assignment_and_missing_source_no_fallback) ... ok
+test_extraction_failure_cleans_partial_repository (test_runner_cleanup.RunnerCleanupTest.test_extraction_failure_cleans_partial_repository) ... ok
+test_clt_only_does_not_require_xcodebuild (test_runtime_evidence.RuntimeEvidenceTest.test_clt_only_does_not_require_xcodebuild) ... ok
+test_explicit_java_home_returns_measured_vendor_build_and_path (test_runtime_evidence.RuntimeEvidenceTest.test_explicit_java_home_returns_measured_vendor_build_and_path) ... ok
+test_xcodebuild_failure_falls_back_to_clt_metadata (test_runtime_evidence.RuntimeEvidenceTest.test_xcodebuild_failure_falls_back_to_clt_metadata) ... ok
+
+----------------------------------------------------------------------
+Ran 82 tests in 50.286s
+
+OK
diff --git a/req/plans/evidence/native-license-resolution-2026-11-16/url-validation-result.json b/req/plans/evidence/native-license-resolution-2026-11-16/url-validation-result.json
new file mode 100644
index 00000000..01f53a2b
--- /dev/null
+++ b/req/plans/evidence/native-license-resolution-2026-11-16/url-validation-result.json
@@ -0,0 +1,21 @@
+{
+ "schema": 1,
+ "inputCache": "build/releaseAll/license-resolution-inputs",
+ "networkUsed": false,
+ "cases": [
+ {
+ "field": "comment-url",
+ "value": 123,
+ "exitCode": 1,
+ "message": "license comparison: source url must be a string",
+ "traceback": false
+ },
+ {
+ "field": "comparison-source",
+ "value": 123,
+ "exitCode": 1,
+ "message": "license comparison: source url must be a string",
+ "traceback": false
+ }
+ ]
+}
diff --git a/tools/release-all/tests/test_license_resolution.py b/tools/release-all/tests/test_license_resolution.py
index d69d7696..9d457af7 100644
--- a/tools/release-all/tests/test_license_resolution.py
+++ b/tools/release-all/tests/test_license_resolution.py
@@ -115,6 +115,9 @@ def test_cli_reports_missing_sources_and_unexpected_json_types_without_traceback
({"sources": []}, {"records": None}, "not iterable"),
({"sources": []}, {"records": [None]}, "comparison record must have a string id"),
({"sources": []}, {"records": [{"id": 1}]}, "comparison record must have a string id"),
+ ({"sources": []}, {"records": [
+ {"id": "mlx-source", "source": 123, "inputSha256": "0" * 64}]},
+ "source url must be a string"),
]
for research, comparison, message in cases:
with self.subTest(research=research, comparison=comparison):
@@ -129,6 +132,16 @@ def test_cli_reports_missing_sources_and_unexpected_json_types_without_traceback
self.assertIn(message, result.stderr)
self.assertNotIn("Traceback", result.stderr)
+ def test_non_string_source_urls_fail_before_cache_or_network_access(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ inputs = Path(temporary) / "inputs"
+ with patch.object(C.urllib.request, "urlopen") as fetch:
+ for url in (123, None, [], {}, b"https://example.invalid/source"):
+ with self.subTest(url=url), self.assertRaisesRegex(ValueError, "source url must be a string"):
+ C.read_source(url, "0" * 64, lambda raw: raw, inputs, True)
+ fetch.assert_not_called()
+ self.assertFalse(inputs.exists())
+
def test_cli_reports_incomplete_http_read_without_caching_partial_response(self):
with tempfile.TemporaryDirectory() as temporary:
root = Path(temporary)