Skip to content

Commit 423ffdf

Browse files
ci(rust): convert rust-ci.yml to thin wrapper (standards#174) (#40)
## Summary Replaces the per-repo `rust-ci.yml` copy with a 5-line wrapper invoking the shared reusable workflow filed in [standards#174](hyperpolymath/standards#174). Pinned to that PR's HEAD SHA (`4fdf4314b4ab54269adbaff10e30e483b5e86845`); will resolve to standards/main once #174 merges. ## Why Estate audit found ~87 `rust-ci.yml` copies across the estate with significant drift. Converting each to a 5-line wrapper means future Rust CI changes propagate in one place. This PR is part of the foundational sweep following the established [standards#168](hyperpolymath/standards#168) precedent (governance-reusable + absolute-zero#41 + tma-mark2#41 wrappers). Variant: **audit-cov** ("opts into cargo-audit + coverage") ## Test plan - [ ] CI: `rust-ci` job invokes the reusable and reports the same checks - [ ] Awaiting standards#174 merge before this becomes useful long-term (still works today via SHA pin) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 79f8f52 commit 423ffdf

4 files changed

Lines changed: 148 additions & 161 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
include:
33-
- language: javascript-typescript
33+
# Repo source is not JS/TS; scan workflow files via the
34+
# actions extractor (every repo has those). See hypatia rule
35+
# codeql_language_matrix_mismatch.
36+
- language: actions
3437
build-mode: none
3538

3639
steps:

.github/workflows/rust-ci.yml

Lines changed: 15 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,20 @@
11
# SPDX-License-Identifier: MPL-2.0
2-
permissions:
3-
contents: read
4-
2+
# Rust CI — thin wrapper calling the shared estate reusable in
3+
# hyperpolymath/standards. Configure once, propagate everywhere.
4+
# See: docs/CI-REUSABLE-WORKFLOWS.adoc in standards.
55
name: Rust CI
6-
on: [push, pull_request]
7-
env:
8-
CARGO_TERM_COLOR: always
9-
RUSTFLAGS: -Dwarnings
106

11-
jobs:
12-
test:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
16-
- uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
17-
with:
18-
components: rustfmt, clippy
19-
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
20-
21-
- name: Check formatting
22-
run: cargo fmt --all -- --check
23-
24-
- name: Clippy lints
25-
run: cargo clippy --all-targets --all-features -- -D warnings
26-
27-
- name: Run tests
28-
run: cargo test --all-features
29-
30-
- name: Build release
31-
run: cargo build --release
7+
on:
8+
push:
9+
branches: [main, master]
10+
pull_request:
3211

33-
security:
34-
runs-on: ubuntu-latest
35-
steps:
36-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
37-
- uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
38-
- name: Install cargo-audit
39-
run: cargo install cargo-audit
40-
- name: Security audit
41-
run: cargo audit
42-
- name: Check for outdated deps
43-
run: cargo install cargo-outdated && cargo outdated --exit-code 1 || true
12+
permissions:
13+
contents: read
4414

45-
coverage:
46-
runs-on: ubuntu-latest
47-
steps:
48-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
49-
- uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
50-
- name: Install tarpaulin
51-
run: cargo install cargo-tarpaulin
52-
- name: Generate coverage
53-
run: cargo tarpaulin --out Xml
54-
- uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3
55-
with:
56-
files: cobertura.xml
15+
jobs:
16+
rust-ci:
17+
uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@4fdf4314b4ab54269adbaff10e30e483b5e86845
18+
with:
19+
enable_audit: true
20+
enable_coverage: true

examples/SafeDOMExample.affine

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
// SPDX-License-Identifier: MPL-2.0
2+
// SafeDOMExample.affine — formally-verified DOM mounting (aspirational).
3+
//
4+
// This example shows the *shape* of SafeDOM consumer code in current
5+
// AffineScript syntax. The `SafeDOM` stdlib surface it references
6+
// (`mount_safe`, `mount_when_ready`, `mount_batch`,
7+
// `proven_selector_validate`, `proven_html_validate`, `mount`) is the
8+
// target of `affinescript#56` (DOM+Pixi binding survey) and does not
9+
// yet exist in the published stdlib. The file is therefore
10+
// parse-checked but not type-checked end-to-end until #56 lands the
11+
// bindings; `affinescript check` reports `Resolve.UndefinedModule
12+
// SafeDOM` which is expected.
13+
//
14+
// Previous versions of this file (estate-wide, 5 dialect variants)
15+
// pre-dated ADR-014 (qualified paths), ADR-016 (effect rows), and the
16+
// `#{`-record-literal sigil (ADR-215). They were retired in favour of
17+
// this canonical via the gitbot-fleet#208 sweep (2026-05-26).
18+
19+
module SafeDOMExample;
20+
21+
use prelude::{Option, Some, None, Result, Ok, Err};
22+
23+
// `Element` and friends are nominal extern types for now — the real
24+
// shape lands with affinescript#56.
25+
extern type Element;
26+
extern type Selector;
27+
extern type ValidHTML;
28+
29+
// Single-mount status, lifted from the host into a typed tag union.
30+
enum MountStatus {
31+
Mounted(Element),
32+
MountPointNotFound(String),
33+
InvalidSelector(String),
34+
InvalidHTML(String)
35+
}
36+
37+
// Batch-mount result.
38+
enum MountResult {
39+
Mounted([Element]),
40+
Failed(String)
41+
}
42+
43+
// Spec for one element in a batch mount.
44+
struct MountSpec {
45+
selector: String,
46+
html: String
47+
}
48+
49+
// SafeDOM's host-side surface, all IO-effecting. Callbacks are passed
50+
// as separate parameters (rather than a `MountCallbacks` record)
51+
// because fn-typed struct fields are not currently parser-supported.
52+
extern fn mount_safe(
53+
selector: ref String,
54+
html: ref String,
55+
on_success: fn(Element) -> (),
56+
on_error: fn(String) -> (),
57+
) -{IO}-> ();
58+
59+
extern fn mount_when_ready(
60+
selector: ref String,
61+
html: ref String,
62+
on_success: fn(Element) -> (),
63+
on_error: fn(String) -> (),
64+
) -{IO}-> ();
65+
66+
extern fn mount_batch(specs: ref [MountSpec]) -{IO}-> MountResult;
67+
68+
extern fn proven_selector_validate(s: ref String) -{IO}-> Result<Selector, String>;
69+
extern fn proven_html_validate(s: ref String) -{IO}-> Result<ValidHTML, String>;
70+
extern fn mount(sel: ref Selector, html: ref ValidHTML) -{IO}-> MountStatus;
71+
72+
extern fn array_for_each(xs: ref [Element], f: fn(Element) -> ()) -{IO}-> ();
73+
extern fn array_len(xs: ref [Element]) -> Int;
74+
75+
// Example 1 — basic mount with success/error branches.
76+
pub fn mount_app() -{IO}-> () {
77+
mount_safe(
78+
"#app",
79+
"<div><h1>Hello, World!</h1><p>Mounted safely with proofs.</p></div>",
80+
fn(el) -> () { Console::log("App mounted successfully"); },
81+
fn(err) -> () { Console::error("Mount failed: " ++ err); },
82+
);
83+
}
84+
85+
// Example 2 — defer until DOM ready.
86+
pub fn mount_when_dom_ready() -{IO}-> () {
87+
mount_when_ready(
88+
"#app",
89+
"<div class='container'><h1>App Title</h1></div>",
90+
fn(_el) -> () { Console::log("Mounted after DOM ready"); },
91+
fn(err) -> () { Console::error("Failed: " ++ err); },
92+
);
93+
}
94+
95+
// Example 3 — atomic batch mount.
96+
pub fn mount_multiple() -{IO}-> () {
97+
let specs = [
98+
MountSpec #{ selector: "#header", html: "<header><h1>Site Title</h1></header>" },
99+
MountSpec #{ selector: "#nav", html: "<nav><a href='/'>Home</a></nav>" },
100+
MountSpec #{ selector: "#main", html: "<main><p>Content here</p></main>" },
101+
MountSpec #{ selector: "#footer", html: "<footer>2026</footer>" },
102+
];
103+
104+
match mount_batch(specs) {
105+
Mounted(elements) => {
106+
Console::log("Batch mount succeeded");
107+
array_for_each(elements, fn(_el) -> () { Console::log(" element"); });
108+
},
109+
Failed(err) => {
110+
Console::error("Batch mount failed (atomic — none mounted): " ++ err);
111+
}
112+
}
113+
}
114+
115+
// Example 4 — explicit two-stage validation before mounting.
116+
pub fn mount_with_validation() -{IO}-> () {
117+
match proven_selector_validate("#my-app") {
118+
Err(e) => Console::error("Invalid selector: " ++ e),
119+
Ok(valid_selector) => match proven_html_validate("<div>Content</div>") {
120+
Err(e) => Console::error("Invalid HTML: " ++ e),
121+
Ok(valid_html) => match mount(valid_selector, valid_html) {
122+
Mounted(_el) => Console::log("Mounted with validated inputs"),
123+
MountPointNotFound(s) => Console::error("Element not found: " ++ s),
124+
InvalidSelector(_) => Console::error("impossible — already validated"),
125+
InvalidHTML(_) => Console::error("impossible — already validated"),
126+
},
127+
},
128+
}
129+
}

examples/SafeDOMExample.res

Lines changed: 0 additions & 109 deletions
This file was deleted.

0 commit comments

Comments
 (0)