Skip to content

Commit 81ace44

Browse files
author
FlowMemory HQ Agent
committed
Add optional hardware signal fixtures
1 parent 14f378b commit 81ace44

27 files changed

Lines changed: 2348 additions & 129 deletions
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import fs from "node:fs";
2+
import path from "node:path";
3+
import Ajv2020 from "ajv/dist/2020.js";
4+
import addFormats from "ajv-formats";
5+
6+
const ajv = new Ajv2020({ allErrors: true, strict: false });
7+
addFormats(ajv);
8+
9+
const readJson = (file) => JSON.parse(fs.readFileSync(file, "utf8"));
10+
11+
function validateDoc(schemaFile, doc, label) {
12+
const schema = readJson(schemaFile);
13+
const validate = ajv.compile(schema);
14+
if (!validate(doc)) {
15+
console.error(label);
16+
console.error(validate.errors);
17+
process.exitCode = 1;
18+
return;
19+
}
20+
console.log(`valid: ${label}`);
21+
}
22+
23+
const raw = readJson("hardware/fixtures/flowrouter_sample_seed42.json");
24+
for (const [name, packet] of Object.entries(raw.packets)) {
25+
validateDoc(path.join("hardware/simulator/schemas", `${name}.schema.json`), packet, `packet:${name}`);
26+
}
27+
28+
validateDoc(
29+
"hardware/simulator/schemas/flowchain_operator_signals.schema.json",
30+
readJson("fixtures/hardware/flowrouter_local_alpha_seed42.json"),
31+
"operator-signals",
32+
);
33+
34+
validateDoc(
35+
"schemas/flowmemory/hardware-control-plane-handoff.schema.json",
36+
readJson("fixtures/hardware/flowrouter_control_plane_handoff_seed42.json"),
37+
"control-plane-handoff",
38+
);
39+
40+
validateDoc(
41+
"hardware/simulator/schemas/negative_validation_report.schema.json",
42+
readJson("fixtures/hardware/flowrouter_negative_validation_seed42.json"),
43+
"negative-validation-report",
44+
);
45+
46+
if (process.exitCode) {
47+
process.exit(process.exitCode);
48+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Hardware Signals Completion Audit
2+
3+
Last updated: 2026-05-14
4+
5+
## Objective Restatement
6+
7+
Add optional FlowChain hardware/operator-signal fixtures and integration hooks
8+
inside the allowed hardware scope, keep hardware optional, verify the eight
9+
named checks, and leave PR-ready evidence.
10+
11+
## Prompt-To-Artifact Checklist
12+
13+
| Requirement | Evidence | Status |
14+
| --- | --- | --- |
15+
| Create `docs/agent-runs/hardware-signals/PLAN.md` first | `PLAN.md` exists and records branch, worktree, allowed folders, forbidden folders, objective, and acceptance checks. | Complete |
16+
| Create `docs/agent-runs/hardware-signals/CHECKLIST.md` first | `CHECKLIST.md` exists and records completed hardware, product-e2e, and l1-e2e checks. | Complete |
17+
| Create `docs/agent-runs/hardware-signals/EXPERIMENTS.md` first | `EXPERIMENTS.md` exists and records commands/results. | Complete |
18+
| Create `docs/agent-runs/hardware-signals/NOTES.md` first | `NOTES.md` exists and records source docs, implementation notes, verification notes, blocker history, and final resolution. | Complete |
19+
| Stay inside allowed folders | `node docs/agent-runs/hardware-signals/SCOPE_CHECK.mjs` passed: current dirty files are under `hardware/`, `fixtures/hardware/`, `schemas/flowmemory/hardware-control-plane-handoff.schema.json`, and `docs/agent-runs/hardware-signals/`. | Complete |
20+
| Avoid forbidden folders | Product-e2e generated side effects outside scope were restored; no forbidden-path edits remain in `git status --short`. | Complete |
21+
| `npm run flowchain:hardware:smoke` passes | Passed: `smoke passed: raw packets, operator signals, control-plane handoff, fixture drift check, and 12 negative cases`. | Complete |
22+
| Deterministic heartbeat fixture | `hardware/fixtures/flowrouter_sample_seed42.json` has `heartbeat`; projected into `hardwareNodes` and `heartbeat` signal envelope. | Complete |
23+
| Deterministic alert fixture | `emergency_offline_signal` exists and projects into `alerts` and `challenges`. | Complete |
24+
| Deterministic receipt relay fixture | `compact_receipt_relay` exists and projects into `workReceipts` and `finalityReceipts`. | Complete |
25+
| Deterministic verifier digest fixture | `verifier_report_digest_relay` exists and projects into `verifierReports`. | Complete |
26+
| Deterministic bridge alert fixture | `bridge_alert` exists and projects into `bridgeAlerts` and `alerts`. | Complete |
27+
| Deterministic NFC metadata fixture | `nfc_memory_cartridge_metadata` exists and projects into `artifactCommitments` and `memoryCells`. | Complete |
28+
| Deterministic peer hint fixture if applicable | `peer_hint` packet/schema exists and projects into `peerHints`. | Complete |
29+
| Deterministic node health fixture if applicable | `node_health` packet/schema exists and projects into `nodeHealth`. | Complete |
30+
| Negative fixture rejects malformed IDs | `heartbeat_malformed_device_id` rejected in `flowrouter_negative_validation_seed42.json`. | Complete |
31+
| Negative fixture rejects oversized payloads | `receipt_relay_payload_exceeds_control_budget` and `operator_envelope_payload_exceeds_control_budget` rejected. | Complete |
32+
| Negative fixture rejects stale timestamps | `heartbeat_stale_timestamp` rejected. | Complete |
33+
| Negative fixture rejects duplicate signals | `operator_projection_duplicate_signal_id` rejected. | Complete |
34+
| Negative fixture rejects secret-shaped payloads | `nfc_metadata_secret_shaped_pointer` rejected; fixture scan found no secret-shaped strings. | Complete |
35+
| Generated fixtures contain no secrets | `node docs/agent-runs/hardware-signals/NO_SECRET_FIXTURE_SCAN.mjs` found no secret-shaped strings in the generated hardware fixtures. | Complete |
36+
| Raw packet fixtures have schemas | Raw packet keys were compared to `hardware/simulator/schemas/*.schema.json`; every packet type has a schema file. | Complete |
37+
| Full JSON Schema validation passes | `node docs/agent-runs/hardware-signals/AJV_2020_VALIDATION.mjs` passed for every raw packet fixture, the operator projection, the control-plane handoff, and the negative validation report. | Complete |
38+
| Signal schemas are documented | `hardware/simulator/README.md`, `fixtures/hardware/README.md`, and `hardware/flowrouter/FLOWCHAIN_LOCAL_ALPHA_SIGNALS.md` document packet types, projection shape, validation commands, and boundaries. | Complete |
39+
| Control-plane/dashboard handoff shape stable and documented | `fixtures/hardware/flowrouter_control_plane_handoff_seed42.json`, `schemas/flowmemory/hardware-control-plane-handoff.schema.json`, and docs define read-only optional merge collections/id fields/workbench records. | Complete |
40+
| Meshtastic/LoRa remains low-bandwidth control signaling only | `hardware/lora-sidecar/CONTROL_MESSAGE_INVENTORY.md`, `hardware/README.md`, and `hardware/flowrouter/FLOWCHAIN_LOCAL_ALPHA_SIGNALS.md` explicitly reject broadband, app traffic, artifact transfer, and raw AI/model/media transfer over LoRa. | Complete |
41+
| Unsafe claims remain blocked | `node infra/scripts/check-unsafe-claims.mjs` passed. Additional phrase review over changed files found only negative/guardrail statements for manufacturing, broadband/LoRa, ISP replacement, production bridge, public validators, AI-on-chain, and free-storage terms. | Complete |
42+
| Hardware remains optional and cannot block local chain startup | Handoff has `hardwareRequiredForPrivateTestnet=false`; node health has `chain_startup_blocking=false`; bridge alerts have `doesNotBlockLocalChain=true`; docs repeat the boundary. | Complete |
43+
| `git diff --check` passes | Passed; only Git line-ending warnings were emitted. | Complete |
44+
| `npm run flowchain:product-e2e` still passes after changes | Passed after rebasing onto `origin/main` at `14f378b`, which includes PR #132's default-vs-audit Slither policy fix. | Complete |
45+
| If `npm run flowchain:l1-e2e` exists, run it last | The script exists after the rebase and `npm run flowchain:l1-e2e` passed after `flowchain:product-e2e`. | Complete |
46+
| PR output includes fixture list and exact commands run | `EXPERIMENTS.md` records exact commands; final handoff should list raw packet, operator projection, handoff, negative report, and new node/peer schemas. | Ready |
47+
| State optional integration points | `FLOWCHAIN_LOCAL_ALPHA_SIGNALS.md` and this audit identify read-only control-plane collections, workbench records, optional smoke row, and no-startup-blocking boundary. | Ready |
48+
| GitHub PR state checked | Draft PR #139 is open at `https://github.com/FlowmemoryAI/FlowMemory/pull/139`; GitHub CI passed after the hygiene literal fix. | Complete |
49+
| GitHub hardware issue handoff | Added and later updated #105 status comment with fixture list, passing scope/hardware/AJV/no-secret/claim checks, optional handoff shape, retry docs, and #131 blocker reference: `https://github.com/FlowmemoryAI/FlowMemory/issues/105#issuecomment-4446712093`. | Complete |
50+
| Changed-file scope manifest | `CHANGED_FILES.md` lists the current modified/untracked files and confirms they remain inside allowed hardware-signals scope. | Complete |
51+
| Retry path documented | `RETRY_AFTER_131.md` records the exact commands and completion rule that were used after #131 landed. | Complete |
52+
53+
## Product E2E Blocker Resolution
54+
55+
The hardware/signals work is complete inside its allowed scope. The earlier
56+
product-e2e blocker was resolved by rebasing this branch onto `origin/main` at
57+
`14f378b`, which merged PR #132 and changed the default contract hardening gate
58+
so Slither remains explicit audit tooling instead of running merely because it
59+
is installed on `PATH`.
60+
61+
Evidence:
62+
63+
- `slither` is installed at `C:\Users\ntrap\AppData\Roaming\Python\Python311\Scripts\slither.exe`.
64+
- Before rebasing, `npm run flowchain:product-e2e` still failed in this worktree at the known `contracts/bridge/BaseBridgeLockbox.sol` Slither findings.
65+
- GitHub issue #131 was closed by the owning HQ/contracts policy path after PR #132 merged.
66+
- After rebasing onto `origin/main`, exact `npm run flowchain:product-e2e` passed in the unmodified local environment with Slither still on `PATH`.
67+
- The new `npm run flowchain:l1-e2e` wrapper exists after the rebase and passed when run last.
68+
- Product/L1 e2e generated broader launch/dashboard/service artifacts during the run; those side effects were restored so the branch keeps only allowed hardware-signals changes.
69+
70+
Historical re-checks before PR #132 merged:
71+
72+
- `git fetch --all --prune` found `origin/main` still at `9b025c5`.
73+
- Local branch remains two commits behind `origin/main`, but those commits add long-loop/HQ launcher docs/scripts and do not change the Slither blocker.
74+
- GitHub issue #131 is still open.
75+
- PR #110, `[codex] harden bridge lockbox settlement spine`, is still open and draft.
76+
- No merged source-of-truth fix is available to make this hardware branch pass the exact `npm run flowchain:product-e2e` gate with local Slither on `PATH`.
77+
- Added hardware-signals blocker handoff comment to #131:
78+
`https://github.com/FlowmemoryAI/FlowMemory/issues/131#issuecomment-4446678297`.
79+
80+
Read-only contracts-branch check:
81+
82+
- `origin/agent/full-l1-contracts` is at `497c3b1`.
83+
- That branch does not provide a newer source-of-truth unblock for this hardware worktree.
84+
- The bridge lockbox shape still routes native releases through `releaseNative(...) -> _recordRelease(...) -> recipient.call{value: amount}("")`; `_recordRelease` has a zero-recipient check, but Slither still flags the public `releaseNative` parameter and the low-level native call.
85+
86+
Latest blocker re-check:
87+
88+
- `git fetch --all --prune` completed.
89+
- GitHub issue #131 is still open as of 2026-05-14T01:54:48Z.
90+
- PR #110 is still open and draft.
91+
- `origin/main` remains at `9b025c5`; no merged source-of-truth unblock exists.
92+
- This branch is two commits behind `origin/main`, but those commits add long-loop/HQ launcher material outside this task's allowed hardware-signals edit scope and do not change the product-e2e Slither blocker. The branch was not rebased from this worktree.
93+
- Final re-check in this run: #131 remains open as of 2026-05-14T02:00:17Z, and PR #110 remains open/draft as of 2026-05-14T01:58:27Z.
94+
- Follow-up re-check: #131 remains open as of 2026-05-14T02:09:46Z, and PR #110 remains open/draft as of 2026-05-14T01:58:27Z.
95+
- Later source-of-truth update: #131 closed after PR #132 merged to `main` as `14f378b`.
96+
- Final retry for this branch: `git rebase origin/main`, `npm run flowchain:product-e2e`, and `npm run flowchain:l1-e2e` passed. PR #110 remains open/draft, but it no longer blocks the default product/L1 e2e gate for this branch.
97+
98+
## Conclusion
99+
100+
The prompt-to-artifact audit shows all eight numbered checks are complete after
101+
the rebase and final e2e reruns. Explicit Slither audit findings remain a
102+
contracts/security follow-up, but they no longer block the default product/L1
103+
e2e gate for this hardware-signals branch.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Hardware Signals Changed Files
2+
3+
Last checked: 2026-05-14
4+
5+
## Scope Result
6+
7+
All files in the hardware-signals PR diff are inside the allowed scope:
8+
9+
- `hardware/`
10+
- `fixtures/hardware/`
11+
- `schemas/flowmemory/` hardware handoff schema only
12+
- `docs/agent-runs/hardware-signals/`
13+
14+
No committed PR diff files are under forbidden folders such as `contracts/`,
15+
`crates/`, `services/`, `apps/dashboard/`, or `crypto/`. Broader generated
16+
artifacts from product/L1 e2e runs were restored after verification.
17+
18+
## Modified Files In PR
19+
20+
- `fixtures/hardware/README.md`
21+
- `fixtures/hardware/flowrouter_control_plane_handoff_seed42.json`
22+
- `fixtures/hardware/flowrouter_local_alpha_seed42.json`
23+
- `fixtures/hardware/flowrouter_negative_validation_seed42.json`
24+
- `hardware/README.md`
25+
- `hardware/fixtures/flowrouter_sample_seed42.json`
26+
- `hardware/flowrouter/FLOWCHAIN_LOCAL_ALPHA_SIGNALS.md`
27+
- `hardware/flowrouter/README.md`
28+
- `hardware/lora-sidecar/CONTROL_MESSAGE_INVENTORY.md`
29+
- `hardware/simulator/README.md`
30+
- `hardware/simulator/flowrouter_sim.py`
31+
- `hardware/simulator/schemas/dashboard_feed.schema.json`
32+
- `hardware/simulator/schemas/flowchain_operator_signals.schema.json`
33+
- `schemas/flowmemory/hardware-control-plane-handoff.schema.json`
34+
35+
## Added Files In PR
36+
37+
- `docs/agent-runs/hardware-signals/AUDIT.md`
38+
- `docs/agent-runs/hardware-signals/AJV_2020_VALIDATION.mjs`
39+
- `docs/agent-runs/hardware-signals/CHECKLIST.md`
40+
- `docs/agent-runs/hardware-signals/EXPERIMENTS.md`
41+
- `docs/agent-runs/hardware-signals/NOTES.md`
42+
- `docs/agent-runs/hardware-signals/NO_SECRET_FIXTURE_SCAN.mjs`
43+
- `docs/agent-runs/hardware-signals/PLAN.md`
44+
- `docs/agent-runs/hardware-signals/PR_SUMMARY.md`
45+
- `docs/agent-runs/hardware-signals/CHANGED_FILES.md`
46+
- `docs/agent-runs/hardware-signals/RETRY_AFTER_131.md`
47+
- `docs/agent-runs/hardware-signals/SCOPE_CHECK.mjs`
48+
- `hardware/simulator/schemas/node_health.schema.json`
49+
- `hardware/simulator/schemas/peer_hint.schema.json`
50+
51+
## Final Completion Item
52+
53+
The changed-file scope is clean for hardware review, exact
54+
`npm run flowchain:product-e2e` passed after rebasing onto `origin/main` at
55+
`14f378b`, and `npm run flowchain:l1-e2e` passed last.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Hardware Signals Checklist
2+
3+
- [x] Create run tracking files before implementation edits.
4+
- [x] Confirm GitHub/local task state has no scope conflict beyond the recorded branch-label divergence.
5+
- [x] Inspect existing hardware simulator, schemas, fixtures, and root npm scripts.
6+
- [x] Keep edits inside allowed folders.
7+
- [x] Add or confirm deterministic positive fixtures:
8+
- [x] heartbeat
9+
- [x] alert/offline alert
10+
- [x] receipt relay
11+
- [x] verifier digest
12+
- [x] bridge alert
13+
- [x] NFC metadata
14+
- [x] peer hint
15+
- [x] node health
16+
- [x] Add or confirm negative fixture coverage:
17+
- [x] malformed IDs
18+
- [x] oversized payloads
19+
- [x] stale timestamps
20+
- [x] duplicate signals
21+
- [x] secret-shaped payloads
22+
- [x] Document signal schemas.
23+
- [x] Document control-plane/dashboard handoff shape.
24+
- [x] Preserve Meshtastic/LoRa low-bandwidth control-only boundary.
25+
- [x] Preserve optional hardware startup boundary.
26+
- [x] Run changed-file scope check: `node docs/agent-runs/hardware-signals/SCOPE_CHECK.mjs`.
27+
- [x] Run AJV 2020 schema validation: `node docs/agent-runs/hardware-signals/AJV_2020_VALIDATION.mjs`.
28+
- [x] Run generated-fixture no-secret scan: `node docs/agent-runs/hardware-signals/NO_SECRET_FIXTURE_SCAN.mjs`.
29+
- [x] Run unsafe-claim scan: `node infra/scripts/check-unsafe-claims.mjs`.
30+
- [x] Run `npm run flowchain:hardware:smoke`.
31+
- [x] Run simulator/unit tests if separate commands exist.
32+
- [x] Run `git diff --check`.
33+
- [x] Run `npm run flowchain:product-e2e` with the unmodified current environment.
34+
- Passed after rebasing onto `origin/main` at `14f378b`, which includes PR #132's default-vs-audit Slither policy fix.
35+
- [x] Check for `npm run flowchain:l1-e2e`; the script now exists after the rebase and passed when run last.

0 commit comments

Comments
 (0)