noteboard

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package noteboard is this repository's own service.

It is the shape an extending product actually ships, rather than a fixture: it owns a bounded ledger with rules of its own, it joins Core's bring-up graph as a component that requires another of this repository's components, and it serves the operator page the sidebar entry points at. Core constructs none of it, reads none of its configuration, and hands it no Core state — Core owns the order it is brought up in and the engine its page is mounted on, and nothing else.

The board reads the steering inputs the harness observed and keeps them as field notes. That crossing is the point: the input arrives at a service this repository composed, through an interface this repository declared, in an order Core resolved from a dependency this repository named.

Index

Constants

View Source
const Capacity = 24

Capacity bounds the notes the board retains. The oldest is discarded first; sequence numbers keep counting past a discarded note, so the page can say which note it is showing rather than only how many are left.

View Source
const ComponentName = "noteboard"

ComponentName is the name this service registers under. Core namespaces the component's diagnostics with it, and the resolver reports it by name when an order cannot be produced.

View Source
const Path = "/field-notes"

Path is where this service's page is served. Core neither knows nor reserves it: Core's routes, including the /claws/... paths, are exactly what they were before this repository existed.

Variables

View Source
var (
	// ErrNoSteering reports a board constructed without a steering source.
	ErrNoSteering = errors.New("noteboard: a steering source is required")
	// ErrUnassembled reports a start attempted before Core assembled the board.
	ErrUnassembled = errors.New("noteboard: the board is not assembled")
)

Functions

func NavItem() webui.NavItem

NavItem is the sidebar entry pointing at that page, appended after Core's own Home, Apps, Fleet, and Activity. It renders with the same markup, keyboard behavior, and aria semantics as those four.

It carries no View, so it is a plain link rather than an in-page view switch: nothing on the operator page renders a section by that name. Its Href is the constant this package registers, because nothing checks that a sidebar entry and a route agree — the only thing that can keep them in step is that there is one of them.

Types

type Board

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

Board is the service. It is safe for concurrent use: Core starts it on one goroutine and the engine serves its page on others.

func New

func New(source ISteering, brand webui.Brand) (*Board, error)

New returns the board this repository composes.

The brand is the same value the composition root hands Core, resolved once here so the page cannot render a different identity than the shell beside it. An invalid brand fails here rather than at the first request.

func (*Board) Component

func (board *Board) Component(steeringComponent *component.Definition) (*component.Definition, error)

Component returns the definition that brings the board up. Assembly establishes the whole ledger — its bound and its counters — so a board Core assembles is one that has recorded nothing yet.

It requires the steering service by pointer identity, so Core assembles and starts the steering store and the steering service before this board and stops it before either of them. That edge is the whole reason the board can read steering inputs at all: an input observed before the store exists is dropped by the service rather than half-recorded here.

func (*Board) Read

func (board *Board) Read() Ledger

Read folds in every steering input the board has not considered yet and returns one view of the result.

It is one method rather than two accessors because the page renders both halves: a reader that asked whether the board was running and then asked for its notes could be told about a running board and handed a stopped one's ledger.

Two rules of this product's own live here. An input identical to the newest retained note is a retry rather than a new note, so it is counted as considered and dropped. And a board Core has not started folds nothing: a half-composed product shows no ledger at all rather than one that starts mid-history.

func (*Board) Register

func (board *Board) Register(router gin.IRouter)

Register mounts the page on the one Gin engine Core builds, beside Core's own API and web UI. That engine has already applied Core's security headers, including its Content-Security-Policy, by the time this handler runs; a mounted page inherits that posture and does not get to loosen it, which is why the page links its styles rather than inlining them.

Register makes Board the bootstrap.IHTTPService this repository registers. Core hands a registered service nothing, so the handler reads the board it is a method on and no Core state at all.

type ISteering

type ISteering interface {
	// Observed returns every steering input recorded so far, oldest first.
	Observed() []string
}

ISteering is the part of a steering service this board reads. It is declared here rather than imported so the ledger's rules can be exercised without a component graph, and so the service that satisfies it can be replaced without this package knowing.

type Ledger

type Ledger struct {
	// Running reports whether Core has started the board. A page renders its
	// standing-by state rather than an empty list when it has not: those are
	// different facts, and an operator looking at a blank page deserves to know
	// which one they are looking at.
	Running bool

	// Notes are the retained notes, oldest first.
	Notes []Note
}

Ledger is one internally consistent read of the board.

type Note

type Note struct {
	// Sequence is the note's position in everything the board has ever
	// recorded, starting at 1. It keeps counting past a discarded note.
	Sequence int
	// Text is the steering input with its surrounding whitespace removed.
	Text string
}

Note is one line of the ledger: what was steered, and which note it is.

Jump to

Keyboard shortcuts

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