Files
loki/scripts/test/repo-progress.ts
CatoandClaude Fable 5.1 bbcf43fed3 feat(runs): one delivery track everywhere — the chat card draws the same track as Watch (#1240)
* feat(runs): one delivery track everywhere — the chat card draws the same track as Watch

The chat card under a dispatch had its own list (run-milestones: picked up →
pushed → PR → checks) and Watch had the delivery track, built from
different facts, so moving between the two screens meant reading two
stories about one change.

- lib/run-track-load: the one loader every run surface calls — events,
  the runner's snapshot, what was asked, the branch or pull request on
  GitHub while the run lives, the commits and checks behind it
  (lib/repo-progress, was run-milestones-fetch), and after the run the
  fix ledger through merge, deploy and Loki's look. Owner-only for anything
  that reaches GitHub or the budget; never from a timer.
- The Watch route and both live-status routes the chat card polls carry
  `track`; RunMilestones and the follow line are gone.
- lib/run-track: commits ride the working stage as facts ("Pushed: …", in
  the builder's words); a red check is the merged stage in the needs-you
  state, a green one "Checks passed — merging", before the ledger catches
  up; the pull request's number and title come from the repository too.
- components/projects/RunTrack: `collapsible` — a settled track in a chat
  thread folds to its one sentence and opens on a tap.
- components/projects/RunLook: the page before and after, side by side,
  under the track in chat and on Watch (the before picture #1238 keeps).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNLstupcdvsPfTjy8yjR67

* refactor(run-follow): drop followRun — every surface reads the ledger through loadRunTrack now

The dead-exports ratchet caught it: nothing referenced the follow-only
wrapper once the live-status routes moved to lib/run-track-load.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNLstupcdvsPfTjy8yjR67

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-17 14:57:11 +02:00

42 lines
1.3 KiB
TypeScript

// What the repository says a build has pushed (src/lib/repo-progress.ts):
// commit messages read as sentences, check runs read as one verdict.
import assert from "node:assert/strict";
import { commitHeadline, summarizeChecks } from "../../src/lib/repo-progress";
assert.equal(
commitHeadline("fix(header): keep the menu above the tour\n\nbody"),
"Keep the menu above the tour",
);
assert.equal(commitHeadline("feat!: drop the old card"), "Drop the old card");
assert.equal(commitHeadline("Plain message"), "Plain message");
assert.ok(commitHeadline("x".repeat(300)).length <= 140);
assert.equal(summarizeChecks([]), null, "nothing reported is not a verdict");
assert.equal(summarizeChecks([{ status: "in_progress", conclusion: null }]), "running");
assert.equal(
summarizeChecks([
{ status: "completed", conclusion: "success" },
{ status: "completed", conclusion: "failure" },
]),
"failed",
"one red check is a failed verdict",
);
assert.equal(
summarizeChecks([
{ status: "completed", conclusion: "success" },
{ status: "completed", conclusion: "skipped" },
]),
"passed",
);
assert.equal(
summarizeChecks([
{ status: "completed", conclusion: "success" },
{ status: "queued", conclusion: null },
]),
"running",
"a queued check keeps the verdict open",
);
console.log("✓ repo-progress: headlines and check verdicts");