## Summary PoC-A proved that dynamically loaded ELF plugins are workable on ESP32-S3: plugins ship as signed MPB packages, are parsed by a strict single-type parser shared between host and target, and execute from PSRAM+IRAM within a measured admission budget. A 1000-cycle load/unload soak passed 18/18 trend gates with stable heaps, the capacity ladder settled at 8 coexisting plugin instances with a 3356B per-instance budget, and the fail-closed corpus executed zero attacker-controlled bytes across 14 rejection classes. Scheduler semantics (strand FIFO ordering, completion-cancel CAS, quiesce-as-noop ABI) were validated on both host (TSan suite) and target. **Gate-A verdict: PASS** — ADR-0002 moves to **Accepted** with the capacity value 8 and global-sum admission rule as PoC-derived proposals. ## Changes by area Grouped from `git log main..HEAD --oneline` (18 commits): - **Vendored loader + patches**: `4bb53f2` vendor elf_loader 1.3.3 + harness scaffold; `2f67b4f` plugin_iram loader patch with budget consistency (p1-p5 patch series in `PATCHES.md`). - **MPB toolchain**: `4793cc2` deterministic MPB manifest builder with test signing; `408df44` strict single-type MPB parser shared host/target; `796f9d2` host MPB corpus + policy CI lane. - **Plugin pipeline + probes**: `21d2842` plugin pipeline and first PSRAM execution on target; `cab9664` relocation/import allowlist matrix with probes; `c5d6c6c` C++ feature rejection matrix. - **Harness commands**: `e0e7159` generation coexistence with measured admission budget; `2a37556` thousand-cycle lifecycle soak with heap trend gate; `093a72b` on-target scheduler semantics validation (+ `eea3876` clang-format-18 sweep); `a302151` capacity ladder with signed budget; `f34dc72` fail-closed corpus with execution sentinel. - **Host prototypes**: `6198bca` strand FIFO prototype with TSan suite; `1c3ad59` completion-cancel CAS and cleanup semantics. - **Evidence + ADR/docs**: `887d0f7` Gate-A manifest and report; `1c29e8a` ADR-0002 outcome + frozen PoC values. ## QA evidence - `poc/evidence/poc-a-20260901/manifest.json` — 67-artifact hash index, every sha256 recomputed at assembly. - `poc/evidence/poc-a-20260901/GATE-A-REPORT.md` — full nine-item development-plan §4 mapping; TEST-003 10/10 clauses. - 14 verbatim per-task transcripts (`task-1` … `task-15-*.log`) + fresh build artifacts (`build/frame_poc_a.map`, size components). - Frozen in-repo references: `ALLOWLIST.md`, `REJECT-MATRIX.md`, `ADMISSION-BUDGET.md`, `soak_samples_1000.csv`, fc corpus (33 committed `.mpb` containers). - F1-F4 final-wave verdicts: **APPROVE**. - Key numbers: soak **18/18** trend gates over 1000 cycles; capacity **8/8** instances, **3356B** per-instance; fc corpus **14 rejection classes, zero attacker bytes executed**; **4 upstream loader defects found and patched** (p1-p5). ## Requirement IDs (GOV-006) ADR-0002; TEST-002, TEST-003; PLUG-001, PLUG-004, PLUG-008, PLUG-009; MEM-001, MEM-003, MEM-007, MEM-008; LIFE-001, LIFE-002, LIFE-005, LIFE-007; SEC-002, SEC-003, SEC-004, SEC-005; GH-003; GOV-004, GOV-005. ## Risks / known limitations From `GATE-A-REPORT.md` §(f) plus the trade-off table: 1. **Capacity descent path 7-5 unexercised** — rung 8 passed first attempt; rungs 7/6/5 and retry-once logic never ran on hardware (untested against real OOM). 2. **No Wi-Fi in the harness (MEM-001 caveat)** — all PSRAM/IRAM budget numbers are radio-off harness-class; product admission budgets must be re-measured with the network stack active. 3. **On-target scheduler vectors are a subset of the host suite** (256-node pool / 2e4 storm posts vs host 31000 / 1e5); consistency declaration covers only the vectors actually run. 4. **Quiesce is a no-op by ABI semantics** — plugin ABI 1.2 has no quiesce slot; NULL entry is defined as trivial success; real quiesce coordination is later-gate work. 5. **MEMPROT=n trade-off** — `CONFIG_ESP_SYSTEM_MEMPROT=n` is required for the IDF exec heap (`MALLOC_CAP_EXEC`) that `.plugin_iram` needs; software-only PMP config, no eFuse burned (documented in `PATCHES.md` p5); production must re-decide security vs plugin IRAM. 6. **Owner sign-off PENDING** — Gate-A PASS is the PoC team's verdict; formal acceptance of ADR-0002 awaits the owner. ## Not in scope - Product components (GOV-004) — this PR is PoC evidence only; no product code paths change. - **Merge is the owner's call** — do not merge without owner sign-off on ADR-0002. --------- Co-authored-by: ania-lain <[email protected]>
391 lines
14 KiB
YAML
391 lines
14 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
concurrency:
|
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
repository-gates:
|
|
name: Repository gates
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up uv
|
|
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d
|
|
with:
|
|
version: "0.12.5"
|
|
python-version: "3.11"
|
|
enable-cache: true
|
|
cache-dependency-glob: uv.lock
|
|
- name: Install locked Python environment
|
|
run: |
|
|
set -euo pipefail
|
|
uv sync --frozen
|
|
- name: Validate pull request title
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
run: |
|
|
set -euo pipefail
|
|
uv run frame-pr-title
|
|
- name: Lint and test repository tools
|
|
run: |
|
|
set -euo pipefail
|
|
uv run ruff format --check tools tests
|
|
uv run ruff check tools tests
|
|
uv run pyright
|
|
uv run pytest
|
|
- name: Check C and C++ formatting
|
|
run: |
|
|
set -euo pipefail
|
|
mapfile -t sources < <(git ls-files 'poc/common/**' 'poc/host/**' \
|
|
'poc/apps/m1_hardware/main/**' 'poc/apps/poc_a/main/**' \
|
|
'poc/apps/poc_a/plugins/**' | grep -E '\.(c|cc|cpp|cxx|h|hh|hpp)$' | sort)
|
|
clang-format-18 --dry-run --Werror "${sources[@]}"
|
|
- name: Validate repository data and documentation
|
|
run: |
|
|
set -euo pipefail
|
|
uv run frame-partitions
|
|
uv run frame-evidence
|
|
uv run frame-doc-links
|
|
uv run frame-sbom --output .build/reports/sbom.cdx.json
|
|
- name: Upload repository reports
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
with:
|
|
name: repository-reports
|
|
path: .build/reports/
|
|
if-no-files-found: error
|
|
retention-days: 14
|
|
|
|
mpb-corpus-gates:
|
|
name: Host MPB corpus and plugin policy gates
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
env:
|
|
CC: gcc-14
|
|
CXX: g++-14
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Install GCC 14 toolchain
|
|
run: |
|
|
set -euo pipefail
|
|
sudo apt-get update
|
|
sudo apt-get install -y gcc-14 g++-14
|
|
- name: Set up uv
|
|
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d
|
|
with:
|
|
version: "0.12.5"
|
|
python-version: "3.11"
|
|
enable-cache: true
|
|
cache-dependency-glob: uv.lock
|
|
- name: Install locked Python environment
|
|
run: |
|
|
set -euo pipefail
|
|
uv sync --frozen
|
|
- name: Build and run the MPB parser corpus suite
|
|
run: |
|
|
set -euo pipefail
|
|
cmake -S poc/host -B .build/poc-corpus
|
|
cmake --build .build/poc-corpus --target mpb_parser_test --parallel 2
|
|
ctest --test-dir .build/poc-corpus -R MpbParser --output-on-failure
|
|
- name: Regenerate the MPB corpus and compare byte for byte
|
|
run: |
|
|
set -euo pipefail
|
|
tmp="$(mktemp -d)"
|
|
mkdir -p "${tmp}/poc/host/tests" "${tmp}/tools"
|
|
cp poc/host/tests/gen_mpb_corpus.py "${tmp}/poc/host/tests/"
|
|
cp -r tools/frame_tools "${tmp}/tools/"
|
|
uv run python "${tmp}/poc/host/tests/gen_mpb_corpus.py"
|
|
sha256sum poc/host/tests/mpb_corpus/*.mpb
|
|
diff -r -x README.md poc/host/tests/mpb_corpus "${tmp}/poc/host/tests/mpb_corpus"
|
|
printf '%s\n' 'committed corpus is byte-identical to a fresh regeneration'
|
|
- name: Run plugin policy checker and stem drift guard tests
|
|
run: |
|
|
set -euo pipefail
|
|
uv run pytest tests/test_check_plugin_policy.py -v
|
|
|
|
host-clang-sanitizers:
|
|
name: Host Clang ASan and UBSan
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Configure, build, and test
|
|
env:
|
|
CC: clang
|
|
CXX: clang++
|
|
run: |
|
|
set -euo pipefail
|
|
cmake -S poc/host -B .build/host-clang -DENABLE_SANITIZERS=ON
|
|
cmake --build .build/host-clang --parallel 2
|
|
ctest --test-dir .build/host-clang --output-on-failure
|
|
|
|
host-gcc:
|
|
name: Host GCC compatibility
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Install GCC 14 toolchain
|
|
run: |
|
|
set -euo pipefail
|
|
sudo apt-get update
|
|
sudo apt-get install -y gcc-14 g++-14
|
|
- name: Configure, build, and test
|
|
env:
|
|
CC: gcc-14
|
|
CXX: g++-14
|
|
run: |
|
|
set -euo pipefail
|
|
cmake -S poc/host -B .build/host-gcc
|
|
cmake --build .build/host-gcc --parallel 2
|
|
ctest --test-dir .build/host-gcc --output-on-failure
|
|
|
|
host-clang-tidy:
|
|
name: Host clang-tidy
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Configure and run clang-tidy
|
|
env:
|
|
CC: clang-18
|
|
CXX: clang++-18
|
|
run: |
|
|
set -euo pipefail
|
|
cmake -S poc/host -B .build/host-tidy -DENABLE_CLANG_TIDY=ON
|
|
cmake --build .build/host-tidy --parallel 2
|
|
|
|
host-coverage:
|
|
name: Host branch coverage
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up uv
|
|
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d
|
|
with:
|
|
version: "0.12.5"
|
|
python-version: "3.11"
|
|
enable-cache: true
|
|
cache-dependency-glob: uv.lock
|
|
- name: Install locked Python environment
|
|
run: |
|
|
set -euo pipefail
|
|
uv sync --frozen
|
|
- name: Install LLVM coverage tools
|
|
run: |
|
|
set -euo pipefail
|
|
sudo apt-get update
|
|
sudo apt-get install -y llvm-18
|
|
- name: Build and collect LLVM coverage
|
|
env:
|
|
CC: clang
|
|
CXX: clang++
|
|
LLVM_PROFILE_FILE: ${{ github.workspace }}/.build/coverage/profile-%p.profraw
|
|
run: |
|
|
set -euo pipefail
|
|
export PATH="/usr/lib/llvm-18/bin:$PATH"
|
|
llvm-profdata --version | head -n 1
|
|
cmake -S poc/host -B .build/coverage -DENABLE_COVERAGE=ON
|
|
cmake --build .build/coverage --parallel 2
|
|
ctest --test-dir .build/coverage --output-on-failure
|
|
llvm-profdata merge -sparse .build/coverage/*.profraw -o .build/coverage/coverage.profdata
|
|
llvm-cov export .build/coverage/frame_abi_test \
|
|
-object=.build/coverage/frame_handle_test \
|
|
-object=.build/coverage/lifecycle_state_test \
|
|
-object=.build/coverage/frame_abi_c_test \
|
|
-instr-profile=.build/coverage/coverage.profdata \
|
|
-sources poc/common/components/frame_poc_runtime/include/frame_poc/frame_abi.h \
|
|
poc/common/components/frame_poc_runtime/include/frame_poc/frame_handle.hh \
|
|
poc/common/components/frame_poc_runtime/include/frame_poc/lifecycle_state.hh \
|
|
> .build/coverage/coverage.json
|
|
uv run frame-coverage .build/coverage/coverage.json --minimum 90
|
|
|
|
secrets:
|
|
name: Gitleaks
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Check out full history
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
- name: Scan repository history
|
|
uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
GITLEAKS_CONFIG: .gitleaks.toml
|
|
GITLEAKS_ENABLE_COMMENTS: "false"
|
|
GITLEAKS_ENABLE_UPLOAD_ARTIFACT: "false"
|
|
|
|
firmware-dev:
|
|
name: ESP-IDF dev firmware
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 30
|
|
container:
|
|
image: docker.io/espressif/idf@sha256:0d8c9773d48a327233f9c1d7c654ff0bcf133ae24503ea2e97a57cfe02b8cb67
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Configure and build dev firmware
|
|
run: |
|
|
. /opt/esp/idf/export.sh
|
|
set -euo pipefail
|
|
cmake --preset dev
|
|
cmake --build --preset dev --parallel 2
|
|
- name: Upload dev firmware
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
with:
|
|
name: firmware-dev
|
|
path: |
|
|
.build/dev/*.bin
|
|
.build/dev/*.elf
|
|
.build/dev/*.map
|
|
.build/dev/bootloader/*.bin
|
|
.build/dev/partition_table/*.bin
|
|
if-no-files-found: error
|
|
retention-days: 14
|
|
include-hidden-files: true
|
|
|
|
firmware-m1:
|
|
name: ESP-IDF M1 hardware firmware
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 30
|
|
container:
|
|
image: docker.io/espressif/idf@sha256:0d8c9773d48a327233f9c1d7c654ff0bcf133ae24503ea2e97a57cfe02b8cb67
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Configure and build M1 firmware
|
|
working-directory: poc/apps/m1_hardware
|
|
run: |
|
|
. /opt/esp/idf/export.sh
|
|
set -euo pipefail
|
|
cmake --preset default
|
|
cmake --build --preset default --parallel 2
|
|
- name: Upload M1 firmware
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
with:
|
|
name: firmware-m1
|
|
path: |
|
|
poc/apps/m1_hardware/build/default/*.bin
|
|
poc/apps/m1_hardware/build/default/*.elf
|
|
poc/apps/m1_hardware/build/default/*.map
|
|
poc/apps/m1_hardware/build/default/bootloader/*.bin
|
|
poc/apps/m1_hardware/build/default/partition_table/*.bin
|
|
if-no-files-found: error
|
|
retention-days: 14
|
|
include-hidden-files: true
|
|
|
|
firmware-poc-a:
|
|
name: ESP-IDF PoC-A firmware
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 30
|
|
container:
|
|
image: docker.io/espressif/idf@sha256:0d8c9773d48a327233f9c1d7c654ff0bcf133ae24503ea2e97a57cfe02b8cb67
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Configure and build PoC-A firmware
|
|
working-directory: poc/apps/poc_a
|
|
run: |
|
|
. /opt/esp/idf/export.sh
|
|
set -euo pipefail
|
|
cmake --preset default
|
|
cmake --build --preset default --parallel 2
|
|
- name: Upload PoC-A firmware
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
with:
|
|
name: firmware-poc-a
|
|
path: |
|
|
poc/apps/poc_a/build/default/*.bin
|
|
poc/apps/poc_a/build/default/*.elf
|
|
poc/apps/poc_a/build/default/*.map
|
|
poc/apps/poc_a/build/default/bootloader/*.bin
|
|
poc/apps/poc_a/build/default/partition_table/*.bin
|
|
if-no-files-found: error
|
|
retention-days: 14
|
|
include-hidden-files: true
|
|
|
|
required:
|
|
name: CI / required
|
|
runs-on: ubuntu-24.04
|
|
if: always()
|
|
needs:
|
|
- repository-gates
|
|
- mpb-corpus-gates
|
|
- host-clang-sanitizers
|
|
- host-gcc
|
|
- host-clang-tidy
|
|
- host-coverage
|
|
- secrets
|
|
- firmware-dev
|
|
- firmware-m1
|
|
- firmware-poc-a
|
|
steps:
|
|
- name: Confirm required jobs passed
|
|
env:
|
|
FIRMWARE_DEV_RESULT: ${{ needs.firmware-dev.result }}
|
|
MPB_CORPUS_GATES_RESULT: ${{ needs.mpb-corpus-gates.result }}
|
|
HOST_CLANG_RESULT: ${{ needs.host-clang-sanitizers.result }}
|
|
HOST_GCC_RESULT: ${{ needs.host-gcc.result }}
|
|
HOST_TIDY_RESULT: ${{ needs.host-clang-tidy.result }}
|
|
HOST_COVERAGE_RESULT: ${{ needs.host-coverage.result }}
|
|
SECRETS_RESULT: ${{ needs.secrets.result }}
|
|
REPOSITORY_GATES_RESULT: ${{ needs.repository-gates.result }}
|
|
FIRMWARE_M1_RESULT: ${{ needs.firmware-m1.result }}
|
|
FIRMWARE_POC_A_RESULT: ${{ needs.firmware-poc-a.result }}
|
|
run: |
|
|
set -euo pipefail
|
|
test "${REPOSITORY_GATES_RESULT}" = success
|
|
test "${MPB_CORPUS_GATES_RESULT}" = success
|
|
test "${HOST_CLANG_RESULT}" = success
|
|
test "${HOST_GCC_RESULT}" = success
|
|
test "${HOST_TIDY_RESULT}" = success
|
|
test "${HOST_COVERAGE_RESULT}" = success
|
|
test "${SECRETS_RESULT}" = success
|
|
test "${FIRMWARE_DEV_RESULT}" = success
|
|
test "${FIRMWARE_M1_RESULT}" = success
|
|
test "${FIRMWARE_POC_A_RESULT}" = success
|
|
printf '%s\n' 'All required CI jobs passed.'
|