The append-only quality branch and its notes, with real git (commons 0001-quality-evidenceFR-021 to FR-023, FR-026): keepRun makes a run's record canonical (chained to the file before it), writes it as one new file quality/evidence/YYYY/MM/DD/<trace id>.otlp.json in a commit on the orphan branch quality (signed through the host's own Git signing where asked) and puts a note under refs/notes/quality on the tested commit; verifyBranch walks the branch and its chain and names the first thing that does not match; gradeOfCommit says what a commit's evidence is worth (a commit with no note is E0).
The branch is written with Git's plumbing (hash-object, a temporary index, write-tree, commit-tree, update-ref with the old tip as its guard), so the working tree and the index of the repository are never touched, and a branch that moved while a run was kept is refused rather than overwritten. A file already on the branch is never replaced (exists). Git signs: gpg.format, user.signingkey and commit.gpgsign are the host's, and no key is read here. A force-push cannot be refused by a client; refuseRewrite configures a repository that receives pushes to refuse non-fast-forward updates and deletions, and verifyBranch finds a branch that was rewritten (a commit that changes or removes a file, or a chain that no longer matches).
type KeepOptions = {
readonly repo: string;
/** The run's document as 0008-test-evidence assembles it, or its text. …(732 characters)
typeKeepOptions= {
readonlyrepo:string;
/** The run's document as 0008-test-evidence assembles it, or its text. */readonlyrecord:unknown;
/** What was planned and did not run (FR-013). */readonlynotRun?:readonlyNotRun[];
/** The tested commit; the record's own revision, else `HEAD`, where it is not given. */readonlycommit?:string;
/** Whether to sign the commit that keeps it: true, false, or (not given) as the host's `commit.gpgsign` says. */readonlysign?:boolean;
/** Facts every resource of the record carries besides the installation: the SHA-256 of the plan that governs the run (`ifc.quality.plan.sha256`, 0001-quality-evidence FR-042). */readonlyresourceAttributes?:Attributes;
};
typeKept= {
readonlypath:EvidencePath;
readonlysha256:Sha256;
readonlygrade:Grade;
/** The commit of the `quality` branch that holds the file. */readonlybranchCommit:string;
/** The commit that was tested, and so carries the note; none where the repository has no commit to name. */readonlytested?:string;
readonlysigned:boolean;
readonlyrecord:QualityRecord;
};
Keeps a run (FR-021 to FR-023): the record is made canonical with the digest of the last file of the branch as its predecessor, written as a new file in a commit on the orphan quality branch (created by this commit where there is none), and noted on the tested commit with the file's path, its SHA-256 and its grade. A path already kept is refused, and so is a trace already kept; a branch that moved is refused and nothing is changed. The grade is E4 where the commit is signed and E3 where it is not.
typeVerified= {
readonlycount:number;
readonlyhead:Sha256;
readonlyfiles:readonlyVerifiedFile[];
readonlygrades:readonlyCommitGrade[];
/** The files of the ledger of nonconformances and CAPA (FR-046), which verify as a chain of their own. */readonlyrecords:number;
};
typeVerifyOptions= {
/** An SSH allowed-signers file the harness trusts; where given, a commit is signed only when Git verifies it against it. */readonlyallowedSigners?:string;
/** Fail on a commit that is not signed (and trusted, where `allowedSigners` is given). */readonlyrequireSigned?:boolean;
};
Walks the quality branch (FR-021 to FR-023): every commit only appends one evidence file, the chain of ifc.quality.previous.sha256 holds from the first file to the last, and, where asked, every commit is signed. Then each note under refs/notes/quality is read and must name a file on the branch with the SHA-256 it says. The first thing that does not match is returned, naming the file or the commit.
What the evidence of a commit is worth (FR-023, FR-026): E0 where the commit has no note, where its note does not match its file or the branch does not verify; else the grade of its newest run, E4 where that run is signed and chained and E3 where it is not.
Whether the branch is still an extension of an earlier tip (FR-021): a rewrite of the branch is not. A CI job that remembers the tip it saw last (or a hook on the repository that receives pushes) refuses the update where this is false.
Configures a repository that receives pushes (a bare one) to refuse a force-push and the deletion of any branch (FR-021): receive.denyNonFastForwards and receive.denyDeletes. A host that is not Git itself (a forge) has its own protected-branch setting.