refactor: strip doc and issue narration from code comments

Remove PRD/doc paths, bead IDs, phase notes and deleted-test references
from comments; drop test-only hooks left by the test deletion. Includes
in-progress archied bootstrap, gateway and query changes.
This commit is contained in:
sam committed 2026-10-03 21:47:46 +10:00
1 parent 15e55c1c50
commit 96e5d7b84b
269 files changed
+1201 -2609

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@ import (
// The readings an operator acts on. A process is current when it is running
// what it last reported, failed when it rejected what the store holds, and
// unknown when it has stopped re-stamping: a record that outlived its process
// must never read as current (docs/prds/control-plane-apply-status.md).
// must never read as current.
const (
applyStateCurrent = "current"
applyStateFailed = "failed"
+3 -4
View File
@@ -400,10 +400,9 @@ func (s chatStreamSink) ToolCall(event messaging.ToolCallEvent) {
})
}
// Media has no inline rendering path on the dashboard yet (see
// archie-core-1786748942243-6-f109697e), so it degrades to a link in the
// delta stream -- the same fallback Telegram's liveReply uses when its own
// SendMedia call fails.
// Media has no inline rendering path on the dashboard yet, so it degrades to a
// link in the delta stream -- the same fallback Telegram's liveReply uses when
// its own SendMedia call fails.
//
// A local file cannot be linked and this channel cannot upload one, so it
// is REPORTED as undelivered rather than skipped. Skipping was right while
+4 -4
View File
@@ -122,7 +122,7 @@ type ConfigView struct {
// Review is the layered pr-review policy: what a review may post, and
// whether a human decides. It is a plain projection of the effective
// cfg.Review, so the published snapshot tells a reader which dials are in
// force (docs/prds/review-settings-resource.md).
// force.
Review ReviewView `json:"review"`
Storage StorageView `json:"storage"`
Containers ContainersView `json:"containers"`
@@ -156,7 +156,7 @@ type ConfigView struct {
// Server.resolveForge (api_tasks.go). Empty for a single-identity
// deployment, whose forge is Identity above.
Identities []ForgeIdentityView `json:"identities,omitempty"`
// Schema is the field-descriptor catalog (archie-core-b6ew) attached to
// Schema is the field-descriptor catalog attached to
// this view's own values and locked reasons -- see config_schema.go. It
// carries the labels, sections and types a generic configuration renderer
// needs, instead of making each rendering process hardcode them; the flat
@@ -359,7 +359,7 @@ type CatalogProviderView struct {
//
// It is deliberately a function, not a method: rendering the view is not a
// property of an HTTP server, and the process that owns configuration is not
// the process that serves this page (archie-core-ml30).
// the process that serves this page.
func BuildConfigView(in ConfigViewInput) ConfigView {
cfg := in.Config
provenance := append([]ConfigOrigin(nil), in.Provenance...)
@@ -427,7 +427,7 @@ func BuildConfigView(in ConfigViewInput) ConfigView {
//
// The definition lives in config.ChatConfig.FrontEnds, not here: the daemon's
// channel status manager answers the same question on /api/channels, and
// deciding it twice is how the two answers drifted apart (GitHub #821).
// deciding it twice is how the two answers drifted apart.
func chatChannelConfigured(chat config.ChatConfig) bool {
return chat.AnyFrontEndConfigured()
}
+3 -3
View File
@@ -19,8 +19,8 @@ type CuratorActionView struct {
// registry: the names, point-in-time health, and recent activity the
// dashboard's curator view renders. It is deliberately narrower than the
// registry itself -- whose engine contract drags in the agent toolchain --
// so the UI process holds the view without linking it
// (archie-core-8cda.5.6). Whoever owns the registry supplies an adapter at
// so the UI process holds the view without linking it.
// Whoever owns the registry supplies an adapter at
// bootstrap.
type CuratorStatus interface {
Names() []string
@@ -60,7 +60,7 @@ type CuratorHealthView struct {
// handleCurators reports which curators are registered, their point-in-time
// health, and their recent activity -- which curators exist, when each last
// ran, what it changed, and why (archie-core-1786637489932-6). The registry
// ran, what it changed, and why. The registry
// is the sole source of truth; this handler is transport only.
func (s *Server) handleCurators(w http.ResponseWriter, r *http.Request) {
if s.Curators == nil {
+7 -9
View File
@@ -48,16 +48,14 @@ type harnessProfileDoc struct {
// HarnessTerminal opens an ephemeral setup session for one Kit profile: a
// duplex byte stream to the container's PTY, on the same egress path a Kit
// task runs on (docs/prds/external-agent-harness.md, "Setup terminal").
// task runs on.
//
// It is a seam, not an implementation. The container, the sandbox network
// and the egress session belong to the daemon, and the dashboard process is
// forbidden from linking them (cmd/archie-ui/architecture_test.go bans
// internal/container, internal/app/archied and internal/agentexec). A
// composition wires whichever transport carries the session; nil answers the
// route 503 rather than pretending a terminal exists. The interface's
// method types are stdlib only, so a future transport that implements it
// cannot drag a banned package into the UI binary.
// It is a seam, not an implementation. The container, the sandbox network and
// the egress session belong to the daemon, and the dashboard process is
// forbidden from linking them. A composition wires whichever transport carries
// the session; nil answers the route 503 rather than pretending a terminal
// exists. The interface's method types are stdlib only, so a future transport
// that implements it cannot drag a banned package into the UI binary.
type HarnessTerminal interface {
Open(ctx context.Context, orgID, profile string) (io.ReadWriteCloser, error)
}
+3 -5
View File
@@ -187,7 +187,7 @@ func (s *Server) handleMappingDelete(w http.ResponseWriter, r *http.Request) {
// mappingPreviewRequest lets an operator resolve a candidate set of fields
// against a real captured event before saving anything -- Fields is loose
// input, not a saved mapping ID, per docs/prds/payload-field-mapping.md.
// input, not a saved mapping ID
type mappingPreviewRequest struct {
CaptureID string `json:"capture_id"`
Fields []mapping.Field `json:"fields"`
@@ -225,10 +225,8 @@ func (s *Server) handleMappingPreview(w http.ResponseWriter, r *http.Request) {
}
// captureByID finds one captured event by ID. CaptureStore exposes only
// ListCaptures (see docs/prds/event-capture-storage.md -- capture has
// exactly one reader, the dashboard list view, so a by-ID lookup was never
// needed until preview), so this scans the newest window rather than
// adding a new store method for a single low-volume caller.
// ListCaptures, so this scans the newest window rather than adding a new store
// method for a single low-volume caller.
func (s *Server) captureByID(ctx context.Context, id string) (*storecontract.CapturedEvent, error) {
captures, err := s.Captures.ListCaptures(ctx, mappingCaptureScanWindow(s.CaptureMaxEvents))
if err != nil {
+1 -1
View File
@@ -14,7 +14,7 @@ type SkillView struct {
// SkillCatalog is the webui-owned source of the dashboard's skill
// catalogue. It is deliberately a view over already-discovered entries, not
// the discovery machinery: the cataloguer (internal/skill) drags the agent
// toolchain in, and the UI process must not link it (archie-core-8cda.5.6).
// toolchain in, and the UI process must not link it.
// Whoever owns the runtime -- the daemon, via its config -- supplies an
// adapter at bootstrap; an unwired catalog degrades to an empty page.
type SkillCatalog interface {
+4 -5
View File
@@ -10,11 +10,10 @@ import (
"github.com/samcharles93/archie-core/internal/domain/storecontract"
)
// Capture sources and their signing setting (docs/prds/event-automation.md
// "Sources"). A secret is returned only by the two writes that generate it,
// so the operator can copy it into the sender; every other read withholds it.
// Turning signing off is a request plus an approval, both behind the same
// mutation gate that arms a binding.
// Capture sources and their signing setting. A secret is returned only by the
// two writes that generate it, so the operator can copy it into the sender;
// every other read withholds it. Turning signing off is a request plus an
// approval, both behind the same mutation gate that arms a binding.
func (s *Server) handleSourcesList(w http.ResponseWriter, r *http.Request) {
if s.Sources == nil {
+3 -4
View File
@@ -190,9 +190,8 @@ func (s *Server) handleTask(w http.ResponseWriter, r *http.Request) {
type taskActionRequest struct {
Action string `json:"action"`
// Instructions is the re-review's focus, required by the rereview action
// and ignored by every other one (docs/prds/pr-review-operator-
// response.md, Decision 1). The dashboard is the authoritative surface
// that carries operators' instructions; chat is a shortcut with no
// and ignored by every other one. The dashboard is the authoritative
// surface that carries operators' instructions; chat is a shortcut with no
// instruction syntax.
Instructions string `json:"instructions"`
// Findings are the keys of the offered findings an approve posts; an
@@ -358,7 +357,7 @@ func validOrigin(u *url.URL, wantScheme, wantHost string) bool {
// applyOperatorTaskAction sends the action to whoever owns task execution.
// The dashboard operator is authenticated and acts across identities, which
// the Gateway contract carries as its own method (archie-core-8cda.5.4).
// the Gateway contract carries as its own method.
//
// The UI process cannot run this itself: retry limits come from the daemon's
// configuration, closing the forge issue needs its forge client, the
+4 -4
View File
@@ -70,8 +70,8 @@ type taskStageView struct {
// stages it recorded. Attempt bounds, event counts and which attempt numbers
// exist still come from the task's events (an attempt can carry events with
// no step, e.g. agent calls, so events remain the complete attempt index);
// the stages themselves are step_executions, the authoritative record
// (docs/prds/execution-tree-state-machine.md), not a fold over
// the stages themselves are step_executions, the authoritative record,
// not a fold over
// stage_start/stage_finish events.
func (s *Server) handleTaskAttempts(w http.ResponseWriter, r *http.Request) {
t, ok := s.taskByPathID(w, r)
@@ -243,8 +243,8 @@ func attemptBounds(evs []events.Event) (first, last time.Time) {
}
// stageViewsFromSteps builds an attempt's ordered stage occurrences directly
// from its recorded StepExecutions -- the authoritative record
// (docs/prds/execution-tree-state-machine.md), not a fold over
// from its recorded StepExecutions -- the authoritative record,
// not a fold over
// stage_start/stage_finish events. Only kind "stage" steps are shown: agent
// and call steps are the tree's own detail, not this rail's.
func stageViewsFromSteps(steps []task.StepExecution, inFlight bool) []taskStageView {
-1
View File
@@ -54,7 +54,6 @@ type workRequest struct {
// pr_number, for instance. The handler checks the assignment against the
// declaration before the task is admitted, so a request that could only
// fail at the workflow's first stage is refused here instead
// (archie-core-06nq).
Inputs map[string]any `json:"inputs"`
}
+10 -11
View File
@@ -1,12 +1,11 @@
// The access chain at the dashboard and API request path: the second of the
// two places that call the Authorizer (docs/prds/orgs-and-access.md, "Where
// it lives"). A request that carries an identity is assembled into a
// principal; the action and resource kind are derived from the route; the
// chain decides; a denial is recorded with the level that decided it and
// reported as forbidden without the reason.
// The access chain at the dashboard and API request path: the second of the two
// places that call the Authorizer. A request that carries an identity is
// assembled into a principal; the action and resource kind are derived from the
// route; the chain decides; a denial is recorded with the level that decided it
// and reported as forbidden without the reason.
//
// The shared token is the single-operator install's owner of the default org
// (docs/prds/orgs-and-access.md, "Credentials"): the token principal is
// The shared token is the single-operator install's owner of the default org:
// the token principal is
// assembled here, not looked up, until principal credentials exist.
package webui
@@ -80,7 +79,7 @@ func (s *Server) authorize(h http.Handler) http.Handler {
return
}
// A denial inside the caller's org is forbidden, without the
// reason (docs/prds/orgs-and-access.md, "Denials").
// reason.
http.Error(w, "forbidden", http.StatusForbidden)
return
}
@@ -174,8 +173,8 @@ func routeOverride(action access.Action, path string) (access.Action, access.Res
return access.ActionUpdate, access.KindSecret, segmentValue(path, 2), true
case matchPrefix(path, "/api/harness/terminal"):
// Opening the setup terminal captures the binding's OAuth tokens, so
// it is the update action on the secret
// (docs/prds/external-agent-harness.md, "Setup terminal"). The shipped
// it is the update action on the secret.
// The shipped
// org-owner and org-admin policies grant it; the terminal is
// admin-only.
return access.ActionUpdate, access.KindSecret, "", true
+4 -5
View File
@@ -1,6 +1,6 @@
package webui
// Configuration schema contract (archie-core-b6ew.1): descriptor types and
// Configuration schema contract: descriptor types and
// hand-authored field/section metadata for the Configuration page.
//
// This is deliberately NOT a reflection-based schema over config.Config.
@@ -13,12 +13,11 @@ package webui
// attaches a label to a value that was already vetted as safe to show,
// rather than inventing a new safety boundary.
//
// See docs/prds/config-schema.md for the full design.
// ConfigFieldType is how the frontend's generic renderer decides what
// control to show for a field. FieldStructured fields (repositories,
// models, providers) opt out of the generic renderer entirely and keep
// their dedicated editors (archie-core-b6ew.4).
// their dedicated editors.
type ConfigFieldType string
const (
@@ -32,7 +31,7 @@ const (
// ConfigField is one field's rendering contract: what it is, what it means,
// and what changing it would require. Value is attached by the caller
// building the schema against a live ConfigView (archie-core-b6ew.2) -- the
// building the schema against a live ConfigView -- the
// descriptor itself is data-independent.
type ConfigField struct {
// Key is the dotted path this field is addressed by.
@@ -68,7 +67,7 @@ type ConfigSection struct {
// configFieldDescriptors is the hand-authored catalog: one entry per field
// ConfigView exposes today, in the section grouping settings.js already
// renders. Values and LockedReason are attached separately
// against a live ConfigView (archie-core-b6ew.2); this list is the
// against a live ConfigView; this list is the
// data-independent half of the contract -- key, label, type, and the
// safety-relevant property (restart_required) that must be decided
// deliberately rather than defaulted.
+5 -14
View File
@@ -31,20 +31,11 @@ const (
eventPumpPrimeRetryMax = 30 * time.Second
)
// eventPump is the UI process's substitute for the daemon's in-process event
// bus. The daemon hands persisted events to Server.Broadcast from its own bus
// subscription (internal/app/archied/main.go's persistAndBroadcastEvents); a
// process that owns no bus reads the same events back out of the State Store
// instead, over the EventsSince cursor.
//
// Polling is sufficient rather than a compromise, for the reasons recorded in
// docs/architecture/migration-decisions.md ("Dashboard live event delivery"):
// EventsSince pages a total order over (at, id) with a fixed-width time key
// and a deterministic id tie-break, so the cursor cannot skip or repeat;
// sseStream.drain treats a broadcast as a wakeup and re-reads the gap from the
// store, so nothing here changes SSE semantics; and reading the table catches
// writers that never touch a bus, including the audit event ArchiveTask writes
// inside its transaction.
// eventPump stands in for the daemon's event bus in the UI process: it polls
// persisted events from the State Store over the EventsSince cursor and
// broadcasts them. EventsSince pages a total order over (at, id), so the cursor
// never skips or repeats, and polling the table also catches writers that never
// publish to a bus.
type eventPump struct {
store eventReader
log func(string, ...any)
+24 -26
View File
@@ -26,8 +26,8 @@ type Server struct {
Store storecontract.TaskStore
Log *slog.Logger
// Steps lists one execution's recorded StepExecutions
// (docs/prds/execution-tree-state-machine.md): the run detail's
// Steps lists one execution's recorded StepExecutions:
// the run detail's
// authoritative source, GET /api/tasks/{id}/attempts. Nil degrades the
// route to reporting no steps rather than folding stage_start/
// stage_finish events, which tasks.stage used to back and no longer
@@ -50,8 +50,8 @@ type Server struct {
// process whichever implementation it can use: the daemon (whose state
// directory holds the files) its own *logging.TaskRegistry, and the
// dashboard process, which owns no such directory, the State Store client
// -- the read crosses a contract rather than opening a file
// (docs/prds/ui-service-boundary.md). Nil means this process has no
// -- the read crosses a contract rather than opening a file.
// Nil means this process has no
// task-log capability at all, which the handlers report as disabled rather
// than as "the attempt has no log": those are different claims and only one
// of them is about configuration.
@@ -71,9 +71,9 @@ type Server struct {
// /api/skills to an empty page.
Skills SkillCatalog
// Curators is the daemon's live curator registry (epic archie-core-yp9).
// Curators is the daemon's live curator registry.
// Backs GET /api/curators: registered names, per-curator health, and
// recent activity (archie-core-1786637489932-6). Optional: nil reports
// recent activity. Optional: nil reports
// an empty curator list rather than failing the dashboard.
Curators CuratorStatus
@@ -94,7 +94,7 @@ type Server struct {
// ApplyStatus reports which control-plane resource version each process
// is running. Optional: nil renders an empty page rather than failing the
// dashboard (docs/prds/control-plane-apply-status.md).
// dashboard.
ApplyStatus storecontract.ApplyStatusStore
// now is the clock applyState reads staleness against. Nil means
// time.Now; tests set it to pin a record's age.
@@ -118,8 +118,8 @@ type Server struct {
// through a browser -- an agent does exactly that.
Login identity.LoginFlow
// Access evaluates the policy chain for each request
// (docs/prds/orgs-and-access.md). Optional: nil keeps the credential
// Access evaluates the policy chain for each request.
// Optional: nil keeps the credential
// check as the whole gate -- the documented behaviour of an install that
// has not built the chain. Principals assembles the request principal
// from the acting identity; Denials records refusals. All three are
@@ -134,8 +134,8 @@ type Server struct {
Events EventPublisher
// Captures backs the dashboard's read of captured events: the
// GET /api/captures list and the mapping preview's by-ID scan
// (docs/prds/event-capture-storage.md). Optional: nil makes the list
// GET /api/captures list and the mapping preview's by-ID scan.
// Optional: nil makes the list
// answer {"enabled": false} rather than the dashboard failing to start.
Captures storecontract.CaptureStore
// CaptureMaxEvents is the operator's configured [capture] max_events,
@@ -147,46 +147,45 @@ type Server struct {
// senders, so it cannot sit behind requireToken. The handler is owned
// by internal/infrastructure/captureintake.Receiver; this package only
// mounts the route and reads the rows back. The UI process composes
// it from the cutover change (archie-core-8cda.5.4) -- it is the only
// it from the cutover change -- it is the only
// dashboard listener left, and a capture POST answered by the
// token-gated mux would leave intake with no owner. Nil removes the
// route, which is what a store without the capture contract gets:
// two listeners with the same intake authority is what the boundary
// forbids (docs/prds/ui-service-boundary.md:30-33).
// forbids.
CaptureIntake http.Handler
// Mappings persists payload field mappings (docs/prds/payload-field-mapping.md).
// Mappings persists payload field mappings.
// Optional: nil makes every /api/mappings route answer 503 rather than
// the dashboard failing to start.
Mappings storecontract.MappingStore
// EventTypes persists event types (docs/prds/event-automation.md). Optional:
// EventTypes persists event types. Optional:
// nil reports the inspector's event types as disabled.
EventTypes storecontract.EventTypeStore
// Bindings persists playbook bindings: matcher + mapping + workflow
// triples that turn a captured webhook into an archie task
// (docs/prds/webhook-intake-security.md). Optional: nil makes every
// triples that turn a captured webhook into an archie task.
// Optional: nil makes every
// /api/bindings route answer 503 rather than the dashboard failing to start.
Bindings storecontract.BindingStore
// Sources persists capture sources and their signing setting
// (docs/prds/event-automation.md "Sources"). Optional: nil makes every
// Sources persists capture sources and their signing setting.
// Optional: nil makes every
// /api/sources route answer 503 and marks no binding unsigned.
Sources storecontract.SourceStore
// HarnessSecrets reads each credential binding's captured OAuth token
// set, so the harness page can report whether a binding is configured,
// when it expires and which scopes it carries
// (docs/prds/external-agent-harness.md, Credentials). The token values
// when it expires and which scopes it carries.
// The token values
// themselves never reach the browser. Optional: nil answers
// /api/harness/bindings 503 rather than claiming the org has none.
HarnessSecrets storecontract.HarnessSecretStore
// HarnessTerminal opens the setup terminal, a duplex PTY session in an
// ephemeral Kit container (docs/prds/external-agent-harness.md, "Setup
// terminal"). Optional: nil answers /api/harness/terminal 503. The
// implementation belongs to a process that owns containers; the
// ephemeral Kit container. Optional: nil answers /api/harness/terminal 503.
// The implementation belongs to a process that owns containers; the
// dashboard consumes it over a contract and never links one.
HarnessTerminal HarnessTerminal
@@ -203,7 +202,7 @@ type Server struct {
// its next boot -- the webui counterpart of
// channels/telegram.Gateway.UpdateReportPath. Empty (the default unless
// composition wires it) means dashboard-initiated updates get no
// phase-2 report (archie-core-nln7): the operator only sees the
// phase-2 report: the operator only sees the
// synchronous install result, never restart/health/version outcome.
UpdateReportPath string
@@ -376,7 +375,6 @@ func (s *Server) Handler() http.Handler {
}
// The chain runs after the credential check and before any handler: the
// principal exists only once the credential resolved
// (docs/prds/orgs-and-access.md, "Where it lives").
top.Handle("/", s.requireToken(s.authorize(mux)))
return top
}
-5
View File
@@ -70,11 +70,6 @@ func (s *Server) handleSSE(w http.ResponseWriter, r *http.Request) {
stream.drain(r.Context(), conn, stale, logs)
}
// sseSince is the task-only cursor view retained for legacy clients/tests.
// Native reconnects prefer Last-Event-ID; deliberate reconnects use ?since=.
// An invalid or pre-cursor integer degrades to replay from the beginning.
func sseSince(r *http.Request) string { return sseCursors(r).Tasks }
type streamCursors struct {
Tasks string `json:"tasks"`
Logs int64 `json:"logs"`