pendingref

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 14 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 pendingref answers one question for record-lint's prose citations (iss-2611031731385043): which of the record ids a tree does not resolve name a record on an open pull request's branch on origin, a record minted and in review that has not reached the default branch yet.

The ruling it serves: a record is cited by id, never in words, even when the record it cites is still in review. A decision written in one change often rests on a ruling recorded in another change not yet merged, and refusing the id pushed authors to name the ruling in a sentence instead, which drops the trace. So record-lint accepts such an id as a PENDING reference, reported and never refused, and the release cut is the gate: it refuses while any reference names a record the tree being cut does not hold.

HOW IT READS. One forge listing of the open pull requests (the REST pulls endpoint through `gh api`, which every forge token reads), and for each one whose head is a branch of this repository (a fork's is not on origin), git's listing of the record stores in that head's tree, read from the objects this clone already holds. It never fetches: a lint that rewrote the clone's refs would be a gate with a side effect. A head the clone does not hold is named in Unread, and a clone that has fetched origin (CI's full-history checkout does) holds them all.

HOW IT FAILS. Every way the question cannot be answered — no forge client, a forge that refuses or does not answer, a head not fetched, a listing at its limit — is said in Unread, and nothing is found that was not read. The caller's citation then stands refused, as it was before this package existed, and its message says why the pending check could not help. Failing toward the refusal is the safe direction: an unread forge never turns a citation of nothing into an accepted one.

Index

Constants

View Source
const Deadline = 60 * time.Second

Deadline bounds the whole lookup, the forge listing and every tree read. It is far below a preflight's budget and well above a forge's ordinary answer.

Variables

This section is empty.

Functions

func ForLint

func ForLint(repoRoot string, ids []string) (map[string]lint.PendingRecord, string)

ForLint is lookup in the lint package's vocabulary, the one adapter every front door registers (lint.SetPendingLookup): cmd/record-lint for the gate, and the CLI for `abcd lint` and every host-prose ingest that asks the gate before it writes, so the two can never answer the question differently.

Types

type Answer

type Answer struct {
	// Found maps each asked id an open pull request's branch carries to that
	// record, the lowest-numbered pull request's when more than one does.
	Found map[string]Record
	// Unread says why some open pull requests' branches were not read, empty
	// when every listed one was. An id not in Found may be on one of them.
	Unread string
}

Answer is the lookup's result.

type Forge

type Forge func(ctx context.Context, dir string, args ...string) (string, error)

Forge runs the forge client with args from dir, bound to ctx, and returns its stdout: landing.GHContext, or a test's fake.

type Git

type Git func(root string, maxBytes int, args ...string) (string, error)

Git runs one read-only git command under root and returns its stdout, failing past maxBytes rather than truncating: gitutil.RunCapped, or a test's seam.

type Record

type Record struct {
	// ID is the canonical record id.
	ID string
	// Path is the record's repo-relative path on that branch.
	Path string
	// PR is the pull request's number.
	PR int
	// Branch is the pull request's head branch on origin.
	Branch string
}

Record is one record an open pull request's branch carries.

Jump to

Keyboard shortcuts

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