## 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]>
14 KiB
v4.2 Development Plan
状态: Draft execution plan;严格 gate,未声明任何阶段通过
规范输入: requirements-v4.2.md、project-v4.2-draft.md、ADR-0003、ADR-0002
1. Sequence And Stop Rule
执行顺序固定为:
D0 docs/bootstrap
-> M1 hardware status
-> L1 Loader ADR + PoC-A
-> PoC-B
-> PoC-C
-> PoC-D
-> PoC-E
-> S1 architecture sign-off
-> P1 product components
前一阶段 exit criteria 未全部满足时,下一阶段状态只能是 Blocked。允许提前采购设备和做无代码的实验排期;不得提前实现依赖未通过 gate 的产品组件。任何 required test 失败都停止序列并进入 architecture review,不自动选择替代 loader、静态 plugin 或降低 SLA。
2. D0: Docs And Bootstrap
范围:
- 冻结 v4.2 requirements、architecture delta、ADR 和本计划,保留 v4.1 历史文档。
- 建立 reproducible ESP-IDF/toolchain bootstrap、dev/prod configuration separation、host-test harness 和 evidence schema。
- 建立 strict single-type MPB、partition exactness、Markdown internal link、format/static、host test 和
git diff --check的 CI checks。 - 仅建立 PoC/M1 所需的目录和 reusable test utilities;不建立 product service skeleton 来绕过 coding gate。
Exit criteria:
GOV-001权威顺序、stable requirement IDs 和 status vocabulary 经 review。- Clean checkout 可用 pinned ESP-IDF/toolchain configure;输出 exact version 和 SHA-256。
- Host bootstrap tests 全绿,evidence schema 能拒绝缺少 board_id、commit、config 或 hash 的记录。
- PART-001 的
nvs/nvs_keys/otadata/coredump/ota_0/ota_1/plugin_fs/system_fsexact table 有 machine check,明确拒绝assets_fs;当前实现 gap 未被误报为 pass。 - Personal public GitHub repo 的
main规则为 PR + strict required CI + squash-only + zero required approvals + admin no bypass;PR、push main、nightly triggers 和 no-production-key policy 可检查。
External blockers:
- Personal public GitHub repository 的 branch-rules/required-check 管理权限。
- 可固定并长期获取的 ESP-IDF release tag 和 matching toolchain。
3. M1: Hardware Status
范围严格限于 M1-001:hardware-status firmware、static core status UI、lab scripts 和 local raw evidence;没有 dynamic plugin。
Exact acceptance:
- 启动自动断言 ESP32-S3 dual core、16 MiB Flash、8 MiB PSRAM 和 PART-001 identity,并输出 ESP-IDF/toolchain/firmware hash、board_id、reset reason。
SPI3_HOSTmode 0、10 MHz、指定 pin 驱动 ST7305 physical 300x400 / logical landscape 400x300;黑、白、checkerboard、1-pixel border 和 static core status page 全部正确。- PCF85063 read/write/reset-retention、SHTC3 CRC-valid reading、KEY active-low press/release/short/long 通过;normal cadence 为 10 秒,快速样本只出现在显式 selftest。
- FAT32 TF mount
/frame完成四转换:boot absent、insert to READY、runtime remove、reinsert to READY;每次 READY 通过 write + fsync + read + SHA-256 health check。 - UART command 为当前启动配置/清除 Wi-Fi STA;credential 只驻留 RAM 且所有输出脱敏,重启后丢失;encrypted NVS 持久化等待专用 security board。
- UART 和 TF
/frame/logs/同时产生逐行可解析 JSONL;TF 缺失时 UART 继续且 TF sink 恢复后生成连续、有 sequence 的新记录。 - 一小时 soak 使用 normal 10 秒 RTC/SHTC3 cadence,执行 TF 四转换、KEY 和 Wi-Fi reconnect;无 panic、WDT、heap corruption、status UI/UART 停更。
M1-008local evidence manifest 及其 sdkconfig、partition、map、size、heap、stack、JSONL、photo、hash 齐全,由 repository owner 记录 Pass;不要求 approving review。
不属于 M1:
- 不选择或实现 ELF loader。
- 不构建
.mpbparser、plugin ABI、hot update 或 product clock plugin。 - 不构建 clock page,不以 static status page 测值宣称 PoC-B SLA pass。
External blockers:
- 至少一块目标 Waveshare ESP32-S3-RLCD-4.2 N16R8、数据 USB cable、指定 FAT32 TF。
- 可确认 pin waveform/TE 的 logic analyzer,以及可拍摄显示和模组丝印的设备。
- 若 primary target board 尚不可用,M1 保持 Blocked;模拟器和其他 ESP32-S3 board 不可替代。
4. L1: Loader ADR And PoC-A
顺序要求:M1 sign-off 后才能给 loader candidate 加入目标板 runtime evidence。更新 ADR-0002 的 candidate matrix,先评审选择规则,再运行 PoC-A;ADR 只有全部 required evidence 通过后才能 Accepted。
L1 executed 2026-08-31→09-01: Gate-A PASS per poc/evidence/poc-a-20260901/GATE-A-REPORT.md; ADR-0002 → Accepted (owner sign-off pending).
Exact acceptance:
- 固定 loader repository URL、full commit SHA、license、bundled licenses 和全部 local patch hash。
- 固定 ESP-IDF/toolchain/C++ mode、ELF class/machine、section、Program Header、relocation、import/export allowlist;每项有 positive/negative test。
- 从 immutable verified staging bytes 完成 function pointer 调用、dynamic PSRAM
.text、.plugin_iramcopy/relocate/call/free 和 cache synchronization。 .init_array、constructor/destructor、TLS、exception、RTTI、unwind 的支持或拒绝均有可执行证据;未知项目 fail before execute。- Code MPB 与 resource-only MPB strict single-type positive/negative corpus 通过;mixed payload 在执行或安装前拒绝。
- 1000 次 load/prepare/activate/quiesce/unload,无 leak、crash 或 largest-block 单调恶化;保存 raw heap/IRAM/stack samples。
- Old ACTIVE + 唯一 candidate 在 8 MiB PSRAM 上通过 admission;default arena 256 KiB、hard max 512 KiB;FIFO/lost-wakeup/fairness/completion-cancel tests 通过。
- Capacity 先验证 8 ACTIVE;失败可依次验证 7/6/5 并把最低通过值写入 signed budget,5 失败则 Gate A fail。
- 失败包、错误 relocation、hash/signature/package type mismatch 不执行任何 payload byte。
External blockers:
- Loader candidate maintainer/source availability 和明确 license。
- 锁定 ESP-IDF 对 dynamic executable PSRAM、cache sync 和 WDT hook 的真实支持。
- 若无 candidate 满足全部项,ADR-0002 保持 Blocked,序列停止;不在本 gate 内临时开发 product loader。
5. PoC-B: ST7305 UI SLA
开始条件:PoC-A pass;ADR-0002 Accepted;ADR-0003 已解除 fixture/spare-board/identity blockers 并 Accepted。
Exact acceptance:
- 使用 logical landscape 400x300 packed monochrome,并由 driver 转换到 ST7305 原生列顺序;不运行 RGB565 compatibility benchmark 作为产品指标。
- 10 MHz baseline 下采集 high-priority command-start 和 verified hot-cache page switch 各不少于 10000 samples、至少 10 分钟。
- Command-start p99 <= 1 ms,hot-cache switch p99 <= 500 ms;报告 p50/p99/p99.9/max/drop,不删除 outlier。
- Full 15000-byte refresh、TE、DMA、dirty-region alignment 和更高 SPI frequency 只报告 measurement;不存在 50 ms full-refresh requirement。
- 叠加 Wi-Fi transfer、TLS handshake、TF read/write、4 KiB/s JSONL logging 和 signed capacity limit 的持续 ready strands/pages。
- 验证 page order、KEY short next、long action、startup status -> READY two-second hold -> working clock,以及 clock 不可用时保持 status。
- 验证 clock white-background original flower/explosion theme、
HH:mm、standard-fontYYYY-MM-DD weekday、11 bitmap exact dimensions、无 seconds/character assets。
External blockers:
- Logic analyzer channel/bandwidth、可重复 combined-load network endpoint、稳定供电。
- ADR-0003 未 Accepted 时 PoC-B 不得开始正式计数。
6. PoC-C: Fault, Lifecycle And Rollback
Exact acceptance:
- 注入 infinite handler、finite wait failure、interrupt disable、spinlock >1 ms、late generation callback、queue exhaustion 和 shutdown race。
- 合作实例在 1 秒内退出,accepted async callback exactly once,CLEANUP/destroy 和 resource release exactly once。
- 非合作路径不调用
vTaskDelete/vTaskSuspend、plugin unload 或 unsafe reclaim;写 fault journal/RTC best effort 后 controlled restart。 - 重启后隔离 fault generation,并激活同
security_epochknown-good package。 - 覆盖 prepare/import/activate/PAUSING failure、backlog overflow、state schema mismatch、stateless/stateful migration 和 commit boundary recovery。
- 独立 core Worker 在 plugin fault 后保持运行到 restart;raw trace 可归因 instance/generation/operation。
External blockers:
- 锁定 ESP-IDF Task WDT first-stage notification 能力;不安全时只能验收 panic/restart profile,不得伪称 cooperative recovery。
- 可自动复位、采集 boot-to-boot log 的 lab runner。
7. PoC-D: TF Failure And Storage Isolation
Exact acceptance:
- 注入 boot no-TF、insert、runtime removal、reinsertion、broken individual resource、CRC error、command timeout、queue full、mount/recovery fail 和 non-returning driver call。
- No-TF 时全局零 dynamic plugin,包括 no-resource plugin;core status/update UI、network、UpdateManager、UART 和
/systemrequests 继续 degraded operation。 - Runtime removal 触发所有 plugin 安全 lifecycle stop;非合作实例 controlled restart,且 reboot 后仍不从 internal code store 启动。
- TF recovery 只由 SDStorageWorker 在 in-flight driver call 返回后执行 close -> unmount -> deinit -> init -> mount ->
/framehealth check;trace 中无 concurrent deinit。 - Reinsertion health check 后按 internal registry 自动启动;current whole combination 失败则尝试 previous-good whole combination,禁止 code/resource cross-mix。
- 启动、重插或运行期发现单个 plugin current resource 损坏时只停止该 plugin 并尝试 previous-good whole combination;previous 也失败才 disable,其他 plugin 继续,rollback/disable result durable 记录。
/frame/import与/frame/archive不作为 discovery source;import 和 network pull 都经 strict type/hash/signature 验证及 registry transaction。- Accepted request 在当前 boot exactly-once complete;driver 永不返回时 WDT restart,不声称 timer 可取消同步 I/O。
External blockers:
- 可控 TF removal/fault injection adapter、至少一种固定 model/capacity TF 和可复现实验介质错误的方法。
8. PoC-E: Durability And Production Security
Exact acceptance:
- Current board 最多执行 20 次 preliminary cuts,只 shake down fixture/script,不计入 final evidence。
- Spare board 完成 final 1000 total cuts:session BEGIN、session END、JSONL batch fsync/rotation、code MPB install + registry、resource MPB install + whole-combination registry、firmware OTA pending/confirm 六类各 100,加 400 seeded random cuts。
- 返回 success 的 durable record 每次 reboot 可恢复;DURING loss 不超过 1 秒或 4 KiB;journal 无伪 commit、错误 whole combination、CRC-valid torn record 或不可解释 state。
- malformed/overlap/mixed-type/TLV/signature/hash/key_id/target/ABI/epoch corpus 全部在 ELF execute/resource commit 前拒绝。
- Spare board 实证 Secure Boot V2、Flash Encryption release mode、encrypted NVS/data readback、低 epoch reject、同 epoch rollback 和 epoch exhaustion policy。
- Firmware A/B pending-verify self-test、confirm 和 rollback 全路径通过;OTA/update 对 UI SLA 的影响有 maintenance-mode 决策证据。
- Production private key 不进入 repository、GitHub Actions、log 或 artifact;offline signing provenance 可关联 unsigned digest 和最终 image/package hash。
External blockers:
- 能真正切断 board input power 的 programmable fixture、voltage measurement 和独立 fixture firmware/config revision。
- 一块永久标识的 destructive security/eFuse spare board。
- 受控 offline signing environment 和 production-like test keys。
当前这些条件未完成,因此 PoC-E 和最终 sign-off 保持 Blocked;esp_restart()、USB reset 或只切 peripheral power 均不能替代。
9. S1: Architecture Sign-Off
Exact acceptance:
- M1、PoC-A 至 PoC-E 全部 Pass,raw evidence hash 可重算,所有外部 blocker 清零。
- ADR-0002、ADR-0003 和 gate 中产生的其他 normative ADR 均 Accepted;Accepted 内容与 requirements 无冲突。
- 全部
PoC-derived数值已进入 Accepted ADR 或 signed release configuration;Draft 中无被实现默认为真的 TBD。 - GOV 至 GH requirement traceability review 完成,partition/no-TF/signing/epoch/UI SLA/quota/lifecycle 与 tests 一致。
- GitHub owner sign-off issue/release 列出 local evidence manifest digest、accepted ADR、known limitations 和 timestamp;不要求 approving review。
任何 exception 必须先形成 ADR 并重新运行受影响 gate;会议口头批准不算 exit。
10. P1: Product Components
只有 S1 complete 后才开始。推荐依赖顺序:
- Public C ABI、error/status、instance/generation identity、bounded pools 和 metrics。
- PluginScheduler strand/timer/managed task 与 WatchdogManager。
- DisplayService、LifecycleManager、SystemStorageWorker、SDStorageWorker、NetProxy、LogGateway、UpdateManager core Workers。
- EventBus、MemoryService generation arena、ResourceLease 和 storage/network service tables。
.mpbparser/signature/epoch policy、PluginLoader 和 transactional hot update。- Product clock plugin、strict signed TF resource-only MPB、host/board regression suite。
- Production provisioning、offline signing、OTA release 和 manufacturing evidence。
每个 component PR 必须引用稳定 requirement ID,执行 host + applicable hardware regression,并证明没有扩大 plugin trust/capability。PoC code 只有经过 normal PR scrutiny、license audit、tests 和需求追踪后才能复用;branch 仍为 zero required approvals,PoC pass 本身也不是 production quality approval。