From 3084dd2ca4aa3d83c7fd9c440bef74224f26ace8 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 00:27:48 +0000 Subject: [PATCH] chore(frame): re-pin the template frame so frame.lock binds frame/ and identity/ UOR-Foundation/template#91 adds frame/ and identity/ to the frame list, so frame.lock now binds all 52 frame files byte for byte and a re-pin delivers them. Only frame-sync.mjs and the lock change: every frame/ and identity/ file was already identical to the template's. audit-prism takes the template's copy: a lock binds only when it names its upstream, and the ratchet starts at the commit that installs it. The bound frame/ and identity/ files no longer count as Foundry's implementation. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013Asa3LcnA6wEZHWvFUkLyK --- TEMPLATE-VERIFICATION.md | 6 +- bootstrap/frame-sync.mjs | 45 +++++++++++-- frame.lock | 142 ++++++++++++++++++++++++++++++++++++++- xtask/src/audit.rs | 35 ++++++++-- 4 files changed, 216 insertions(+), 12 deletions(-) diff --git a/TEMPLATE-VERIFICATION.md b/TEMPLATE-VERIFICATION.md index 75cca704..cf925949 100644 --- a/TEMPLATE-VERIFICATION.md +++ b/TEMPLATE-VERIFICATION.md @@ -339,7 +339,11 @@ non-Prism language at once: `.rs`, `.ts`, `.tsx`, `.mts`, `.cts`, `.js`, `.mjs`, nor comments, so a comment that says why costs nothing. Prism output that a Prism lock binds byte for byte is Prism's and is not counted while its bytes equal the lock: the frame `frame.lock` pins to the template, and the Prism id -`identity/stitch.lock` generates from stitch's model. +`identity/stitch.lock` generates from stitch's model. A lock binds only when it names its upstream (`source` in +`frame.lock`, `repository` in `stitch.lock`). Since `UOR-Foundation/template#91` +the frame list includes `frame/` and `identity/`, so a template re-pin no longer +counts against the ratchet; the gate's code is the template's, kept identical +here. The ceiling is measured, not recorded: it is the commit's first parent. A pull request or merge queue run checks out a merge whose first parent is the base diff --git a/bootstrap/frame-sync.mjs b/bootstrap/frame-sync.mjs index bb3f4422..864f80bb 100644 --- a/bootstrap/frame-sync.mjs +++ b/bootstrap/frame-sync.mjs @@ -33,7 +33,9 @@ const SPEC = "prism/frame-lock/1"; const RAW = (process.env.PRISM_TEMPLATE_RAW ?? `https://raw.githubusercontent.com/${TEMPLATE}`).replace(/\/$/, ""); // Every file of the frame. A lock must list exactly these, so dropping one -// from the lock cannot take it out of the gate. +// from the lock cannot take it out of the gate. The frame's panels (frame/) +// and the Prism id it signs in with (identity/) are the frame too: an app +// takes them from the template by the same pin and edits none of them. const FRAME = [ "bootstrap/frame-sync.mjs", "bootstrap/icons.py", @@ -44,6 +46,40 @@ const FRAME = [ "bootstrap/screens.mjs", "bootstrap/weight.mjs", "bootstrap/worker-runtime.mjs", + "frame/backdrops/0wFwSZn6I-I-thumb.jpg", + "frame/backdrops/0wFwSZn6I-I.jpg", + "frame/backdrops/9wH624ALFQA-thumb.jpg", + "frame/backdrops/9wH624ALFQA.jpg", + "frame/backdrops/E0AHdsENmDg-thumb.jpg", + "frame/backdrops/E0AHdsENmDg.jpg", + "frame/backdrops/Q1p7bh3SHj8-thumb.jpg", + "frame/backdrops/Q1p7bh3SHj8.jpg", + "frame/backdrops/RF4p4rTM-2s-thumb.jpg", + "frame/backdrops/RF4p4rTM-2s.jpg", + "frame/backdrops/cZgVpseeazg-thumb.jpg", + "frame/backdrops/cZgVpseeazg.jpg", + "frame/backdrops/oMcTmNHclZI-thumb.jpg", + "frame/backdrops/oMcTmNHclZI.jpg", + "frame/backdrops/qtRF_RxCAo0-thumb.jpg", + "frame/backdrops/qtRF_RxCAo0.jpg", + "frame/backdrops/t7EL2iG3jMc-thumb.jpg", + "frame/backdrops/t7EL2iG3jMc.jpg", + "frame/frame.css", + "frame/frame.mjs", + "frame/panels.css", + "frame/panels.mjs", + "frame/publish.mjs", + "frame/unsplash/.gitignore", + "frame/unsplash/README.md", + "frame/unsplash/worker.mjs", + "frame/unsplash/wrangler.toml", + "identity/PROTOCOL.md", + "identity/README.md", + "identity/dev.mjs", + "identity/prism-id.mjs", + "identity/stitch-sync.mjs", + "identity/stitch.lock", + "identity/test.mjs", "lighthouserc.json", "site/app.mjs", "site/guest-worker.mjs", @@ -108,9 +144,10 @@ function frameOf(source) { const list = source.match(/^const FRAME = \[([\s\S]*?)\];/m)?.[1]; return list ? [...list.matchAll(/"([^"]+)"/g)].map((m) => m[1]) : null; } -// A frame file is a page file or a page gate: under bootstrap/ or site/, or -// lighthouserc.json, and never outside the repository. -const framePath = (path) => /^(?:(?:bootstrap|site)\/[\w.-]+(?:\/[\w.-]+)*|lighthouserc\.json)$/.test(path) && !path.split("/").includes(".."); +// A frame file is a page file, a page gate, a frame panel or the Prism id: +// under bootstrap/, site/, frame/ or identity/, or lighthouserc.json, and +// never outside the repository. +const framePath = (path) => /^(?:(?:bootstrap|site|frame|identity)\/[\w.-]+(?:\/[\w.-]+)*|lighthouserc\.json)$/.test(path) && !path.split("/").includes(".."); // The target is judged by its own frame, not this one: a newer template may // add a frame file this script has never heard of. Its frame-sync.mjs must be diff --git a/frame.lock b/frame.lock index 197f495d..d904eed7 100644 --- a/frame.lock +++ b/frame.lock @@ -2,13 +2,13 @@ "spec": "prism/frame-lock/1", "source": { "repository": "UOR-Foundation/template", - "commit": "33296e024ef791b69930eddf95c759c2902279cb", - "raw": "https://raw.githubusercontent.com/UOR-Foundation/template/33296e024ef791b69930eddf95c759c2902279cb/" + "commit": "0851bb41138041f0f75118135fd8a342109c2d73", + "raw": "https://raw.githubusercontent.com/UOR-Foundation/template/0851bb41138041f0f75118135fd8a342109c2d73/" }, "files": [ { "path": "bootstrap/frame-sync.mjs", - "sha256": "5d874908a8f5813b6f7c1004ec0e73ec03584139bf7ac8ffabb2ad5c0eeee7af" + "sha256": "b321f177db28da08326cd90cdc522f02bac960fffc5ca187bc3d81d6492881e5" }, { "path": "bootstrap/icons.py", @@ -42,6 +42,142 @@ "path": "bootstrap/worker-runtime.mjs", "sha256": "0f9fbb6ec4db48fb7f7c4b779a0494e95d5411e868b36e1e163e5173fcc34557" }, + { + "path": "frame/backdrops/0wFwSZn6I-I-thumb.jpg", + "sha256": "c8961c9ccbbd9bdaee0a88f2027377381212b14644ff2bee70c6007459eac71d" + }, + { + "path": "frame/backdrops/0wFwSZn6I-I.jpg", + "sha256": "d616103b46592c280e76d9d695badb8032d6c03f68b5c303ce1e0bd65165b0e8" + }, + { + "path": "frame/backdrops/9wH624ALFQA-thumb.jpg", + "sha256": "6b39d5ba401eff06271c185cca078a395bf6fa4836f253ec074fd4c149cd4a66" + }, + { + "path": "frame/backdrops/9wH624ALFQA.jpg", + "sha256": "ba35adf7f14f9a37838c6cb35f81795f8030f8a7bb0f992f28502e03d5c6e82c" + }, + { + "path": "frame/backdrops/E0AHdsENmDg-thumb.jpg", + "sha256": "e2cd6180c72ddb1d9e1f7838204c94e79ae127b11ba625447b7a70b6bbb0773a" + }, + { + "path": "frame/backdrops/E0AHdsENmDg.jpg", + "sha256": "e43adbb89d2ec19ca6ef570f6bfae4ac6daf39a31348a9c73d5edee573a588f1" + }, + { + "path": "frame/backdrops/Q1p7bh3SHj8-thumb.jpg", + "sha256": "234cbde53f0217585749554b772df6e613bba795dfec18347e1f00f8f33fa3f9" + }, + { + "path": "frame/backdrops/Q1p7bh3SHj8.jpg", + "sha256": "99e71e2c73a4b3e19fb98108f9dce81f8c81b71cb0c8de3e2afc9649f744f881" + }, + { + "path": "frame/backdrops/RF4p4rTM-2s-thumb.jpg", + "sha256": "ed50607638da713b855be09e3c99cb051bf6d87c1cab1d147888412bbde22e20" + }, + { + "path": "frame/backdrops/RF4p4rTM-2s.jpg", + "sha256": "e007bac1d872fb541d27181442500d371b27d39aea3fc48db7f757f77a1caa05" + }, + { + "path": "frame/backdrops/cZgVpseeazg-thumb.jpg", + "sha256": "8f107db205151bab41e10df89d7fffe9a13caab11c775d623e2e108f6f04c25e" + }, + { + "path": "frame/backdrops/cZgVpseeazg.jpg", + "sha256": "b061c0f02fbded1a50a006ad4d8ecd4af0718e042dbbef6326d92cf7dc80a00f" + }, + { + "path": "frame/backdrops/oMcTmNHclZI-thumb.jpg", + "sha256": "5de0d7fa4c32c83bea4360602ef751cd0f97d1fa46f77f4e3010bb237ed4aa5a" + }, + { + "path": "frame/backdrops/oMcTmNHclZI.jpg", + "sha256": "413274ffeb758961fa77f0eec0d9c71526a0cb54333edb92f17e5896b1e8bbec" + }, + { + "path": "frame/backdrops/qtRF_RxCAo0-thumb.jpg", + "sha256": "4bd016b2ad3a6119d08139e61346081ad18781fba39df7a8026f5f31333dbaa3" + }, + { + "path": "frame/backdrops/qtRF_RxCAo0.jpg", + "sha256": "be36adbed5035b15a41206d64812754dae4c246324af525059372385dedc18b7" + }, + { + "path": "frame/backdrops/t7EL2iG3jMc-thumb.jpg", + "sha256": "db1465c0d30a65e5d4279a4644dc1d6a488c378b4bb43fcde714f6fbb251af7f" + }, + { + "path": "frame/backdrops/t7EL2iG3jMc.jpg", + "sha256": "6f59cde71fb09b6a5faa92b1f9a77c0a300c0e4f9e6469574e54e14e85801d29" + }, + { + "path": "frame/frame.css", + "sha256": "c7470fdcbdb0ca9c6e2a634b6ec4ba9f1ed87c39b737f91e082b8c6466ab91f4" + }, + { + "path": "frame/frame.mjs", + "sha256": "208994058dcc6c70a91d590c345cb4956eda3532096f298f0a21f809f11672c1" + }, + { + "path": "frame/panels.css", + "sha256": "9b6bcd85303139ddaac9b2cbde7b7d3ef61d34da336874774073124b2560d8ce" + }, + { + "path": "frame/panels.mjs", + "sha256": "f2db1617f0a6d14e4447c54bafc7aeb45c7cb152b0f5a0b27b5615f8ce8d7b92" + }, + { + "path": "frame/publish.mjs", + "sha256": "faaaca350d15e0a0fb90311f810f1cf322ec790d6e0739c90489caa5cd857dd9" + }, + { + "path": "frame/unsplash/.gitignore", + "sha256": "f7041b5e6a86198e0b2dc26f8c45a303e4b75ccfd783928d935f6212ace66b49" + }, + { + "path": "frame/unsplash/README.md", + "sha256": "1cc50248e5565a8c57be54bc98caa62b243c0032de1ba69e6df8be379a17ed1c" + }, + { + "path": "frame/unsplash/worker.mjs", + "sha256": "fe0b48820ecf03c6ee440dd5bc647e16a81f70e27fc7b09890429309f067b1de" + }, + { + "path": "frame/unsplash/wrangler.toml", + "sha256": "90969e5589949ba52a523733d2178ca711f2794094bda8d65b105d3590865b1f" + }, + { + "path": "identity/PROTOCOL.md", + "sha256": "1e3a042a4a100683e0df5bc8210c367785e844feb63cd561d591979733e7ff82" + }, + { + "path": "identity/README.md", + "sha256": "351d9387fbc8fac0123f13a2e03e03aba8a4c0aed8e38f6040973bec4246fef1" + }, + { + "path": "identity/dev.mjs", + "sha256": "422bb2f4eba2f7aef47d6ffab1dabd1699c92eef0883e9c651f8e0a3f63beac0" + }, + { + "path": "identity/prism-id.mjs", + "sha256": "68482230e97b35a042295ec003687e745b34ba92275f0fc6a671bc1510f6d0d0" + }, + { + "path": "identity/stitch-sync.mjs", + "sha256": "65f88ef47fc11ab4d9adcac1488169cf169d1bc69e80f5406e90e71ae367f4a1" + }, + { + "path": "identity/stitch.lock", + "sha256": "0ecf5b500675c268d486bbd111246f2087ce0ec79c57540fe635089c6d7a3d0c" + }, + { + "path": "identity/test.mjs", + "sha256": "21cb6924014c80f378abf5d07720a203c7e62aa99ffd38e05f6d8376153317f9" + }, { "path": "lighthouserc.json", "sha256": "85aa0f6219cb8396b34f5b461c1d4d7b149e4cc1674cbd2f0100c5b5e16636d9" diff --git a/xtask/src/audit.rs b/xtask/src/audit.rs index 70316954..da732c92 100644 --- a/xtask/src/audit.rs +++ b/xtask/src/audit.rs @@ -268,7 +268,7 @@ fn gather_all(dir: &Path, out: &mut Vec) -> Result<(), Fail> { /// Only Prism is implemented here. /// -/// Foundry is a Prism model: behavior is written in LexLean (`*.lex.tex`), checked by Lean and +/// This product is a Prism model: behavior is written in LexLean (`*.lex.tex`), checked by Lean and /// built by PrismPM. Everything else that executes, hand-written Rust, TypeScript, JavaScript, /// Python, shell, CSS or HTML, is non-Prism implementation, and it may only shrink. This is the /// shrink-only ratchet of `afflom/rule30` (Python may not grow) and `afflom/verdant-resonance` @@ -386,6 +386,9 @@ pub mod prism { /// and the digest its bytes must have. const PRISM_LOCKS: [&str; 2] = ["frame.lock", "identity/stitch.lock"]; + /// How a commit's `xtask/src/audit.rs` shows it runs this gate. + const GATE: &[u8] = b"pub mod prism {"; + /// Paths the Prism locks bind, with the digest each must have. `read` answers a lock's text, /// or `None` where the tree has no such lock. fn bound( @@ -397,6 +400,14 @@ pub mod prism { continue; }; let lock: serde_json::Value = serde_json::from_str(&text)?; + // A lock binds output only when it names where the output comes from. The template's + // own frame.lock has no source: there the frame is the template's implementation. + let upstream = lock["source"]["repository"] + .as_str() + .or(lock["repository"].as_str()); + if upstream.is_none_or(str::is_empty) { + continue; + } let files = lock["files"].as_array().into_iter().flatten(); for entry in files.chain(lock.get("output")) { let (Some(path), Some(sha256)) = (entry["path"].as_str(), entry["sha256"].as_str()) @@ -598,6 +609,18 @@ pub mod prism { return Ok(()); }; let parent = String::from_utf8(parent)?.trim().to_string(); + // The ratchet starts at the commit that installs it: a parent without this gate set no + // ceiling. Removing the gate needs a change that deletes it, which this does not open. + let gated = git(root, &["show", &format!("{parent}:xtask/src/audit.rs")]) + .is_ok_and(|source| source.windows(GATE.len()).any(|w| w == GATE)); + if !gated { + println!( + "audit-prism: installed here; the parent ran no ratchet, so this commit sets the ceiling: {} lines in {} files", + current.total(), + current.files.len() + ); + return Ok(()); + } let ceiling = measure_commit(root, &parent)?; let refused = refusals(&ceiling, ¤t); if !refused.is_empty() { @@ -658,8 +681,8 @@ pub mod prism { #[test] fn locks_bind_frame_files_and_generated_output() { - let frame = r#"{"files": [{"path": "site/app.mjs", "sha256": "aa"}]}"#; - let stitch = r#"{"output": {"path": "identity/prism-id.mjs", "sha256": "bb"}}"#; + let frame = r#"{"source": {"repository": "UOR-Foundation/template"}, "files": [{"path": "site/app.mjs", "sha256": "aa"}]}"#; + let stitch = r#"{"repository": "afflom/stitch", "output": {"path": "identity/prism-id.mjs", "sha256": "bb"}}"#; let locks = bound(|name| { Ok(match name { "frame.lock" => Some(frame.to_string()), @@ -673,7 +696,11 @@ pub mod prism { locks.get("identity/prism-id.mjs").map(String::as_str), Some("bb") ); - assert!(bound(|_| Ok(Some(r#"{"files": [{"path": "x"}]}"#.to_string()))).is_err()); + let bad = r#"{"repository": "afflom/stitch", "files": [{"path": "x"}]}"#; + assert!(bound(|_| Ok(Some(bad.to_string()))).is_err()); + // The template's own frame.lock names no source, so it binds nothing. + let own = r#"{"files": [{"path": "site/app.mjs", "sha256": "aa"}]}"#; + assert!(bound(|_| Ok(Some(own.to_string()))).unwrap().is_empty()); } #[test]