e2e

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package e2e is hearth's end-to-end demo app: an in-memory note service on the generated permission checks and MCP tools of testdata/e2e/proto/frostyard/demo/v1/demo.proto.

The package is documentation as much as test: it shows what an app writes itself, and what the plugins write for it. The API comes from the generated interface, the permission check of each RPC from protoc-gen-hearth-authz, the hooks that resolve a stored note's group from the app, the tools from protoc-gen-hearth-mcp, and the list filter from the app.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NoteService

type NoteService struct {
	// contains filtered or unexported fields
}

NoteService is the demo app: an in-memory note service.

The app holds its own lock, and its transaction is the lock: 1 RPC that runs on an object id holds the lock from its hook to its end, so the note the hook checked is the note the RPC changes.

func New

func New() *NoteService

New returns a demo app with no note.

func (*NoteService) AuthorizeCreateNote

func (s *NoteService) AuthorizeCreateNote(_ context.Context, _ *store, grant authz.Grant, req *demov1.CreateNoteRequest) error

AuthorizeCreateNote checks the group the new note goes to. A new note has no stored group, so the request carries the object's value.

func (*NoteService) AuthorizeGetNote

func (s *NoteService) AuthorizeGetNote(_ context.Context, tx *store, grant authz.Grant, req *demov1.GetNoteRequest) error

AuthorizeGetNote checks the group the note is stored in. The generated check has already read the capability from the grant: a hook resolves the object.

func (*NoteService) AuthorizeMoveNote

func (s *NoteService) AuthorizeMoveNote(_ context.Context, tx *store, grant authz.Grant, req *demov1.MoveNoteRequest) error

AuthorizeMoveNote checks the group the note leaves. The destination is the request's selector value, and the generated check reads it.

func (*NoteService) AuthorizePublishNote

func (s *NoteService) AuthorizePublishNote(_ context.Context, tx *store, grant authz.Grant, req *demov1.PublishNoteRequest) error

AuthorizePublishNote checks the group the note is stored in.

func (*NoteService) CreateNote

CreateNote writes 1 note.

func (*NoteService) GetNote

GetNote reads 1 note.

func (*NoteService) ListNotes

ListNotes reads the notes of 1 group, and filters each of them with the caller's grant: the generated check reads the request's group, and a note of another group is left out.

func (*NoteService) MoveNote

MoveNote moves 1 note to another group.

func (*NoteService) PublishNote

PublishNote reports where 1 note went.

func (*NoteService) SeedNote

func (s *NoteService) SeedNote(id, group string)

SeedNote stores 1 note, as the app's startup does, with no permission check.

func (*NoteService) Wired

func (s *NoteService) Wired() demov1.NoteServiceAPI

Wired returns the API with the generated permission check of every RPC.

An app serves this API on its own sockets: the stdio MCP server, its private socket and its lodge socket all reach it, each with its own caller.

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL