Documentation
¶
Overview ¶
Package findings is the list of findings abcd holds a session and a landing to (itd-2611251831138387, spc-2611252115253843): one JSON file for each finding under ~/.abcd.noindex/findings/<root-sha>/, in open/, private/ or settled/. The readings that put an entry here (an agent's block, the words of a closing text, a gate failing at a head) are the callers'; the hold and the landing read this list and not the readings, so a better reader changes neither.
Every level is made and opened through fsutil's declaration scope, which judges each directory's owner and mode, and every file is read through ReadHomeDeclarationDenyingIn denying 0o077. A file is written whole by rename. A put and a settle each judge and write under the root's one lock file, so two writers cannot pass a bound together or lose an entry between them; what is slow (the scan, a settle's question to git) runs before the lock and is checked again under it, the wait for the lock is the caller's deadline where that is nearer, and a read takes no lock. Nothing is removed by age, by a new session or by the worktree going.
Where a settle or a move to private/ was cut short, the entry stands both where it went and where it was; where it went wins, for every reader, and the stale twin is removed when a put or a settle meets it under the lock, as are the temporary files a write cut short left.
A private entry's text is read only through PrivateText, and only for the person: every other return of this package carries it blank.
Index ¶
- Constants
- Variables
- func HoldWords(owed []Entry, fresh map[string]bool, abcd string) (reason, short string)
- func OwedLine(n int, abcd string) string
- type Act
- type Answer
- type Answerer
- type Entry
- type Found
- type Held
- type Kind
- type ReadInput
- type Reading
- type Records
- type SettleRequest
- type Settlement
- type Standing
- type Store
- func (s Store) Held(session string) (Held, error)
- func (s Store) MarkHeld(_ context.Context, session string, h Held) error
- func (s Store) PrivateText(handle string, person bool) (text string, withheld bool, err error)
- func (s Store) Put(ctx context.Context, es ...Entry) ([]Entry, []Unreadable, error)
- func (s Store) Read() (View, error)
- func (s Store) ReadWithin(files int) (View, error)
- func (s Store) Settle(ctx context.Context, req SettleRequest) ([]Entry, error)
- func (s Store) SettleByReceipt(ctx context.Context, checkout string, handles []string, receipt string, ...) ([]Entry, error)
- func (s Store) SettledOf(session string, handles []string) (map[string]bool, error)
- func (s Store) SettledView(n int) ([]Entry, []Unreadable, error)
- func (s Store) WithLock(ctx context.Context, fn func() error) error
- type Unreadable
- type View
- type Withholding
Constants ¶
const BlockInfo = "abcd-findings"
BlockInfo is the info string of the fence the block is written in.
const (
// MaxHoldBytes bounds the hold's words.
MaxHoldBytes = 3000
)
const ( // MaxHoldChain is the most holds in one chain of held stops // (stop_hook_active), below the host's eight. MaxHoldChain = 4 )
Variables ¶
var ( ErrFull = errors.New("findings: the list is full") ErrTooManyFiles = errors.New("findings: more files than the read's budget; the list is unreadable") ErrTooLarge = fmt.Errorf("findings: the entry would not fit its %d-byte file with room left for its settlement, even with its text withheld; nothing written", maxFileBytes) ErrNewer = errors.New("findings: the entry is a newer abcd's") ErrUnknownKind = errors.New("findings: a kind this build does not know") ErrNotCleared = errors.New("findings: that act does not clear the entry") ErrAmbiguous = errors.New("findings: the handle names more than one entry") ErrNoEntry = errors.New("findings: no entry has that handle") ErrUnreadable = errors.New("findings: the entry cannot be read") // ErrLockContention is a put or a settle that could not take the root's // lock within its wait. ErrLockContention = fsutil.ErrLockContention )
The refusals. Each is wrapped with what it names.
Functions ¶
func HoldWords ¶
HoldWords is the hold over owed, the entries fresh names first and marked new: each by handle, kind and holdTextBytes of its redacted text (or why it was withheld), holdNamed at most and then the count, the acts each kind present takes after abcd, the hook's own executable, and the word to name the handle on each line that answers; within MaxHoldBytes. short is the count and the command, said in its place beside an away reason too long to join.
Types ¶
type Act ¶
type Act string
Act is what settles an entry. All but ActReceipt are the command's clearing flags; ActReceipt is a landing's preflight receipt naming the offered head, taken only through SettleByReceipt.
type Answer ¶
type Answer struct {
Holds bool `json:"holds"`
State string `json:"state"`
Where string `json:"where,omitempty"`
}
Answer is what a record says to a claim on it: whether it holds, the state found, and where it was found.
type Answerer ¶
Answerer answers a captured or settled claim on a record id; *Records is the one production uses.
type Entry ¶
type Entry struct {
SchemaVersion int `json:"schema_version"`
Kind Kind `json:"kind"`
Session string `json:"session,omitempty"`
Agent string `json:"agent,omitempty"`
AgentType string `json:"agent_type,omitempty"`
// Checkout is the checkout the payload's directory is in; Place is that
// checkout when a run's state names it as a lane's worktree, else "".
// CheckoutAltered is true where making the checkout valid, safe or within
// its bound changed it: it no longer names the root the text was read in.
Checkout string `json:"checkout,omitempty"`
CheckoutAltered bool `json:"checkout_altered,omitempty"`
Place string `json:"place,omitempty"`
Run string `json:"run,omitempty"`
Lane string `json:"lane,omitempty"`
// Head names a gate's entry: set, the entry is named by kind, place and
// head, so a failure at a new head is a new entry.
Head string `json:"head,omitempty"`
// Words is true for an entry the words of a closing text alone made: a
// word match is not a confirmed finding, so it holds no stop while the
// person is present (dcn-2611252038554826). Its name does not depend on
// it.
Words bool `json:"words,omitempty"`
// Position is where in the transcript a reading took the text from; a
// withheld reading's entry is named by it.
Position string `json:"position,omitempty"`
Text string `json:"text,omitempty"`
// Withheld is why no text was kept, or "".
Withheld Withholding `json:"text_withheld,omitempty"`
// WithheldWhy is the scanner's own cause, sanitised and cut, where it gave
// one.
WithheldWhy string `json:"text_withheld_why,omitempty"`
// WithheldSetting is the identity setting to re-save where the scan
// could not run because its value is not valid UTF-8, or "".
WithheldSetting string `json:"text_withheld_setting,omitempty"`
At time.Time `json:"at"`
Settled *Settlement `json:"settled,omitempty"`
Name string `json:"-"`
}
Entry is one finding. Name is the file's, never stored in it.
func (Entry) WithheldLine ¶
WithheldLine is the sentence a stop or a list says in place of e's withheld text, or "" for a text kept. A withheld entry holds like any other.
type Found ¶
Found is one entry a reading made, before it is put: its kind, its text, whether the words alone made it, and its index in the reading, the position a withheld entry is named by.
type Held ¶
type Held struct {
SchemaVersion int `json:"schema_version"`
Names []string `json:"names"`
Chain int `json:"chain"`
At time.Time `json:"at"`
}
Held is one session's mark: the names of the entries its stops were held for, and how many holds the current chain of held stops has taken.
type ReadInput ¶
type ReadInput struct {
Text string
// BlockOnly reads the block and not the words: a review role's return,
// and an answer in a chain of held stops. A text with a Verdict heading
// is read so whatever this says.
BlockOnly bool
// Records answers the block's claims and passes a words line naming an
// open record. Nil holds no claim and passes no line.
Records Standing
// Handles are the list's handles: a words line naming one is passed.
Handles map[string]bool
}
ReadInput is one closing text and what judges it.
type Reading ¶
Reading is what one closing text gave.
func ReadClosingText ¶
ReadClosingText reads one closing text: the block where one ends it, then, unless the text is read for the block alone, the words of every line outside fences, quotes and code spans.
type Records ¶
type Records struct {
// contains filtered or unexported fields
}
Records answers a captured or settled claim on a record (criterion 12): the default branch decides, read with one `git ls-tree` of the family's directory the first time an id of that family is asked; a record it lacks is looked for with recordid.LookupOne in the checkout and then the session's start copy, and nowhere else. With no default branch the checkouts answer alone; a git that cannot read the checkout, or does not answer in time, is an error. Every git question is bounded by the context it was made with, and no question is answered once it has ended. Each checkout's store of a family is read once, the first time it is asked.
func NewRecords ¶
NewRecords is the resolver for a payload's checkout and, after it, the session's start copy (either may be ""). git is asked in the first.
type SettleRequest ¶
type SettleRequest struct {
Handles []string
Act Act
// Record is the record a captured or settled act names, judged by Records.
Record string
Records Answerer
// Reason is the reason, test or run a not-a-finding, refuted or own act
// gives, redacted against each entry's own checkout.
Reason string
// Checkout is the checkout the caller stands in. A reason is kept only
// for an entry put from it: one put from another checkout keeps the act
// and withholds the reason, so a settle reads no checkout's scanner
// configuration but the caller's own.
Checkout string
// Person is true where the caller is a person at a terminal, the one
// caller that may settle a private entry.
Person bool
At time.Time
}
SettleRequest settles entries by handle with one act.
type Settlement ¶
type Settlement struct {
Act Act `json:"act"`
Record string `json:"record,omitempty"`
Reason string `json:"reason,omitempty"`
// ReasonWithheld is true where no full scan could clear the reason, the
// settle was typed in a checkout other than the entry's, or the reason
// would take the file past its bound.
ReasonWithheld bool `json:"reason_withheld,omitempty"`
At time.Time `json:"at"`
}
Settlement is what settled an entry: the act, the record it names, or the reason, test or run given.
type Standing ¶
type Standing interface {
Answer(act Act, id string) (Answer, error)
Passes(id string) (bool, error)
}
Standing answers what a reading asks of the records: a block's captured or settled claim (Answer), and whether a words line naming id is passed by it, an open issue, an open spec, or a draft or planned intent (Passes). *Records is the one production uses.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is one root's list under one home.
func NewStore ¶
NewStore is the list of the repository whose root commit is rootSHA, under home (abcdhome.MachineHome in production).
func (Store) Held ¶
Held is session's mark; an absent one is the zero mark, and nothing is made. A file refused (a link, a loose mode, another owner, past its bound) or one that does not parse is an error.
func (Store) MarkHeld ¶
MarkHeld writes session's mark whole, by rename, making held/ where it is absent. A mark past its bound is refused, and nothing is written.
func (Store) PrivateText ¶
PrivateText is the text of the private entry handle names, and whether it was withheld: the one place this package hands a private text back, and to the person alone.
func (Store) Put ¶
Put puts every entry on the list or none, and returns them as stored, building one redactor for each checkout the call meets. Every entry is made and encoded before the lock is taken, and the bounds are judged and the files written under it. An entry already settled stays settled and is returned so, unless a receipt settled it; one the private list holds is returned from there; one already listed is written again whole, unless it is withheld now and its file holds a cleared text, which it keeps. A cleared reading supersedes the entry its position was withheld under. An entry whose name a settled file this build cannot read holds is not put, and is named in the Unreadable returned, and the rest go on.
func (Store) ReadWithin ¶
ReadWithin is the open and private entries, reading at most files directory entries across the two, strays included (past it, ErrTooManyFiles). An absent store is an empty view, and nothing is made. A directory refused is the error; a file refused is named in Unreadable.
func (Store) Settle ¶
Settle settles every handle or none. The handles, the act, its record and its reason are judged first with no lock, then the handles again under the root's lock, whose verdict stands; every file is encoded before any is written, and a refusal writes nothing. A handle given twice is one entry. Each settled entry is written to settled/ and then removed from where it was. ActReceipt is refused here: SettleByReceipt is its one entry point.
func (Store) SettleByReceipt ¶
func (s Store) SettleByReceipt(ctx context.Context, checkout string, handles []string, receipt string, at time.Time) ([]Entry, error)
SettleByReceipt settles check entries by a preflight receipt naming the offered head: the landing's act, never a command's. checkout is the checkout the receipt was minted in, as SettleRequest's.
func (Store) SettledOf ¶
SettledOf is which of handles name an entry settled/ holds for session, a set by handle. Only the first maxSettledAsked distinct handles are looked for, and only the files whose names begin with one are read; a file that cannot be read names nothing. An absent folder is none.
func (Store) SettledView ¶
func (s Store) SettledView(n int) ([]Entry, []Unreadable, error)
SettledView is the last n settled entries, newest first by the time each file was written, and every file read on the way that could not be.
type Unreadable ¶
Unreadable is a file a read refused, by handle and why.
type View ¶
type View struct {
Open []Entry `json:"open"`
Private []Entry `json:"private"`
Newer []string `json:"newer"`
Unreadable []Unreadable `json:"unreadable"`
// Full is true once the open entries reach their bound.
Full bool `json:"full"`
}
View is the list as one read found it. Private entries carry no text.
func (View) SessionOwed ¶
SessionOwed is session's open entries that count toward its hold, oldest first: every one where all is true (the person away, or an implementer's stage), and otherwise all but those the words alone made. A private entry is never on the open list, and holds nothing.
type Withholding ¶
type Withholding string
Withholding is why an entry's text was not kept, or "".
const ( // WithheldScan is a text no full scan could clear. WithheldScan Withholding = "scan" // WithheldSize is a cleared text that would take its file past the bound. WithheldSize Withholding = "size" // WithheldDeadline is a text the caller's deadline passed before. WithheldDeadline Withholding = "deadline" )
The reasons a text is withheld.