Skip to content

feat: add read-only FTW Site Companion contract - #592

Closed
frahlg wants to merge 1 commit into
masterfrom
codex/ftw-site-companion-contract
Closed

frahlg wants to merge 1 commit into
masterfrom
codex/ftw-site-companion-contract

Conversation

@frahlg

@frahlg frahlg commented Jul 18, 2026

Copy link
Copy Markdown
Member

Summary

  • add a dedicated P-256 FTW site-controller identity, separate from the existing Nova gateway/federation identity
  • expose an explicit, local-only pairing payload with a one-time nonce, expiry, the immutable read-only scope set, and optional discovered Sourceful Zap anchor
  • expose a signed, bounded controller snapshot derived from existing status, aggregate driver health, and plan preview data
  • version the wire contracts as ftw-site-controller-pairing/v1 and ftw-site-controller-snapshot/v1

Safety boundaries

  • scopes are limited to ftw.status.read, ftw.health.read, and ftw.plan.read
  • pairing requires the explicit X-FTW-Pairing-Intent: pair header and pairing/snapshot responses are not CORS-enabled
  • snapshots contain no raw site telemetry, configuration, commands, logs, or support dumps
  • this does not add an outbound Nova uploader, REST/MQTT control path, or any change to FTW's local control authority
  • identity loading and signing fail closed

Validation

  • make verify passed
    • Python optimizer: 35 tests passed
    • Go, Lua contract, compose migration, E2E, external optimizer, go vet ./..., and go build ./... checks passed
  • push hook make verify-all passed
    • includes Linux ARM64, Linux AMD64, and Windows AMD64 cross-builds

frahlg commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

Integration note from the explicit gateway identity invariant now recorded in #591:

  • Gateway/site-controller identity must prefer the existing compatible hardware-protected P-256 key and normalized 18-hex secure-element serial. The private key remains non-exportable.
  • Hosts without that hardware persist a software P-256 fallback with the same public-key/signature wire contract and stable-ID format.
  • The adjective-color-animal gateway name is deterministic from the stable ID with exact existing Sourceful Energy Gateway compatibility; it is not configurable or an authenticator.
  • Remote access must depend on public identity plus a narrow signer interface, not a private-key file representation.

The sitecontroller.Signer direction in this PR is useful. However, wiring it unconditionally to a dedicated file-backed ftw-site-controller.key and declaring it separate from the existing gateway identity conflicts with the secure-element-first rule. This does not need to be solved in #591 and no code is being copied there. Before integration, please resolve provider selection, legacy name mapping, ID normalization/fallback derivation, and recovery/rotation in the focused identity ADR noted in #591.

@frahlg

frahlg commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

Closing this draft as superseded by #624.

The change no longer matches current master: it creates a second site-controller key, lacks a locally verified and revocable read-only grant, predates the current remote API security boundary, and adds a snapshot contract that does not reuse the merged energy ledger v1 contract.

The replacement starts from current master and keeps user/passkey identity separate from the canonical gateway/site-machine identity. Remote access stays optional and outbound-only, grants expire and are checked locally, and FTW keeps full local operation when the service is absent. No code from this conflicted draft will be merged.

@frahlg frahlg closed this Jul 22, 2026
@frahlg
frahlg deleted the codex/ftw-site-companion-contract branch November 11, 2026 09:14
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