Skip to content

Commit 369f19f

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/dr-health-backup-inheritance-374-375-376-37
2 parents d35e427 + c26040f commit 369f19f

64 files changed

Lines changed: 5160 additions & 1364 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 79 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
name: CI
22

3+
# ──────────────────────────────────────────────────────────────────────────────
4+
# Required CI checks (enforce via GitHub branch-protection → "Require status
5+
# checks to pass before merging"):
6+
#
7+
# • "Test & Lint / test" ← cargo test --package ttl-vault
8+
# runs ALL #[cfg(test)] modules,
9+
# including regression_tests.rs and
10+
# slice_failover_tests.rs (Issue #424)
11+
# • "Test & Lint / wasm-size-check" ← enforces WASM size budget (Issue #425)
12+
#
13+
# Both jobs must be green before any PR can be merged to main.
14+
# ──────────────────────────────────────────────────────────────────────────────
15+
316
on:
417
push:
518
branches: [main]
@@ -37,18 +50,16 @@ jobs:
3750
- name: Build crate
3851
run: cargo build --package ttl-vault --lib
3952

53+
# ── Required check (Issue #424) ─────────────────────────────────────────
54+
# Runs ALL #[cfg(test)] modules, which includes:
55+
# • regression_tests.rs (general regression suite)
56+
# • slice_failover_tests.rs (slice-failover regression suite)
57+
# This step is a required branch-protection check — PRs cannot merge if
58+
# any test in either file fails.
4059
- name: Run tests
60+
id: test
4161
run: cargo test --package ttl-vault
4262

43-
- name: Compare benchmarks against baseline
44-
run: python3 scripts/compare_bench_baseline.py
45-
46-
- name: Run backend cross-cutting integration tests
47-
run: cargo test --package ethos-protocol-backend
48-
49-
- name: Run migration rollback tests (apply, rollback, re-apply)
50-
run: cargo test --package ethos-protocol-backend migration_rollback
51-
5263
- name: Check formatting
5364
run: cargo fmt --all -- --check
5465

@@ -83,6 +94,11 @@ jobs:
8394
openapi-spec-validator docs/openapi.yaml
8495
fi
8596
97+
- name: Check playground/production isolation
98+
run: |
99+
chmod +x scripts/check_playground_isolation.sh
100+
scripts/check_playground_isolation.sh environments.toml
101+
86102
- name: Check version consistency
87103
run: |
88104
CHANGELOG_VERSION=$(grep -m 1 "^## \[" CHANGELOG.md | sed -E 's/## \[([0-9]+\.[0-9]+\.[0-9]+)\].*/\1/')
@@ -92,36 +108,59 @@ jobs:
92108
exit 1
93109
fi
94110
95-
coverage:
96-
name: Coverage Report
97-
runs-on: ubuntu-latest
98-
steps:
99-
- uses: actions/checkout@v4
111+
# ── Required check (Issue #425) ─────────────────────────────────────────
112+
# Builds the contract as WASM and enforces the size budgets defined in
113+
# docs/wasm-size-budget.md.
114+
#
115+
# Thresholds (must be kept in sync with docs/wasm-size-budget.md):
116+
# ttl_vault warning: 460 KB hard limit: 512 KB
117+
#
118+
# The step fails the build when any contract exceeds its hard limit, and
119+
# prints a warning when it exceeds the warning threshold.
120+
- name: Build WASM artifact
121+
id: wasm-build
122+
run: |
123+
cargo build --package ttl-vault --target wasm32-unknown-unknown --release
124+
echo "Built WASM artifact"
100125
101-
- uses: dtolnay/rust-toolchain@1.96.1
102-
with:
103-
components: llvm-tools-preview
126+
- name: Check WASM size budget
127+
id: wasm-size-check
128+
run: |
129+
set -euo pipefail
104130
105-
- uses: actions/cache@v4
106-
with:
107-
path: |
108-
~/.cargo/registry/index/
109-
~/.cargo/registry/cache/
110-
~/.cargo/git/db/
111-
target/
112-
key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }}
113-
restore-keys: ${{ runner.os }}-cargo-coverage-
114-
115-
- name: Generate and gate on coverage
116-
env:
117-
COVERAGE: "1"
118-
MIN_COVERAGE: "70"
119-
run: ./scripts/test.sh
120-
121-
- name: Archive coverage report
122-
if: always()
123-
uses: actions/upload-artifact@v4
124-
with:
125-
name: coverage-report
126-
path: target/coverage/
127-
retention-days: 30
131+
# ── Thresholds (bytes) — keep in sync with docs/wasm-size-budget.md ──
132+
TTL_VAULT_WARN_BYTES=$((460 * 1024)) # 460 KB warning threshold
133+
TTL_VAULT_HARD_BYTES=$((512 * 1024)) # 512 KB hard limit
134+
135+
WASM_PATH="target/wasm32-unknown-unknown/release/ttl_vault.wasm"
136+
137+
if [ ! -f "$WASM_PATH" ]; then
138+
echo "❌ WASM artifact not found at $WASM_PATH"
139+
exit 1
140+
fi
141+
142+
WASM_BYTES=$(stat -c%s "$WASM_PATH")
143+
WASM_KB=$(( WASM_BYTES / 1024 ))
144+
145+
echo "ttl_vault WASM size: ${WASM_KB} KB (${WASM_BYTES} bytes)"
146+
echo " Warning threshold : $(( TTL_VAULT_WARN_BYTES / 1024 )) KB"
147+
echo " Hard limit : $(( TTL_VAULT_HARD_BYTES / 1024 )) KB"
148+
149+
FAIL=0
150+
151+
if [ "$WASM_BYTES" -gt "$TTL_VAULT_HARD_BYTES" ]; then
152+
OVER=$(( (WASM_BYTES - TTL_VAULT_HARD_BYTES) / 1024 ))
153+
echo "❌ ttl_vault WASM exceeds hard limit by ${OVER} KB (${WASM_KB} KB > $(( TTL_VAULT_HARD_BYTES / 1024 )) KB)"
154+
echo " See docs/wasm-size-budget.md for optimization strategies."
155+
FAIL=1
156+
elif [ "$WASM_BYTES" -gt "$TTL_VAULT_WARN_BYTES" ]; then
157+
OVER=$(( (WASM_BYTES - TTL_VAULT_WARN_BYTES) / 1024 ))
158+
echo "⚠️ ttl_vault WASM is within ${OVER} KB of the hard limit — consider optimizing."
159+
echo " See docs/wasm-size-budget.md for optimization strategies."
160+
else
161+
echo "✅ ttl_vault WASM size is within budget."
162+
fi
163+
164+
if [ "$FAIL" -eq 1 ]; then
165+
exit 1
166+
fi

.github/workflows/openapi.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: OpenAPI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
schema:
14+
name: OpenAPI schema validation & drift
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
23+
- uses: dtolnay/rust-toolchain@1.96.1
24+
25+
- uses: actions/cache@v4
26+
with:
27+
path: |
28+
~/.cargo/registry/index/
29+
~/.cargo/registry/cache/
30+
~/.cargo/git/db/
31+
target/
32+
key: ${{ runner.os }}-cargo-openapi-${{ hashFiles('**/Cargo.lock') }}
33+
restore-keys: ${{ runner.os }}-cargo-
34+
35+
- name: Validate openapi.yaml is a well-formed spec
36+
run: |
37+
python3 -m pip install --quiet openapi-spec-validator
38+
openapi-spec-validator docs/openapi.yaml
39+
40+
- name: Schema-validation middleware unit tests
41+
run: cargo test --package ethos-protocol-backend schema_validation
42+
43+
- name: Fail if handlers drift from docs/openapi.yaml
44+
run: node scripts/check_openapi_drift.mjs
45+
46+
- name: Regenerate the TypeScript client and check it is committed
47+
run: node scripts/generate_ts_client.mjs --check

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,4 @@ benches/results/
9595
*.pfx
9696
secrets/
9797
private/
98+
.deploy-state/

0 commit comments

Comments
 (0)