Skip to content

feat(contract): the grid's phase currents and the main fuse as extra fields - #86

Merged
frahlg merged 1 commit into
mainfrom
feat/grid-phases
Oct 14, 2026
Merged

frahlg merged 1 commit into
mainfrom
feat/grid-phases

Conversation

@frahlg

@frahlg frahlg commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

WP16 of the iPhone polish plan, step 1 of 3. On 14 October 2026 Fredrik asked to see the grid's phases, L1, L2 and L3, live against the main fuse. The box reads them (/api/status has phase_amps and phase_powers), but lane 0 and FTW Cloud's live body carry no phase.

contract/registry.yaml gains a block after the frozen set:

id name unit
11 grid_l1_da dA
12 grid_l2_da dA
13 grid_l3_da dA
14 grid_fuse_da dA

A new block, not frozen_fields. The frozen set is the core view that an app of any age draws from. The phases are depth for one node's view. They travel the same way, and an id never changes meaning, but a box may stop sending one and an app draws Now without them. Ids above 10 also give way first: lane 0 drops the highest id when a delta does not fit its bucket.

Sign. Tenths of an ampere, signed by the site convention: positive while the phase draws from the grid. Many meters give only the size of the current. The box then takes the sign from the power on the same phase, which the driver has already signed. A meter that gives neither sends positive values both ways, so a positive current alone does not prove import. The registry says so.

Fuse. The main fuse per phase, from the box's config, sent with the phases as their scale.

This app uses none of the names yet. tests/registry-contract.test.ts gains a check that extra field ids and names stay apart from the frozen set and above it. docs/protocol.md gets one paragraph.

Contract-pair: srcfl/ftw@feat/grid-phases

Paired pull requests. All three carry the same file, byte for byte.

Merge this one and the srcfl/ftw one together: while both are open, each CI compares against the other's branch. The app's pull request can follow at any time.

Tests

npm run check                                   594 files, 0 errors
npm test                                        1097 passed, 1 skipped, 2 failed
  the two failures are the escrow timing tests, run while the laptop's
  load average was 70 to 430; alone they pass:
npx vitest run escrow/src/cost.test.ts escrow/src/store.test.ts   32 passed
npx vitest run tests/registry-contract.test.ts  13 passed
npm run build                                   clean
node scripts/check-contract-drift.mjs ../FTW/.worktrees/grid-phases/contract/registry.yaml
  contract/registry.yaml matches, 15726 bytes, byte for byte
  contract/push-catalogue.yaml matches, 3196 bytes, byte for byte
cmp contract/registry.yaml against the ftw-app branch    identical

🤖 Generated with Claude Code

…fields

Field ids 11 to 13 carry the site meter's current on L1, L2 and L3 in
tenths of an ampere, signed by the site convention, and 14 the main fuse
per phase as their scale. They sit in a new extra_fields block after the
frozen set: depth for a node's own view, not the core view. A test keeps
their ids and names apart from the frozen set and above it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T16:48:04.380559Z 758470d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ftw-webapp 758470d Commit Preview URL

Branch Preview URL
Oct 14 2026, 04:33 PM

@frahlg
frahlg merged commit 1e51e18 into main Oct 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant