From 9b660f6d78243ad1b2d9ea9d13dfecc173742548 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 26 Jun 2026 21:58:09 +0000 Subject: [PATCH] fix(d,ci): mark Result factory methods nothrow + accept CC-BY-SA-4.0 in Trustfile gate Two pre-existing proven CI failures (surfaced once #174 unblocked d-build): D nothrow (d-build compile): parseHexColor/parseCurrency/parseIsoDateTime/parsePhone/parseUrl are marked 'nothrow' but called the *Result.success/.failure factory methods, which were not nothrow -> ldc2 errors. Those factories only construct and return a struct (no throwing ops), so marking the 10 methods 'nothrow' is correct and minimal. Trustfile 'Enforce Trustfile Policies' gate: The SPDX check required MPL-2.0 on every file under src/ffi/bindings, flagging 27 documentation READMEs that correctly carry CC-BY-SA-4.0 (estate docs licence). Changed the gate to accept either MPL-2.0 (code) or CC-BY-SA-4.0 (docs) and flag only headers that are neither -- still catches stray PMPL/Apache/etc. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01SuLNP87x3i5YXdq2wYERRK --- .github/workflows/trustfile.yml | 9 +++++---- bindings/d/source/proven/safe_color.d | 4 ++-- bindings/d/source/proven/safe_currency.d | 4 ++-- bindings/d/source/proven/safe_datetime.d | 4 ++-- bindings/d/source/proven/safe_phone.d | 4 ++-- bindings/d/source/proven/safe_url.d | 4 ++-- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/trustfile.yml b/.github/workflows/trustfile.yml index 5b15cd65..41238386 100644 --- a/.github/workflows/trustfile.yml +++ b/.github/workflows/trustfile.yml @@ -87,13 +87,14 @@ jobs: uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - name: Check SPDX license compliance run: | - # All source files must use MPL-2.0 + # Estate licence policy: code is MPL-2.0, docs are CC-BY-SA-4.0. + # Flag only files whose SPDX header is neither of the two. WRONG_LICENSE=$(grep -rl "SPDX-License-Identifier:" src/ ffi/ bindings/ 2>/dev/null | \ - xargs grep -L "MPL-2.0" 2>/dev/null | wc -l) + xargs grep -LE "MPL-2.0|CC-BY-SA-4.0" 2>/dev/null | wc -l) if [ "$WRONG_LICENSE" -gt 0 ]; then - echo "ERROR: $WRONG_LICENSE files have incorrect SPDX license headers" + echo "ERROR: $WRONG_LICENSE files have an SPDX header that is neither MPL-2.0 (code) nor CC-BY-SA-4.0 (docs)" grep -rl "SPDX-License-Identifier:" src/ ffi/ bindings/ 2>/dev/null | \ - xargs grep -L "MPL-2.0" 2>/dev/null | head -20 + xargs grep -LE "MPL-2.0|CC-BY-SA-4.0" 2>/dev/null | head -20 exit 1 fi echo "License compliance: PASS" diff --git a/bindings/d/source/proven/safe_color.d b/bindings/d/source/proven/safe_color.d index 4ad3cb67..f2f572bd 100644 --- a/bindings/d/source/proven/safe_color.d +++ b/bindings/d/source/proven/safe_color.d @@ -46,12 +46,12 @@ struct ColorResult string error; bool ok; - static ColorResult success(RGB color) + static ColorResult success(RGB color) nothrow { return ColorResult(color, "", true); } - static ColorResult failure(string error) + static ColorResult failure(string error) nothrow { return ColorResult(RGB.init, error, false); } diff --git a/bindings/d/source/proven/safe_currency.d b/bindings/d/source/proven/safe_currency.d index d7ae709e..1dba1cad 100644 --- a/bindings/d/source/proven/safe_currency.d +++ b/bindings/d/source/proven/safe_currency.d @@ -24,12 +24,12 @@ struct CurrencyResult string error; bool ok; - static CurrencyResult success(long amount, ubyte[3] code, ubyte decimals) + static CurrencyResult success(long amount, ubyte[3] code, ubyte decimals) nothrow { return CurrencyResult(amount, code, decimals, "", true); } - static CurrencyResult failure(string error) + static CurrencyResult failure(string error) nothrow { return CurrencyResult(0, [0, 0, 0], 0, error, false); } diff --git a/bindings/d/source/proven/safe_datetime.d b/bindings/d/source/proven/safe_datetime.d index 18c8763b..25855483 100644 --- a/bindings/d/source/proven/safe_datetime.d +++ b/bindings/d/source/proven/safe_datetime.d @@ -52,12 +52,12 @@ struct DateTimeResult string error; bool ok; - static DateTimeResult success(DateTime dt) + static DateTimeResult success(DateTime dt) nothrow { return DateTimeResult(dt, "", true); } - static DateTimeResult failure(string error) + static DateTimeResult failure(string error) nothrow { return DateTimeResult(DateTime.init, error, false); } diff --git a/bindings/d/source/proven/safe_phone.d b/bindings/d/source/proven/safe_phone.d index f80bd40a..ef9b383c 100644 --- a/bindings/d/source/proven/safe_phone.d +++ b/bindings/d/source/proven/safe_phone.d @@ -30,12 +30,12 @@ struct PhoneResult string error; bool ok; - static PhoneResult success(PhoneNumber phone) + static PhoneResult success(PhoneNumber phone) nothrow { return PhoneResult(phone, "", true); } - static PhoneResult failure(string error) + static PhoneResult failure(string error) nothrow { return PhoneResult(PhoneNumber.init, error, false); } diff --git a/bindings/d/source/proven/safe_url.d b/bindings/d/source/proven/safe_url.d index 65c0a393..329ece61 100644 --- a/bindings/d/source/proven/safe_url.d +++ b/bindings/d/source/proven/safe_url.d @@ -39,12 +39,12 @@ struct UrlResult string error; bool ok; - static UrlResult success(ParsedUrl url) + static UrlResult success(ParsedUrl url) nothrow { return UrlResult(url, "", true); } - static UrlResult failure(string error) + static UrlResult failure(string error) nothrow { return UrlResult(ParsedUrl.init, error, false); }