Documentation
¶
Overview ¶
Package docsgates is the docs-gates bridge sweeper: on a timer it runs `docs-gates run <repo> --json` per pool repo and mints ONE fix task per FAIL gate, dedup-keyed `docs-gates:<repo>:<gate>` — fleet doc-drift findings flow into the queue the way incident reports do (ADR-0021 pattern). A journal watermark cursor ("docsgates-bridge" in the watermarks table, the internal/watermark pattern) checkpoints the journal head after every fully-successful sweep pass, so `tq watermarks show` pins when the fleet's docs were last assessed and a rewind replays the same deduped mints.
Index ¶
Constants ¶
const DefaultMaxAttempts = 2
DefaultMaxAttempts bounds burned failures on a minted fix task — a repo with an unfixable gate must not drain the attempt budget.
const DefaultPriority = queue.MachineMin
DefaultPriority places minted fix tasks in the machine band: operational doc-drift work, not user backlog (the dep-sweep ruling).
const DefaultTimeout = 5 * time.Minute
DefaultTimeout bounds one repo's docs-gates run.
const WatermarkKey = "docsgates-bridge"
WatermarkKey is the bridge's identity in the watermarks table, shared by every bridge over the same database.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge is the timer-driven docs-gates sweeper. Safe for concurrent use is not claimed: wire ONE tick per interval, like every mint pass.
func NewBridge ¶
func NewBridge(cfg BridgeConfig) *Bridge
NewBridge returns a bridge over store. A nil Runner falls back to the Bin runner; a zero Timeout/Priority/MaxAttempts selects its default.
func (*Bridge) Cursor ¶
Cursor returns the persisted journal-head cursor of the last fully-successful sweep pass (bootstrap-at-head when the bridge never ran), the watermark.Note contract of internal/watermark.
func (*Bridge) Sweep ¶
Sweep assesses every configured repo and mints one fix task per FAIL gate. A repo runner failure aborts the pass WITHOUT checkpointing the cursor — an unassessed repo must not read as covered. Mint failures are per-gate: the pass continues (the next tick re-hits the dedup key), but the sweep returns the first mint error after checkpointing.
type BridgeConfig ¶
type BridgeConfig struct {
// Store enqueues fix tasks and owns the watermark row. Required.
Store queue.Store
// Runner assesses a repo. nil selects the binary runner (Bin).
Runner Runner
// Bin is the docs-gates binary (PATH name or absolute) for the
// default runner.
Bin string
// Timeout bounds one repo run; 0 selects the default.
Timeout time.Duration
// Repos are the assessed pool repos.
Repos []Repo
// Priority mints fix tasks; 0 selects the default (machine band).
Priority int
// MaxAttempts bounds minted fix tasks; 0 selects the default.
MaxAttempts int
// Log receives mint/skip lines. nil logs nothing.
Log *slog.Logger
}
BridgeConfig controls one Bridge.
type Gate ¶
type Gate struct {
Name string `json:"name"`
Verdict string `json:"verdict"`
Skipped bool `json:"skipped"`
}
Gate is one gate verdict from the `docs-gates run --json` matrix.
type Repo ¶
type Repo struct {
// Name is the project key (dedup identity, AgentPayload.Repo resolved
// against the pool's projects dir).
Name string
// Dir is the working directory the binary runs in. Empty means the
// name resolves against the executor's ProjectsDir as-is.
Dir string
}
Repo is one pool repo the bridge assesses.
type Runner ¶
Runner assesses one repo, returning its verdict matrix. The production runner shells out to the docs-gates binary; tests inject stubs.
type Stats ¶
type Stats struct {
// Repos is the number of repos assessed.
Repos int
// Failed counts gates that FAILed (the mint candidates).
Failed int
// Minted counts fresh fix tasks enqueued.
Minted int
// Known counts mints whose task already existed (dedup hit).
Known int
// Skipped counts SKIPped gates (not assessed this run — never minted).
Skipped int
}
Stats summarizes one sweep pass.