Commit Graph
10 Commits
Author SHA1 Message Date
Lainandlain 5bbd2fe6cc fix(m1): drive wifi reconnect through the disconnect event (#4)
## Fix

The M1 soak (m1-20260831, PR #3) found console `wifi reconnect` never
returns to CONNECTED: **0/5 soak cycles + 0/1 controlled repro = 0/6**.
Root cause: `wifi_service.cc reconnect()` called `esp_wifi_connect()`
while the STA was still associated — IDF v6 rejects it (`sta is
connected, disconnect before connecting to new ap`), no
`WIFI_EVENT_STA_DISCONNECTED` fires, so the event-driven retry never
engaged and the app stayed CONNECTING indefinitely.

`reconnect()` now calls `esp_wifi_disconnect()`; the existing disconnect
handler drives `esp_wifi_connect()` while `configured_`. Already-idle
(`ESP_ERR_WIFI_NOT_CONNECT`) keeps a direct connect.
`connect_sta`/`initialize`/portal paths unchanged (already disconnect
first).

## On-device re-verify (fixed build, /dev/ttyACM0)

- **3/3 cycles** `wifi reconnect` → CONNECTED again in **~10s**, same IP
restored (192.168.50.178); telemetry `CONNECTED→DISCONNECTED→CONNECTED`
per cycle proves the handler path (DISCONNECTED state is only set by the
event handler); IDF log shows `state: init→auth→assoc→run` → `connected`
→ `sta ip:`; zero `Reconnect failed:` warnings. [PASS-fix-cycle-1..3]
- Boot regression: auto-connect GOT_IP, JSONL `ap_setup:false`,
`tf_logging:true`. [PASS-fix-boot]

## Evidence amendment

`poc/evidence/m1-20260831/manifest.json`: verdict FAIL → **PASS** with
the fix commit recorded (`d084276`) and re-verify stats added to
metrics; soak artifacts and the historical FAIL notes kept unchanged.
`frame-evidence` green.

Diff: 5 insertions / 1 deletion in `wifi_service.cc` + manifest note.

---------

Co-authored-by: ania-lain <[email protected]>
2026-08-31 11:45:42 +08:00
Lainandlain b6ed3234a1 docs(evidence): add M1 soak and TF transition results (#3)
## M1 soak evidence (1h) + TF/KEY assist windows

**Manifest verdict: FAIL — one criterion.** Console `wifi reconnect`
never returns to CONNECTED (0/5 soak cycles + 0/1 controlled repro).
Root cause: `wifi_service.cc reconnect()` calls `esp_wifi_connect()`
while still associated; IDF v6 rejects it (`sta is connected, disconnect
before connecting to new ap`), no disconnect event fires, so the
event-driven auto-reconnect never engages. Boot auto-connect and the
portal path are unaffected (`connect_stored` disconnects first). Fix
tracked as a follow-up task.

### Soak metrics (3600s, run m1-20260831T021427Z)
| criterion | result |
| --- | --- |
| JSONL count 360±10 | 358 PASS |
| sequence strictly monotonic | 25..384 PASS |
| status:FAILED lines | 0 PASS |
| reset_reason constant | 11 everywhere PASS |
| tf state | READY all samples PASS |
| wifi reconnect → CONNECTED | 0/5 **FAIL** |
| internal_free decline <15% | N/A (heap not instrumented) |

### Assist windows
- W1 KEY ≥3s portal hold: PASS (AP up, auto-recovery to CONNECTED ≤120s)
- W1 short/long: +2/+2 exact, no spurious (via retry window) PASS
- W2 TF: 2 pull→insert cycles, 4/4 transitions PASS
- W3 absent-boot: classified ≤0.9s, DEGRADED never FAILED, logging
resumed PASS

### Tooling
`frame-m1-capture` gains `--command`/`--command-interval` (periodic
`wifi reconnect`) with pytest coverage. Gates:
ruff/pyright/pytest/frame-partitions/frame-evidence/frame-doc-links/frame-sbom
all green locally.

Co-authored-by: ania-lain <[email protected]>
2026-08-31 11:33:03 +08:00
Lainandlain d73cadbcd6 ci: repair first-run workflow failures (#1)
## Root causes (run 33344835245)

| Job | Cause | Fix |
|---|---|---|
| Host GCC compatibility | Runner GCC 13.3 has no `-std=c++26`;
`poc/host` sets `CMAKE_CXX_STANDARD 26` | Install `gcc-14`/`g++-14`, set
`CC`/`CXX` |
| Host branch coverage | `llvm-profdata: command not found` (clang-18
present, LLVM tools absent) | Install `llvm-18`, prepend
`/usr/lib/llvm-18/bin` to PATH |
| ESP-IDF dev firmware | `cmake: command not found` — action overrides
container entrypoint so the IDF env is never sourced | Source `.
/opt/esp/idf/export.sh` in the build step |
| ESP-IDF M1 hardware firmware | same as above | same |
| Repository gates | clang-format v22-formatted sources vs CI
clang-format-18 (console_service.cc:260,300; display_service.cc:31;
status_log.cc:34) | Reformatted with clang-format 18.1.8 semantics; full
dry-run green |
| Gitleaks | No secret finding: the push-event scan range referenced
stale pre-rewrite revision `7bae861` (unknown revision); scan infra
failed | No change — one-time bootstrap artifact; PR/post-merge events
have valid ranges (verified by this run) |

Host Clang ASan/UBSan and Host clang-tidy were already green; `required`
is the aggregate.

Formatting diffs are formatting-only (`struct tm utc_time{}` -> `struct
tm utc_time {}`).

---------

Co-authored-by: ania-lain <[email protected]>
2026-08-31 09:04:01 +08:00
lain 2851ac7fc5 fix(m1): harden provisioning per F2 review findings
- bound-check the portal option row snprintf against truncation
- guard the pending-credential handoff with the provision mutex
- selftest now restores (or clears) the saved wifi config instead of wiping it
- mark the two conscious error-code ignores
2026-08-31 08:18:30 +08:00
lainandSisyphus 5f7c60c899 feat(m1): hardware status firmware with wifi web provisioning
Add the M1 milestone tree under poc/ (m1_hardware + poc_a apps,
shared common components, evidence schema). Merges the plan's
'm1 baseline+fixes' and 'wifi provisioning' batches: the poc/ tree is
entirely untracked and both concerns share files.

M1 hardware baseline:
- landscape ST7305 RIP display via LVGL I1 driver
- TF-card status log: JSONL telemetry with CRC32C per line; append
  buffer widened to line[640] after the 512-byte truncation defect
  (payload ~550B with real values) was root-caused on-device
- PCF85063 RTC read, SHTC3 temperature/humidity with plausibility
  checks, KEY input with short/long/portal press thresholds
- boot-time partition identity check and M1-002 boot record fields
  (device_id, image_sha256, reset_reason, services status)

WiFi web provisioning:
- softAP portal Frame-Setup-xxxx with HTTP endpoints /scan, /connect,
  /clear; httpd handlers never call httpd_stop (deadlock hazard) — a
  1s monitor task executes stop/start/connect actions
- credentials persist to system_fs wifi.json (littlefs) per the
  SEC-010 development exception (plaintext, documented in _doc)
- fallback: 5 disconnects without IP or 60s no-IP -> stop retry,
  portal returns; GOT_IP tears the AP down
- KEY >=3s hold requests the portal; prov start/stop/status console
  commands; ap_active/ap_mode_requested surfaces in status JSON/text

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
2026-08-31 08:01:37 +08:00
lainandSisyphus e71bcce56e chore(build): reduce root firmware to no-op stub and freeze layout
Retire the product-firmware skeleton until the v4.2 architecture is
signed off (README marks the repo draft/PoC):

- main/ reduced to a no-op stub (main.cc + CMakeLists registering only
  main.cc; idf_component.yml with the cjson managed dependency), root
  app builds clean under both dev and prod presets (IDF v6.0.2)
- delete the 13 product components/ files (app_framework, and the
  display/network/ota/startup_ui/storage service stubs)
- freeze root build/layout: CMakeLists.txt, CMakePresets.json,
  partitions.csv (16 MiB custom layout), sdkconfig.defaults,
  dependencies.lock, cmake/ helpers
- add tooling config: .clang-format, .clang-tidy, .clangd,
  .devcontainer/, .vscode/

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
2026-08-31 08:01:06 +08:00
lainandSisyphus a6d6168fd5 chore: add community files, CI workflows, and host test tooling
Add the repository-facing scaffolding:

- Community/legal: README.md, LICENSE (GPL-3.0-or-later), NOTICE,
  CONTRIBUTING.md, SECURITY.md, CODE_OF_CONDUCT.md, .gitleaks.toml
- CI: .github/ workflows (ci.yml aggregate gate, nightly.yml, codeql.yml),
  issue/PR templates, dependabot config (pinned Actions per README)
- Host tooling: tools/frame_tools (ruff/pyright/pytest gates, partition,
  evidence-schema, doc-links, SBOM checks), tests/, pyproject.toml, uv.lock
- poc/ host side: poc/host contract-test suite (ASan/TSan-capable),
  poc/README.md, poc/poc-a.code-workspace

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
2026-08-31 08:00:51 +08:00
lainandSisyphus dbb7c13729 docs: add v4.2 requirements, plan, and hardware ADRs
Add the v4.2 working documentation set under _doc/:

- requirements-v4.2.md and project-v4.2-draft.md (architecture draft)
- development-plan.md, project.md, README.md (index/navigation)
- decisions/: hardware architecture decision records backing the
  milestone gates (ST7305 display, PCF85063 RTC, SHTC3 sensor,
  TF-card JSONL evidence, KEY input, power/boot policy)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
2026-08-31 08:00:31 +08:00
lainandSisyphus 3d2c14c7aa chore: ignore agent session state
Append .omo/ and .opencode/ (local coding-agent harness state) to
.gitignore so session data can never be staged. Also carries pending
hygiene entries (.pytest_cache, .ruff_cache, .mypy_cache, .coverage,
coverage/, .venv-idf/) and restores the trailing newline.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
2026-08-31 08:00:27 +08:00
lain 7bae861437 #add: 完成基础的项目结构搭建 2026-08-28 16:47:38 +08:00