web: show per-visit changes and last-visit summary
Each visit's This run pane reports its own recorded capture: the File changes status line (with skipped/omitted counts and diagnostic) and its Changed files list with parseable stats. The Summary aggregate now keeps each path's last recorded step rather than summing visits, and is only rendered for a succeeded run; a failed run keeps its evidence in the visit panes. This is a deliberate divergence from Android, noted in R4.
This commit is contained in:
+31
-6
@@ -28,6 +28,7 @@ import {
|
||||
runStateOf,
|
||||
} from "./runs.js";
|
||||
import { presentedArtifacts, sessionExportArtifact, displayVisit } from "./artifacts.js";
|
||||
import { changeStat, parseUnifiedPatch } from "./changes.js";
|
||||
import { effectiveStageType } from "./templates.js";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -696,14 +697,25 @@ export function artifactBaseName(name) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* One changed-file line, e.g. `modified src/a.kt (binary) (truncated)`. Mirrors
|
||||
* Format.kt fileChangeLine.
|
||||
* One changed-file line, e.g. `modified src/a.kt +3 -2 (truncated)`. The kind,
|
||||
* path and binary/truncated markers are Format.kt's exact spelling; the `+N -M`
|
||||
* stat is added when the recorded patch is readable (not binary) and parses to
|
||||
* at least one hunk, so a line never claims a line count it could not read. A
|
||||
* binary file keeps its marker and never gets a text stat.
|
||||
*/
|
||||
export function fileChangeLine(file) {
|
||||
const base = `${str(file?.kind)} ${str(file?.path)}`;
|
||||
const binary = file?.binary ? " (binary)" : "";
|
||||
const truncated = file?.truncated ? " (truncated)" : "";
|
||||
return base + binary + truncated;
|
||||
let stat = "";
|
||||
if (!file?.binary) {
|
||||
const patch = str(file?.patch);
|
||||
if (patch.trim() !== "") {
|
||||
const parsed = parseUnifiedPatch(patch);
|
||||
if (parsed.hunks.length > 0) stat = changeStat(parsed.added, parsed.removed);
|
||||
}
|
||||
}
|
||||
return base + (stat !== "" ? ` ${stat}` : "") + binary + truncated;
|
||||
}
|
||||
|
||||
/** One notification receipt, e.g. `delivered → ntfy · ok`, skipping a blank diagnostic. */
|
||||
@@ -714,12 +726,16 @@ export function notificationLine(receipt) {
|
||||
}
|
||||
|
||||
/**
|
||||
* A compact file-change summary, e.g. `partial (2 files), 1 skipped`. Blank
|
||||
* parts are omitted; an entirely blank change set renders as "".
|
||||
* A compact file-change summary, e.g.
|
||||
* `partial (2 files), 1 skipped, 3 omitted · Excluded protected files.`.
|
||||
* The status word, file count, skipped and omitted counts are the capture's own
|
||||
* honest facts; the trimmed diagnostic follows after ` · ` when present. Blank
|
||||
* parts are omitted, and an entirely blank change set renders as "".
|
||||
*/
|
||||
export function fileChangesSummary(changes) {
|
||||
let text = "";
|
||||
if (str(changes?.status).trim() !== "") text += str(changes.status);
|
||||
const status = str(changes?.status).trim();
|
||||
if (status !== "") text += status;
|
||||
const files = changes?.files ?? [];
|
||||
if (files.length > 0) {
|
||||
if (text !== "") text += " ";
|
||||
@@ -729,6 +745,15 @@ export function fileChangesSummary(changes) {
|
||||
if (text !== "") text += ", ";
|
||||
text += `${changes.skipped} skipped`;
|
||||
}
|
||||
if (Number(changes?.omitted) > 0) {
|
||||
if (text !== "") text += ", ";
|
||||
text += `${changes.omitted} omitted`;
|
||||
}
|
||||
const diagnostic = str(changes?.diagnostic).trim();
|
||||
if (diagnostic !== "") {
|
||||
if (text !== "") text += " · ";
|
||||
text += diagnostic;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user