addDaysfunctionfunction addDays(day: string, days: number): string | undefinedThe day days after day (YYYY-MM-DD), or none where day is not a day.
Retention of the evidence on the quality branch (commons 0001-quality-evidence FR-050): the harness's record states a retention period in days (retentionDays of the declaration), and evidence is kept on the branch for it and is archived by a Git tag, never deleted. This file judges whether the retention period of the oldest evidence has passed and names the tag that may then be made; it deletes nothing and has no way to.
Pure: the period, the day of the oldest evidence and the day today are arguments (no clock). The period is the harness's to state and never shorter than the longest retention that applies to its evidence; the harness chooses it, and the check here only refuses what is not a whole number of days of at least one.
import { judgeRetention } from "./retention.ts";
judgeRetention({ oldestDay: "2026-01-01", retentionDays: 365, today: "2027-01-01" }); // { kind: "due", dueOn: "2027-01-01" }addDaysfunctionfunction addDays(day: string, days: number): string | undefinedThe day days after day (YYYY-MM-DD), or none where day is not a day.
RetentionJudgementtypeno test imports ittype RetentionJudgement =
/** The branch holds no evidence file: nothing to archive. */
| { readonly kind: "no-evide… (606 characters)type RetentionJudgement =
/** The branch holds no evidence file: nothing to archive. */
| { readonly kind: "no-evidence" }
/** The harness states no retention period: evidence is kept and nothing is archived until it does. */
| { readonly kind: "no-period" }
/** The oldest evidence is still inside its period. */
| { readonly kind: "kept"; readonly oldestDay: string; readonly dueOn: string; readonly daysLeft: number }
/** The period of the oldest evidence has passed: the branch may be archived by a tag. */
| { readonly kind: "due"; readonly oldestDay: string; readonly dueOn: string };What the retention period of the oldest evidence comes to on a day.
RetentionInputtypeno test imports ittype RetentionInput = {
/** The UTC day of the oldest evidence file of the branch, `YYYY-MM-DD`; none where there is none. */
readonly oldestDay: string | undefined;
/** The period the harness states, in days; none where it states none. */
readonly retentionDays: number | undefined;
/** The day today, an argument. */
readonly today: string;
};The inputs of judgeRetention.
judgeRetentionfunctionfunction judgeRetention(input: RetentionInput): Result<RetentionJudgement, string>Whether the period of the oldest evidence has passed on today (FR-050): it has on the day the period ends and after it.
showRetentionfunctionfunction showRetention(j: RetentionJudgement): stringA judgement as a sentence.
tagNameProblemfunctionfunction tagNameProblem(name: string): string | undefinedWhether a text may name an archive tag: Git's own rules for a reference name that matter here (no space, control character, ~ ^ : ? * [ \, no .., @{, leading or trailing slash or dot, .lock ending).