commit 60ce9294ff271bc311b7d18af97dc78e48e75377
parent be76b8fac3e9cf520e280480535e416289879d2f
Author: triesap <tyson@radroots.org>
Date: Fri, 23 Oct 2026 13:19:12 +0000
codegen: Retain complete pinned data material in derived artifacts
- Generate bounded Domain notices from exact currency and timezone provenance inputs.
- Copy complete material into SDK package and Swift/Kotlin binding outputs.
- Bind notice bytes to source locks and canonical contract freshness checks.
- Verify actual generators, package inclusion and existing service license collection.
Diffstat:
15 files changed, 802 insertions(+), 7 deletions(-)
diff --git a/contracts/codegen/redistribution_materials.v1.json b/contracts/codegen/redistribution_materials.v1.json
@@ -0,0 +1,33 @@
+{
+ "schema": "radroots.redistribution_materials.v1",
+ "output": "crates/domain/NOTICE",
+ "max_input_bytes": 16384,
+ "max_output_bytes": 65536,
+ "source_distribution": "Retain exact material texts and provenance; currency facts are separately Apache-2.0, timezone dependency MIT is selected. Radroots Rust source remains MIT OR Apache-2.0.",
+ "materials": [
+ {
+ "path": "crates/domain/data/currency_registry_v1.csv",
+ "sha256": "60d8282b2d7ddc27929b097d4de9e76a900a64f1de4a5aa7a4cb3308b55b82d0"
+ },
+ {
+ "path": "crates/domain/data/currency_registry_v1.notice",
+ "sha256": "c43ef0d0f9d6f64656ca6a619c3c43cd9cc2b378217ab19a083ca92255a91d7d"
+ },
+ {
+ "path": "crates/domain/data/currency_registry_v1.license",
+ "sha256": "665618a8c4b9ef6ceafb35482a3e010834fae9e9cbb22041b74310bcc52ac500"
+ },
+ {
+ "path": "crates/domain/data/timezone_registry_v1.notice",
+ "sha256": "af3945c88f4843e34f418d88fcc690dc6f71387c679fd63b2f5684381dfe177e"
+ },
+ {
+ "path": "crates/domain/data/timezone_registry_v1.license",
+ "sha256": "0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f"
+ },
+ {
+ "path": "crates/domain/data/timezone_registry_v1.copying",
+ "sha256": "01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f"
+ }
+ ]
+}
diff --git a/crates/domain/Cargo.toml b/crates/domain/Cargo.toml
@@ -10,7 +10,7 @@ repository.workspace = true
homepage.workspace = true
description = "Exact values and deterministic shared Radroots domain invariants"
readme = "README.md"
-include = ["src/**", "tests/**", "data/**", "Cargo.toml", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
+include = ["src/**", "tests/**", "data/**", "Cargo.toml", "README.md", "LICENSE-APACHE", "LICENSE-MIT", "NOTICE"]
[features]
default = ["std", "serde"]
diff --git a/crates/domain/NOTICE b/crates/domain/NOTICE
@@ -0,0 +1,448 @@
+Radroots data redistribution material v1
+
+Generated by cargo xtask generate data-notices --write.
+Retain this complete file with derived artifacts.
+
+Retain exact material texts and provenance; currency facts are separately Apache-2.0, timezone dependency MIT is selected. Radroots Rust source remains MIT OR Apache-2.0.
+
+===== crates/domain/data/currency_registry_v1.csv / sha256:60d8282b2d7ddc27929b097d4de9e76a900a64f1de4a5aa7a4cb3308b55b82d0 =====
+# SPDX-License-Identifier: Apache-2.0
+# Copyright 2023-2026 rust_iso4217 contributors
+# Derived from rust-iso/rust_iso4217 ce6b74546b3645ce11866acc93117128d2f7b1e0.
+# Modified by Radroots: retain current currency/fund code and exponent pairs
+# in range 0-4; sort by code; omit all names, countries, other data and code.
+# See currency_registry_v1.license and currency_registry_v1.notice.
+AED,2
+AFN,2
+ALL,2
+AMD,2
+AOA,2
+ARS,2
+AUD,2
+AWG,2
+AZN,2
+BAM,2
+BBD,2
+BDT,2
+BHD,3
+BIF,0
+BMD,2
+BND,2
+BOB,2
+BOV,2
+BRL,2
+BSD,2
+BTN,2
+BWP,2
+BYN,2
+BZD,2
+CAD,2
+CDF,2
+CHE,2
+CHF,2
+CHW,2
+CLF,4
+CLP,0
+CNY,2
+COP,2
+COU,2
+CRC,2
+CUP,2
+CVE,2
+CZK,2
+DJF,0
+DKK,2
+DOP,2
+DZD,2
+EGP,2
+ERN,2
+ETB,2
+EUR,2
+FJD,2
+FKP,2
+GBP,2
+GEL,2
+GHS,2
+GIP,2
+GMD,2
+GNF,0
+GTQ,2
+GYD,2
+HKD,2
+HNL,2
+HTG,2
+HUF,2
+IDR,2
+ILS,2
+INR,2
+IQD,3
+IRR,2
+ISK,0
+JMD,2
+JOD,3
+JPY,0
+KES,2
+KGS,2
+KHR,2
+KMF,0
+KPW,2
+KRW,0
+KWD,3
+KYD,2
+KZT,2
+LAK,2
+LBP,2
+LKR,2
+LRD,2
+LSL,2
+LYD,3
+MAD,2
+MDL,2
+MGA,2
+MKD,2
+MMK,2
+MNT,2
+MOP,2
+MRU,2
+MUR,2
+MVR,2
+MWK,2
+MXN,2
+MXV,2
+MYR,2
+MZN,2
+NAD,2
+NGN,2
+NIO,2
+NOK,2
+NPR,2
+NZD,2
+OMR,3
+PAB,2
+PEN,2
+PGK,2
+PHP,2
+PKR,2
+PLN,2
+PYG,0
+QAR,2
+RON,2
+RSD,2
+RUB,2
+RWF,0
+SAR,2
+SBD,2
+SCR,2
+SDG,2
+SEK,2
+SGD,2
+SHP,2
+SLE,2
+SOS,2
+SRD,2
+SSP,2
+STN,2
+SVC,2
+SYP,2
+SZL,2
+THB,2
+TJS,2
+TMT,2
+TND,3
+TOP,2
+TRY,2
+TTD,2
+TWD,2
+TZS,2
+UAH,2
+UGX,0
+USD,2
+USN,2
+UYI,0
+UYU,2
+UYW,4
+UZS,2
+VED,2
+VES,2
+VND,0
+VUV,0
+WST,2
+XAD,2
+XAF,0
+XCD,2
+XCG,2
+XOF,0
+XPF,0
+YER,2
+ZAR,2
+ZMW,2
+ZWG,2
+
+===== crates/domain/data/currency_registry_v1.notice / sha256:c43ef0d0f9d6f64656ca6a619c3c43cd9cc2b378217ab19a083ca92255a91d7d =====
+Currency registry v1 data attribution
+
+Copyright 2023-2026 rust_iso4217 contributors
+Apache License 2.0; see currency_registry_v1.license.
+
+Source: https://github.com/rust-iso/rust_iso4217
+Revision: ce6b74546b3645ce11866acc93117128d2f7b1e0
+Original material: src/lib.rs (SHA256 7401727ea4da05fcbf0d1d679705c0245989e83dbc697e831066f992875e183d).
+
+Radroots changes: extract only current currency/fund alphabetic code and
+minor-unit exponent facts in range 0-4; sort them; omit historic entries,
+no-minor-unit entries, names, countries, numeric identifiers and all upstream
+Rust/generator implementation. The Rust API is independently implemented.
+This derived data retains the upstream Apache-2.0 license and attribution.
+
+The publisher identifies SIX ISO 4217 lists as its currency source and Datahub
+as its country-relationship source. No country relationships are included here.
+All 165 selected pairs match the separately acquired official SIX List One
+snapshot published 2026-09-17. The XML and ISO standard text are not distributed.
+No cash/display rounding, exchange rate, payment rule or currency conversion
+is implied. The registry is fixed; replacement requires explicit versioned
+contract and provenance review. Derived artifacts must include this material
+and its license/notice before adopting it.
+
+===== crates/domain/data/currency_registry_v1.license / sha256:665618a8c4b9ef6ceafb35482a3e010834fae9e9cbb22041b74310bcc52ac500 =====
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or Derivative
+ Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2023-2026 rust_iso4217 contributors
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+===== crates/domain/data/timezone_registry_v1.notice / sha256:af3945c88f4843e34f418d88fcc690dc6f71387c679fd63b2f5684381dfe177e =====
+Timezone registry v1 data attribution
+
+Package: jiff-tzdb 0.1.8; IANA time zone database 2026c.
+Source: https://crates.io/crates/jiff-tzdb/0.1.8
+Exact published crate SHA256: 142bd39932ad231f10513df9ab62661fead8719872150b7ad02a2df79f4e141e.
+Selected redistribution license: MIT (upstream offers Unlicense OR MIT).
+The accompanying timezone_registry_v1.license and timezone_registry_v1.copying
+retain the exact upstream LICENSE-MIT and COPYING texts. No upstream Rust or
+zoneinfo data is copied into these source notice inputs. The separately locked
+jiff-tzdb dependency supplies the database; this material accompanies derived
+artifacts without asserting physical location or present-day time-zone policy.
+
+===== crates/domain/data/timezone_registry_v1.license / sha256:0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f =====
+The MIT License (MIT)
+
+Copyright (c) 2015 Andrew Gallant
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+===== crates/domain/data/timezone_registry_v1.copying / sha256:01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f =====
+This project is dual-licensed under the Unlicense and MIT licenses.
+
+You may use this code under the terms of either license.
diff --git a/crates/domain/README.md b/crates/domain/README.md
@@ -1,5 +1,11 @@
# Radroots domain
+The generated `NOTICE` retains the pinned currency facts, original data
+attribution and license texts, and selected MIT timezone dependency material.
+Keep it with derived artifacts. Regenerate it from the source-owned contract
+with `cargo extbuild run -- cargo xtask generate data-notices --write`;
+`--check` and canonical contract validation enforce byte freshness.
+
Independently implemented exact values for the shared SDK successor. This
pre-release package provides validated values and public sale-option offer
terms. It does not execute commands, install agreements or establish stock.
diff --git a/crates/domain/data/timezone_registry_v1.copying b/crates/domain/data/timezone_registry_v1.copying
@@ -0,0 +1,3 @@
+This project is dual-licensed under the Unlicense and MIT licenses.
+
+You may use this code under the terms of either license.
diff --git a/crates/domain/data/timezone_registry_v1.license b/crates/domain/data/timezone_registry_v1.license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Andrew Gallant
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/crates/domain/data/timezone_registry_v1.notice b/crates/domain/data/timezone_registry_v1.notice
@@ -0,0 +1,11 @@
+Timezone registry v1 data attribution
+
+Package: jiff-tzdb 0.1.8; IANA time zone database 2026c.
+Source: https://crates.io/crates/jiff-tzdb/0.1.8
+Exact published crate SHA256: 142bd39932ad231f10513df9ab62661fead8719872150b7ad02a2df79f4e141e.
+Selected redistribution license: MIT (upstream offers Unlicense OR MIT).
+The accompanying timezone_registry_v1.license and timezone_registry_v1.copying
+retain the exact upstream LICENSE-MIT and COPYING texts. No upstream Rust or
+zoneinfo data is copied into these source notice inputs. The separately locked
+jiff-tzdb dependency supplies the database; this material accompanies derived
+artifacts without asserting physical location or present-day time-zone policy.
diff --git a/tools/xtask/src/generate/data_notices.rs b/tools/xtask/src/generate/data_notices.rs
@@ -0,0 +1,191 @@
+//! Exact source-owned redistribution material for every derived artifact.
+use std::{fs, path::Path};
+
+use serde::Deserialize;
+use sha2::{Digest, Sha256};
+
+use crate::{build_control::Mode, sdk_generation::fs::write_or_check};
+
+pub(crate) const CONTRACT: &str = "contracts/codegen/redistribution_materials.v1.json";
+pub(crate) const OUTPUT: &str = "crates/domain/NOTICE";
+const MATERIALS: [&str; 6] = [
+ "crates/domain/data/currency_registry_v1.csv",
+ "crates/domain/data/currency_registry_v1.notice",
+ "crates/domain/data/currency_registry_v1.license",
+ "crates/domain/data/timezone_registry_v1.notice",
+ "crates/domain/data/timezone_registry_v1.license",
+ "crates/domain/data/timezone_registry_v1.copying",
+];
+
+#[derive(Deserialize)]
+#[serde(deny_unknown_fields)]
+struct Contract {
+ schema: String,
+ output: String,
+ max_input_bytes: usize,
+ max_output_bytes: usize,
+ source_distribution: String,
+ materials: Vec<Material>,
+}
+#[derive(Deserialize)]
+#[serde(deny_unknown_fields)]
+struct Material {
+ path: String,
+ sha256: String,
+}
+
+fn read(root: &Path, name: &str) -> Result<String, String> {
+ let path = root.join(name);
+ let metadata =
+ fs::symlink_metadata(&path).map_err(|_| "redistribution material is missing".to_owned())?;
+ if !metadata.is_file() || metadata.len() > 16_384 {
+ return Err("redistribution material must be a bounded regular file".to_owned());
+ }
+ let value =
+ fs::read_to_string(path).map_err(|_| "redistribution material must be UTF8".to_owned())?;
+ if value.is_empty() || value.len() > 16_384 {
+ return Err("redistribution material size is invalid".to_owned());
+ }
+ Ok(value)
+}
+
+/// Render original material verbatim; no timestamp, source path or host state.
+pub(crate) fn render(root: &Path) -> Result<String, String> {
+ let contract: Contract = serde_json::from_str(&read(root, CONTRACT)?)
+ .map_err(|_| "invalid redistribution materials contract".to_owned())?;
+ if contract.schema != "radroots.redistribution_materials.v1"
+ || contract.output != OUTPUT
+ || contract.max_input_bytes != 16_384
+ || contract.max_output_bytes != 65_536
+ || contract.source_distribution.trim().is_empty()
+ || !contract
+ .materials
+ .iter()
+ .map(|v| v.path.as_str())
+ .eq(MATERIALS)
+ {
+ return Err("redistribution material authority drifted".to_owned());
+ }
+ let mut output = String::from(
+ "Radroots data redistribution material v1\n\nGenerated by cargo xtask generate data-notices --write.\nRetain this complete file with derived artifacts.\n\n",
+ );
+ output.push_str(&contract.source_distribution);
+ output.push('\n');
+ for material in contract.materials {
+ let text = read(root, &material.path)?;
+ let digest = format!("{:x}", Sha256::digest(text.as_bytes()));
+ if digest != material.sha256 {
+ return Err("redistribution material digest mismatch".to_owned());
+ }
+ use std::fmt::Write as _;
+ write!(
+ output,
+ "\n===== {} / sha256:{} =====\n",
+ material.path, digest
+ )
+ .map_err(|_| "cannot render redistribution material".to_owned())?;
+ output.push_str(&text);
+ if !text.ends_with('\n') {
+ output.push('\n');
+ }
+ }
+ if output.len() > 65_536 {
+ return Err("redistribution material output exceeds its bound".to_owned());
+ }
+ Ok(output)
+}
+
+pub(crate) fn run(flag: &str, root: &Path) -> Result<(), String> {
+ let mode = match flag {
+ "--write" => Mode::Write,
+ "--check" => Mode::Check,
+ _ => return Err("data-notices requires exactly --write or --check".to_owned()),
+ };
+ write_or_check(&root.join(OUTPUT), &render(root)?, mode)
+}
+
+/// Copy the current complete material, requiring its owning generated source
+/// to be fresh. Consumer artifact checks compare bytes, not merely metadata.
+pub(crate) fn install(root: &Path, destination: &Path, mode: Mode) -> Result<String, String> {
+ let expected = render(root)?;
+ write_or_check(&root.join(OUTPUT), &expected, Mode::Check)?;
+ write_or_check(destination, &expected, mode)?;
+ Ok(format!("{:x}", Sha256::digest(expected.as_bytes())))
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn fixture() -> tempfile::TempDir {
+ let root = tempfile::tempdir().unwrap();
+ for name in [CONTRACT].into_iter().chain(MATERIALS) {
+ let destination = root.path().join(name);
+ fs::create_dir_all(destination.parent().unwrap()).unwrap();
+ fs::copy(crate::workspace_root().join(name), destination).unwrap();
+ }
+ root
+ }
+
+ #[test]
+ fn complete_exact_material_round_trips_and_rejects_stale_consumer_bytes() {
+ let root = fixture();
+ run("--write", root.path()).unwrap();
+ let output = fs::read_to_string(root.path().join(OUTPUT)).unwrap();
+ for name in MATERIALS {
+ assert!(output.contains(&read(root.path(), name).unwrap()));
+ }
+ run("--check", root.path()).unwrap();
+ run("--write", root.path()).unwrap();
+ assert_eq!(
+ fs::read_to_string(root.path().join(OUTPUT)).unwrap(),
+ output
+ );
+ let consumer = root.path().join("consumer/NOTICE");
+ install(root.path(), &consumer, Mode::Write).unwrap();
+ install(root.path(), &consumer, Mode::Check).unwrap();
+ fs::write(&consumer, "truncated material\n").unwrap();
+ assert!(install(root.path(), &consumer, Mode::Check).is_err());
+ fs::write(root.path().join(OUTPUT), "stale source\n").unwrap();
+ assert!(install(root.path(), &consumer, Mode::Write).is_err());
+ }
+
+ #[test]
+ fn missing_changed_oversized_and_nonregular_material_never_generates() {
+ for name in MATERIALS {
+ let root = fixture();
+ let path = root.path().join(name);
+ fs::remove_file(&path).unwrap();
+ assert!(run("--write", root.path()).is_err());
+ fs::write(&path, "changed\n").unwrap();
+ assert!(run("--write", root.path()).is_err());
+ fs::write(&path, vec![b'x'; 16_385]).unwrap();
+ assert!(run("--write", root.path()).is_err());
+ fs::remove_file(&path).unwrap();
+ fs::create_dir(&path).unwrap();
+ assert!(run("--write", root.path()).is_err());
+ assert!(!root.path().join(OUTPUT).exists());
+ }
+ }
+
+ #[test]
+ fn contract_cannot_select_extra_paths_or_silently_expand_limits() {
+ for field in [
+ "output",
+ "materials",
+ "max_input_bytes",
+ "max_output_bytes",
+ "schema",
+ "extra",
+ ] {
+ let root = fixture();
+ let path = root.path().join(CONTRACT);
+ let mut value: serde_json::Value =
+ serde_json::from_str(&fs::read_to_string(&path).unwrap()).unwrap();
+ value[field] = serde_json::json!("unapproved");
+ fs::write(&path, serde_json::to_vec(&value).unwrap()).unwrap();
+ assert!(run("--write", root.path()).is_err(), "{field}");
+ }
+ assert!(run("--unknown", fixture().path()).is_err());
+ }
+}
diff --git a/tools/xtask/src/generate/mod.rs b/tools/xtask/src/generate/mod.rs
@@ -1,10 +1,12 @@
use std::path::Path;
+pub(crate) mod data_notices;
pub(crate) mod protocol;
pub(crate) fn run(args: &[String], workspace_root: &Path) -> Result<(), String> {
match args {
[target, mode] if target == "protocol" => protocol::run(mode, workspace_root),
- _ => Err("usage: cargo xtask generate protocol --check|--write".to_owned()),
+ [target, mode] if target == "data-notices" => data_notices::run(mode, workspace_root),
+ _ => Err("usage: cargo xtask generate protocol|data-notices --check|--write".to_owned()),
}
}
diff --git a/tools/xtask/src/main.rs b/tools/xtask/src/main.rs
@@ -538,6 +538,7 @@ fn validate_contract() -> Result<(), String> {
service_repro_install::validate_contract(&root)?;
dto_roots::check(&root)?;
generate::protocol::check(&root)?;
+ generate::data_notices::run("--check", &root)?;
contract::load_contract_bundle(&root)
.and_then(|bundle| contract::validate_contract_bundle(&bundle))
.and_then(|_| contract::validate_canonical_event_boundary(&root))
diff --git a/tools/xtask/src/sdk_generation/bindings.rs b/tools/xtask/src/sdk_generation/bindings.rs
@@ -132,6 +132,9 @@ fn install_outputs(
if outputs.is_empty() {
return Err(format!("{language} binding generator emitted no files"));
}
+ let notice_hash =
+ crate::generate::data_notices::install(source_root, &output_dir.join("NOTICE"), mode)?;
+ outputs.insert("NOTICE".to_owned(), notice_hash);
let lock = SourceLock {
schema_version: 1,
source_package: FFI_PACKAGE.to_owned(),
@@ -239,7 +242,7 @@ fn check_language(
let expected_inventory = expected
.iter()
.map(|name| (*name).to_owned())
- .chain(["source.lock".to_owned()])
+ .chain(["source.lock".to_owned(), "NOTICE".to_owned()])
.collect::<BTreeSet<_>>();
if actual != expected_inventory {
return Err(format!(
@@ -261,6 +264,12 @@ fn check_language(
format!("{:x}", Sha256::digest(contents)),
);
}
+ let notice_hash = crate::generate::data_notices::install(
+ source_root,
+ &output_dir.join("NOTICE"),
+ Mode::Check,
+ )?;
+ outputs.insert("NOTICE".to_owned(), notice_hash);
let expected_lock = SourceLock {
schema_version: 1,
source_package: FFI_PACKAGE.to_owned(),
@@ -285,6 +294,9 @@ fn ffi_source_sha256(root: &Path) -> Result<String, String> {
let mut paths = vec![crate_dir.join("Cargo.toml"), crate_dir.join("README.md")];
collect_files(&crate_dir.join("src"), &mut paths)?;
paths.push(root.join("tools/xtask/src/sdk_generation/bindings.rs"));
+ paths.push(root.join("tools/xtask/src/generate/data_notices.rs"));
+ paths.push(root.join(crate::generate::data_notices::CONTRACT));
+ paths.push(root.join(crate::generate::data_notices::OUTPUT));
collect_files(
&root.join("tools/xtask/src/bin/radroots_ffi_bindgen"),
&mut paths,
@@ -342,7 +354,7 @@ mod tests {
let source = crate::workspace_root();
let output_dir = consumer.path().join("generated/swift");
fs::create_dir_all(&output_dir).expect("Swift output directory");
- let outputs = BTreeMap::from([
+ let mut outputs = BTreeMap::from([
("radroots_sdk.swift".to_owned(), "swift\n"),
("radroots_sdkFFI.h".to_owned(), "header\n"),
("radroots_sdkFFI.modulemap".to_owned(), "module\n"),
@@ -350,6 +362,9 @@ mod tests {
for (name, contents) in &outputs {
fs::write(output_dir.join(name), contents).expect("Swift fixture output");
}
+ let material = crate::generate::data_notices::render(&source).unwrap();
+ fs::write(output_dir.join("NOTICE"), &material).unwrap();
+ outputs.insert("NOTICE".to_owned(), material.as_str());
let lock = SourceLock {
schema_version: 1,
source_package: FFI_PACKAGE.to_owned(),
diff --git a/tools/xtask/src/sdk_generation/generate.rs b/tools/xtask/src/sdk_generation/generate.rs
@@ -57,6 +57,7 @@ mod tests {
fs::write(source.path().join("LICENSE-MIT"), "MIT fixture\n").expect("MIT license");
fs::write(source.path().join("LICENSE-APACHE"), "Apache fixture\n")
.expect("Apache license");
+ super::super::package_metadata::tests::prepare_materials(source.path());
for (package_name, package_dir) in package_specs()
.iter()
.map(|spec| (spec.package_name, spec.package_dir))
diff --git a/tools/xtask/src/sdk_generation/mod.rs b/tools/xtask/src/sdk_generation/mod.rs
@@ -1,7 +1,7 @@
mod bindings;
mod contracts;
mod dto_roots;
-mod fs;
+pub(crate) mod fs;
mod generate;
mod manifest;
mod output;
diff --git a/tools/xtask/src/sdk_generation/package_metadata.rs b/tools/xtask/src/sdk_generation/package_metadata.rs
@@ -50,7 +50,7 @@ pub(crate) fn package_description<'a>(
pub(crate) fn package_readme(package_name: &str, description: &str) -> String {
format!(
- "# {package_name}\n\n{description}\n\nThis package publishes generated ESM JavaScript, TypeScript declarations, and any runtime artifacts from the Radroots SDK build pipeline. Runtime files are distributed from `dist/`; source and provenance metadata are kept outside the npm package payload.\n\n## License\n\nLicensed under either MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE`.\n"
+ "# {package_name}\n\n{description}\n\nThis package publishes generated ESM JavaScript, TypeScript declarations, and any runtime artifacts from the Radroots SDK build pipeline. Runtime files are distributed from `dist/`; source and provenance metadata are kept outside the npm package payload.\n\n## License\n\nRadroots source is licensed under either MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE`. Retain `NOTICE` for the separately attributed pinned currency and timezone data material.\n"
)
}
@@ -68,6 +68,15 @@ fn write_package_metadata(
let previous_readme = fs::read_to_string(&readme_path).ok();
write_or_check(&readme_path, &readme, mode)?;
let mut changed = previous_readme.as_deref() != Some(readme.as_str());
+ let notice = package_dir.join("NOTICE");
+ let previous_notice = fs::read(¬ice).ok();
+ crate::generate::data_notices::install(source_root, ¬ice, mode)?;
+ changed |= previous_notice.as_deref()
+ != Some(
+ fs::read(¬ice)
+ .map_err(|_| "generated package NOTICE is missing".to_owned())?
+ .as_slice(),
+ );
for file_name in PACKAGE_LICENSE_FILES {
let source_path = source_root.join(file_name);
let contents = fs::read(&source_path)
@@ -108,7 +117,7 @@ fn package_name<'a>(
}
#[cfg(test)]
-mod tests {
+pub(crate) mod tests {
use std::{
fs,
path::PathBuf,
@@ -126,6 +135,7 @@ mod tests {
fs::create_dir_all(&package_dir).expect("create package");
fs::write(root.join("LICENSE-MIT"), "MIT license\n").expect("write MIT license");
fs::write(root.join("LICENSE-APACHE"), "Apache license\n").expect("write Apache license");
+ prepare_materials(&root);
fs::write(
package_dir.join("package.json"),
r#"{
@@ -151,6 +161,9 @@ mod tests {
);
write_package_metadata(&root, &package_dir, Mode::Check).expect("fresh metadata");
+ fs::write(package_dir.join("NOTICE"), "missing attribution\n").unwrap();
+ assert!(write_package_metadata(&root, &package_dir, Mode::Check).is_err());
+
let _ = fs::remove_dir_all(root);
}
@@ -167,4 +180,23 @@ mod tests {
let _ = fs::remove_dir_all(&root);
root
}
+
+ pub(crate) fn prepare_materials(root: &std::path::Path) {
+ let source = crate::workspace_root();
+ let contract = crate::generate::data_notices::CONTRACT;
+ let raw = fs::read(source.join(contract)).unwrap();
+ let value: serde_json::Value = serde_json::from_slice(&raw).unwrap();
+ for name in std::iter::once(contract).chain(
+ value["materials"]
+ .as_array()
+ .unwrap()
+ .iter()
+ .map(|v| v["path"].as_str().unwrap()),
+ ) {
+ let destination = root.join(name);
+ fs::create_dir_all(destination.parent().unwrap()).unwrap();
+ fs::copy(source.join(name), destination).unwrap();
+ }
+ crate::generate::data_notices::run("--write", root).unwrap();
+ }
}
diff --git a/tools/xtask/src/service_release_artifacts.rs b/tools/xtask/src/service_release_artifacts.rs
@@ -3363,6 +3363,37 @@ version = "0.1.0-alpha"
}
#[test]
+ fn dependency_license_admission_retains_complete_domain_data_material() {
+ let root = crate::workspace_root();
+ let mut dependency = package(
+ "domain",
+ "radroots_domain",
+ Some("git+https://github.com/radrootslabs/lib"),
+ None,
+ Some("MIT OR Apache-2.0"),
+ false,
+ );
+ dependency.manifest_path = root
+ .join("crates/domain/Cargo.toml")
+ .to_str()
+ .unwrap()
+ .to_owned();
+ let texts = dependency_license_texts(&dependency).unwrap();
+ let notice = texts.iter().find(|v| v.filename == "NOTICE").unwrap();
+ assert_eq!(
+ notice.text,
+ crate::generate::data_notices::render(&root).unwrap()
+ );
+ assert_eq!(notice.sha256, sha256_bytes(notice.text.as_bytes()));
+ assert!(
+ notice
+ .text
+ .contains("Copyright 2023-2026 rust_iso4217 contributors")
+ );
+ assert!(notice.text.contains("IANA time zone database 2026c"));
+ }
+
+ #[test]
fn dependency_license_admission_preserves_exact_text_and_rejects_missing_or_unsafe_paths() {
let temporary = TempDir::new().unwrap();
let root = temporary.path().canonicalize().unwrap();