Skip to content

feat: hearth options, manifest plugin and manifest diff - #2

Merged
bketelsen merged 4 commits into
mainfrom
irulan/t3-options-manifest
Nov 16, 2026
Merged

bketelsen merged 4 commits into
mainfrom
irulan/t3-options-manifest

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The first PR of hearth, the toolkit that frostyard/core ADR-0085 records. It onboards the repository to core's repository baseline (rows B1 to B19) and adds the options, the manifest plugin, the manifest schema and the compatibility check. The permission runtime, the lodge adapter, the MCP plugin and the events plugin come in later phases (docs/plans/0001-roadmap.md).

  • Options (docs/specs/options.md): proto/frostyard/hearth/v1/options.proto defines MethodOptions.hearth_rpc (51370), FieldOptions.hearth_selector (51371) and MessageOptions.hearth_event (51372). The numbers 51370 to 51379 are in-house until the Protobuf global extension registry grants a number. buf lint (STANDARD) passes.
  • Model (internal/model): builds the app model that every plugin shares, and fails generation on: an RPC with no hearth_rpc, no permission, a wrong app prefix, no effect or an empty expose; an agent RPC that streams or carries google.protobuf.Any or a map of messages; a selector field that is not a singular string; a duplicate tool name or event type; a bad example; an event whose read permission is scoped by a selector that its topic does not carry.
  • Manifest plugin (cmd/protoc-gen-hearth-manifest): writes manifest.json in canonical JSON and validates it against schema/manifest-v1.json (JSON Schema 2020-12) before it writes it. Golden tests compile the fixtures in memory with protocompile (docs/specs/manifest.md).
  • Diff (cmd/hearth, manifest.Diff): hearth manifest diff OLD NEW exits 1 on a breaking change (removed operation, tool or event; changed permission, effect, selector or topic; changed app) unless NEW's version is the next major (for 0.y.z, the next minor), 0 when OLD is absent or nothing breaks, 2 on an unreadable or invalid manifest.
  • Pins and generation: buf 1.75.0, protoc-gen-go 1.36.12, golangci-lint 2.15.0 and svu 3.4.1 in mise.toml and mise.lock (checksums for 4 platforms); local plugins only; buf.lock has no dependency (descriptor.proto is built into buf). make gen-check regenerates gen/ and testdata/e2e/gen/ into a temp dir and fails on a diff.
  • Gate in Go (ADR-0005): the template's Node scripts become Go tests: internal/workflowcheck (symlinks, corrections in core's canonical form, risk paths with rules B and C, Dependabot, pinned actions, buf config), internal/repocheck (links, docs index, private hosts, and the import boundary: no lodge, other frostyard, bketelsen or Pi module), and internal/cmd/corrections-base.
  • Docs: ADR 0004 and 0005, design overview, the 2 specs, the roadmap (incubating, decision date 2027-03-31), docs/org-adrs.md, a docs site in core ADR-0070's layout (site/, make site, .github/workflows/site.yml), README of kind tool, AGENTS.md, SECURITY.md, policies/agent-governance.json.

Risk tier

Level: level:L1. Risk tier: 3. This PR adds the risk list itself and every path in it. The L1 paths it touches, and why the change is safe:

  • mise.toml, mise.lock: new pins of buf, protoc-gen-go, golangci-lint and svu, each from the aqua registry with a checksum per platform; Node is gone. CI installs exactly these.
  • go.mod, go.sum: the module's first dependencies (protobuf, protocompile, jsonschema, yaml), from the Go checksum database; make vulncheck reports 0 reachable vulnerabilities.
  • buf.yaml, buf.lock, buf.gen.yaml: local plugins only, no dependency, no remote BSR plugin (a test fails on a remote plugin or a dependency without a digest).
  • proto/frostyard/hearth/v1/options.proto, internal/model/**: new; they declare and check permissions but grant nothing at runtime yet. Each refusal rule has a failure fixture.
  • .svu.yml: new; the tag rule v[0-9]* with v0: true. No release workflow exists.

The L2 paths (.github/**, policies/**, Makefile, the gate's tests, the manifest plugin, manifest/, schema/) are new or rewritten for the Go gate. Every action stays pinned to a full SHA, every workflow has permissions: {} at the top, and every checkout sets persist-credentials: false.

Docs housekeeping

  • New docs started from their category's TEMPLATE.md
  • Every new doc indexed in docs/README.md
  • Cross-links added in both directions (ADR ↔ design ↔ spec ↔ plan)
  • New significant decision recorded as an ADR first, in this PR (0004, 0005)
  • New or edited ADRs are fact-only: context, decision and consequences
  • Conformance aliases and canonical symlinks are unchanged; canonical targets are edited instead

Verification

  • make ci BASE=origin/main green before the first push (verify, gen-check, race, cross, corrections-base)
  • make site builds in strict mode
  • core's scripts/check-corrections.mjs --root .: ok corrections: 8 records; core's check-readme.mjs: ok README.md (tool, 289 words)
  • Workflows changed: every action is SHA-pinned with # vX.Y.Z, permissions: {}, and persist-credentials: false
  • Revert checks: without the read-permission rule, TestReadPermissionOnTopic and TestFail/read-permission-not-on-topic fail; a file that imports github.com/frostyard/lodge/kit/manifest fails TestImportBoundary; 1 byte added to testdata/e2e/gen/manifest.json fails make gen-check; a missing buf.lock fails the buf test; a non-canonical correction record fails the corrections test.

Cross-review

Coder model: deepseek/deepseek-flash. Reviewer: openai/gpt-6.1-sol, read-only, base 4e2c50e7a1fef405418b92979ec5b105085c256f.

Round Head Result
Initial (4 batches; generated code, golden JSON, go.sum and deleted template files excluded) 65114ab685e05252abbd0f5abe7485de988d3273 Not ready: (1) a selector under a map value was skipped, (2) no FEATURE_PROTO3_OPTIONAL, (3, low) the guide made an empty OLD file
Re-review 1 73c8f1ae2ce0d8551c8fa762f3a53839d7d58dfc 2 and 3 resolved; 1 open for recursive messages; (4) the gate recipe failed open on a git error
Re-review 2 619085dd5db7029a91dc5dd7bdf29e753713f17f 1 resolved; 4 open: git cat-file -e failure taken as absent
Re-review 3 a880a27f8b5cbe592879b6a54a5987f1f8055e2d Ready. Blocking: none

Guards: the fixtures selector-in-map-value, selector-in-repeated-message, selector-in-recursive-repeated, TestSelectorInsideCompound, TestProto3Optional (and an optional field in testdata/e2e/proto, which make gen-check runs through a real buf generate), the AGENTS.md rule "A gate recipe fails closed", and 4 records in .memory/corrections/2026-11-15-pr-2-*.json.

Revert tests: without the read-permission rule, TestReadPermissionOnTopic and TestFail/read-permission-not-on-topic fail (scratch worktree at 65114ab); without the compound-path rule, TestSelectorInsideCompound/a_map_value_message, /a_repeated_message_field, TestFail/selector-in-map-value and TestFail/selector-in-repeated-message fail; with the old cycle guard, TestSelectorInsideCompound/a_recursive_repeated_message, /a_recursive_map_value_message and TestFail/selector-in-recursive-repeated fail; without the feature flag, TestProto3Optional fails.

Onboard the repository to the frostyard baseline (core ADR-0071, rows
B1 to B19) and add the first part of hearth (core ADR-0085):

- proto/frostyard/hearth/v1/options.proto: hearth_rpc (51370),
  hearth_selector (51371) and hearth_event (51372), in the in-house
  range 51370 to 51379 until the Protobuf global extension registry
  grants a number.
- internal/model: the shared app model and its generation rules.
- cmd/protoc-gen-hearth-manifest: writes manifest.json, valid against
  schema/manifest-v1.json; golden and failure fixtures.
- cmd/hearth: hearth manifest diff OLD NEW and hearth manifest validate.
- buf, protoc-gen-go, golangci-lint and svu pinned in mise.lock; local
  plugins only; make gen-check regenerates and fails on a diff.
- A Go gate replaces the template's Node scripts (ADR-0005), with an
  import-boundary test, and a docs site (core ADR-0070, ADR-0084).
@github-actions github-actions Bot added level:L1 Read every line risk:high Touches a path in .github/risk-paths.json labels Nov 16, 2026
… optional

A selector inside a map value or a repeated message has no single value for the permission check, so generation now refuses it instead of skipping it or recording it as singular. The manifest plugin declares FEATURE_PROTO3_OPTIONAL, without which protoc and buf refuse it for a file with a proto3 optional field; the e2e proto now has an optional field. The manifest guide leaves OLD absent when the default branch has no manifest. Both guards have a correction record (core ADR-0081).
…e fail closed

The selector walk's cycle guard now keys on the message and whether the path is inside a map or a repeated field, so a recursive repeated or map field no longer hides a selector. The documented gate recipe checks that the base commit exists and tests the manifest path with git cat-file, so only an absent manifest at an existing base skips the comparison. Both guards have a correction record (core ADR-0081).
git cat-file -e also fails when the path exists but its object cannot be read (a partial clone), which skipped the comparison. The recipe now looks the path up with git ls-tree on the verified base: only a lookup that succeeds and prints no entry leaves OLD absent; a failed lookup or git show stops the gate.
@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 16, 2026
@bketelsen
bketelsen merged commit 38eaf52 into main Nov 16, 2026
7 checks passed
@frostyard-machines
frostyard-machines deleted the irulan/t3-options-manifest branch November 16, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L1 Read every line ready-for-human Reviewed, CI green: ready for Brian to review and merge risk:high Touches a path in .github/risk-paths.json

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants