@taprootio/site-authoring 0.56.0 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +13 -11
  2. package/package.json +2 -2
  3. package/src/api.js +7 -0
  4. package/src/block-flow.js +4 -2
  5. package/src/changelog.json +87 -0
  6. package/src/chrome-additions.js +106 -0
  7. package/src/chrome-features.js +43 -10
  8. package/src/chrome-input.js +137 -30
  9. package/src/chrome-report.js +4 -2
  10. package/src/cli.js +54 -17
  11. package/src/content/button-styles.js +27 -0
  12. package/src/content/components.js +76 -10
  13. package/src/content/free-form-section-registry.json +9 -0
  14. package/src/content/free-form-sections.js +55 -16
  15. package/src/content/markdown.js +133 -56
  16. package/src/content/media-presentation.js +37 -0
  17. package/src/content/tiptap-prosemirror.ts +26 -10
  18. package/src/credentials.js +2 -1
  19. package/src/delivery-check.js +10 -2
  20. package/src/font-catalog.js +9 -6
  21. package/src/footer-content.js +1 -1
  22. package/src/footer-contract.js +3 -0
  23. package/src/footer-draft-hash.js +1 -0
  24. package/src/heading-outline.js +94 -6
  25. package/src/image-description-contract.js +5 -3
  26. package/src/image-description-write.js +26 -0
  27. package/src/index.js +1 -0
  28. package/src/output.js +2 -1
  29. package/src/page-structure-checks.js +14 -25
  30. package/src/placed-image-ids.js +42 -17
  31. package/src/presentation-reference.js +63 -18
  32. package/src/problems.js +147 -4
  33. package/src/reference-help.js +102 -57
  34. package/src/site-check-findings.js +2 -3
  35. package/src/site-check-rules.json +0 -1
  36. package/src/site-health-findings.js +7 -9
  37. package/src/site-health-image-checks.js +4 -1
  38. package/src/site-health-precheck.js +23 -6
  39. package/src/site-navigation-groups.js +16 -0
  40. package/src/status-warning-paints.js +175 -0
  41. package/src/template-token-reach.json +13 -18
  42. package/src/theme-proposals.js +143 -55
  43. package/src/theme-resolve.js +14 -1
  44. package/src/theme-validation.js +70 -38
  45. package/src/token-reach.js +20 -0
  46. package/src/typed-page-reference.js +3 -2
  47. package/src/typed-pages.js +7 -7
  48. package/src/verbs/changelog.js +23 -2
  49. package/src/verbs/delivery-check.js +43 -9
  50. package/src/verbs/media-images.js +4 -4
  51. package/src/verbs/pages-push.js +38 -32
  52. package/src/verbs/plan.js +28 -20
  53. package/src/verbs/pull.js +179 -24
  54. package/src/verbs/theme-push.js +59 -15
  55. package/src/verbs/theme-resolve.js +109 -11
  56. package/src/verbs/validate.js +97 -16
  57. package/src/workspace-check.js +4 -4
  58. package/src/workspace-context-usage.js +180 -0
  59. package/src/workspace.js +12 -0
  60. package/test/fixtures/default-site-theme.json +1 -1
@@ -534,7 +534,8 @@ export function abbreviateThemeContext(context, maximumLength, position) {
534
534
  }
535
535
 
536
536
  function componentPropertyReflowWarnings(lightTheme, darkTheme) {
537
- const properties = getSettableComponentProperties().filter(({ syntax }) => syntax !== "color");
537
+ // Espalier marks a property paintOnly when its value cannot move layout, so a scheme difference there is harmless.
538
+ const properties = getSettableComponentProperties().filter(({ syntax, paintOnly }) => syntax !== "color" && paintOnly !== true);
538
539
  const contexts = sharedDeclaredThemeContextNames(lightTheme, darkTheme);
539
540
  const prefix = "theme.component_property_scheme_differs: ";
540
541
  const warnings = [];
@@ -547,7 +548,7 @@ function componentPropertyReflowWarnings(lightTheme, darkTheme) {
547
548
  if (lightComparable === darkComparable) continue;
548
549
  const lightValue = displayComponentProperty(light, lightComparable, property.unit);
549
550
  const darkValue = displayComponentProperty(dark, darkComparable, property.unit);
550
- const details = ` ${property.name} is ${lightValue} in light and ${darkValue} in dark.`;
551
+ const details = ` ${property.name} can move layout and is ${lightValue} in light and ${darkValue} in dark.`;
551
552
  const nameBudget = Math.min(LIMITS.diagnosticScalars, MAXIMUM_THEME_WARNING_SCALARS)
552
553
  - prefix.length - "contexts.".length - details.length;
553
554
  const surface = context === null ? "root" : `contexts.${abbreviateThemeContext(context, nameBudget, position)}`;
@@ -575,7 +576,9 @@ function boundedThemeWarnings(allWarnings) {
575
576
 
576
577
  export function validateAndEncodeThemePair(lightTheme, darkTheme) {
577
578
  const { light, dark, warnings, inert } = checkThemePair(lightTheme, darkTheme);
578
- return { light, dark, ...boundedThemeWarnings([...warnings, ...inert]) };
579
+ const all = [...warnings, ...inert];
580
+ // The complete list, for callers that must select before the publication cap.
581
+ return Object.defineProperty({ light, dark, ...boundedThemeWarnings(all) }, "completeWarnings", { value: all });
579
582
  }
580
583
 
581
584
  /**
@@ -611,6 +614,61 @@ export function withChromeWarnings(themes, chromeWarnings) {
611
614
  return Object.defineProperty({ ...themes, ...bounded }, "warningGroups", { value: themes.warningGroups });
612
615
  }
613
616
 
617
+ const THEME_REFUSED = "theme.validation_failed";
618
+
619
+ function ordinaryRefusalField(message) {
620
+ return /^\s*(?:light|dark):\s*Every entry in ([A-Za-z0-9_.-]+)/u.exec(message)?.[1]
621
+ ?? /^\s*(?:light|dark):\s*([A-Za-z0-9_.-]+)/u.exec(message)?.[1]
622
+ ?? (/^\s*contexts\b/u.test(message) ? "contexts" : undefined);
623
+ }
624
+
625
+ function componentRefusal(finding, espalierMessage) {
626
+ const { scheme, context, property, code } = finding;
627
+ const field = [`${scheme}Theme`];
628
+ if (context !== null) field.push("contexts", context);
629
+ field.push("componentProperties");
630
+ if (property !== null) field.push(property);
631
+ // Espalier suggests the nearest settable name even for unrelated inputs.
632
+ const unknownProperty = code === "unknown" && property !== null;
633
+ const nearest = unknownProperty
634
+ ? closeFieldMatch(property.slice("--esp-".length), getSettableComponentProperties().map(({ name }) =>
635
+ name.slice("--esp-".length)))
636
+ : undefined;
637
+ const fullName = nearest === undefined ? undefined : "--esp-" + nearest;
638
+ const message = unknownProperty
639
+ ? `Unknown component property '${property}'.${unknownFieldHint(fullName)}`
640
+ : `Espalier rejected the theme: ${espalierMessage}`;
641
+ return { field: field.join("."), message, alternatives: fullName === undefined ? undefined : [fullName] };
642
+ }
643
+
644
+ /**
645
+ * One refusal naming every problem, ordinary errors first. The top-level field and message are the first
646
+ * problem's; the rest ride in `error.problems` (TR01419).
647
+ */
648
+ function refuseTheme(errors, findings) {
649
+ const ordinaryCount = Math.max(0, errors.length - findings.length);
650
+ const problems = [
651
+ ...errors.slice(0, ordinaryCount).map((message) => ({
652
+ code: THEME_REFUSED,
653
+ field: ordinaryRefusalField(message),
654
+ message: `Espalier rejected the theme: ${message}`,
655
+ })),
656
+ ...findings.map((finding, index) => ({
657
+ code: THEME_REFUSED,
658
+ ...componentRefusal(finding, errors[ordinaryCount + index] ?? "The theme pair is invalid."),
659
+ })),
660
+ ];
661
+ if (problems.length === 0) {
662
+ problems.push({ code: THEME_REFUSED, message: "Espalier rejected the theme: The theme pair is invalid." });
663
+ }
664
+ const [first] = problems;
665
+ const error = new SiteAuthoringError(THEME_REFUSED, first.message, {
666
+ field: first.field,
667
+ alternatives: first.alternatives,
668
+ });
669
+ throw error.withProblems(problems);
670
+ }
671
+
614
672
  function checkThemePair(lightTheme, darkTheme) {
615
673
  requireCompleteTheme(lightTheme, "light");
616
674
  requireCompleteTheme(darkTheme, "dark");
@@ -631,44 +689,18 @@ function checkThemePair(lightTheme, darkTheme) {
631
689
  }
632
690
 
633
691
  const result = validateThemePair(light, dark);
634
- // Espalier appends one error per component finding after its ordinary errors.
635
- const findings = result.valid ? [] : validateComponentProperties(light, dark);
636
- const componentFinding = findings.length === result.errors.length ? findings[0] : undefined;
637
- const first = result.errors[0] ?? "The theme pair is invalid.";
638
- if (!result.valid && componentFinding === undefined) {
639
- const field = /^\s*(?:light|dark):\s*Every entry in ([A-Za-z0-9_.-]+)/u.exec(first)?.[1]
640
- ?? /^\s*(?:light|dark):\s*([A-Za-z0-9_.-]+)/u.exec(first)?.[1]
641
- ?? (/^\s*contexts\b/u.test(first) ? "contexts" : undefined);
642
- throw new SiteAuthoringError(
643
- "theme.validation_failed",
644
- `Espalier rejected the theme: ${first}`,
645
- { field },
646
- );
692
+ if (!result.valid) {
693
+ // Espalier appends one error per component finding after its ordinary errors (TR01419).
694
+ const findings = validateComponentProperties(light, dark);
695
+ // An external stylesheet is refused before a theme whose only errors are component findings.
696
+ if (findings.length >= result.errors.length) {
697
+ refuseAgentStylesheets(lightTheme, "light");
698
+ refuseAgentStylesheets(darkTheme, "dark");
699
+ }
700
+ refuseTheme(result.errors, findings);
647
701
  }
648
702
  refuseAgentStylesheets(lightTheme, "light");
649
703
  refuseAgentStylesheets(darkTheme, "dark");
650
- if (componentFinding !== undefined) {
651
- const { scheme, context, property, code } = componentFinding;
652
- const field = [`${scheme}Theme`];
653
- if (context !== null) field.push("contexts", context);
654
- field.push("componentProperties");
655
- if (property !== null) field.push(property);
656
- // Espalier suggests the nearest settable name even for unrelated inputs.
657
- const unknownProperty = code === "unknown" && property !== null;
658
- const nearest = unknownProperty
659
- ? closeFieldMatch(property.slice("--esp-".length), getSettableComponentProperties().map(({ name }) =>
660
- name.slice("--esp-".length)))
661
- : undefined;
662
- const fullName = nearest === undefined ? undefined : "--esp-" + nearest;
663
- const message = unknownProperty
664
- ? `Unknown component property '${property}'.${unknownFieldHint(fullName)}`
665
- : `Espalier rejected the theme: ${first}`;
666
- throw new SiteAuthoringError(
667
- "theme.validation_failed",
668
- message,
669
- { field: field.join("."), alternatives: fullName === undefined ? undefined : [fullName] },
670
- );
671
- }
672
704
  return {
673
705
  light,
674
706
  dark,
@@ -59,7 +59,22 @@ const BORDER_PAINT_NOTES = [
59
59
  text: "--esp-blockquote-glyph-color overrides the quote glyph. When unset, the glyph follows the bar.",
60
60
  },
61
61
  ];
62
+ // A form field's row repeats on layer2 to layer4: the layer is chosen by the surface the field sits on.
63
+ const FORM_FIELD_LAYER_NOTE = {
64
+ token: "--esp-color-layer-N",
65
+ component: "esp-input",
66
+ part: "dynamic",
67
+ state: "ordinary",
68
+ label: "field surface layer fill",
69
+ folder: "input",
70
+ text: "A form field paints one layer above the surface it sits on: a field on a layer1 surface paints layer2, "
71
+ + "on layer2 paints layer3, and on layer3 paints layer4.",
72
+ };
73
+ const formFieldLayerNote = (level) => ({ ...FORM_FIELD_LAYER_NOTE, token: `--esp-color-layer-${level}` });
62
74
  const COMPONENT_PAINT_NOTES = {
75
+ layer2: [formFieldLayerNote(2)],
76
+ layer3: [formFieldLayerNote(3)],
77
+ layer4: [formFieldLayerNote(4)],
63
78
  border: BORDER_PAINT_NOTES,
64
79
  headings: [1, 2, 3, 4].map((level) => ({
65
80
  token: "--esp-color-headings",
@@ -88,6 +103,11 @@ function getComponentPaints(name) {
88
103
  return manifestPaintsByCssName.get(semanticToCSS(name));
89
104
  }
90
105
 
106
+ /** The components whose paint rows name this semantic token, in manifest order. */
107
+ export function getPaintingComponents(name) {
108
+ return [...new Set((getComponentPaints(name) ?? []).map(({ component }) => component).filter(Boolean))];
109
+ }
110
+
91
111
  export function getTokenDerivation(name) {
92
112
  return DERIVATIONS.get(name) ?? null;
93
113
  }
@@ -109,7 +109,8 @@ const FIELD_HELP = Object.freeze({
109
109
  "The Taproot place being reviewed. The site fills in its name, address and coordinates from this record. Find "
110
110
  + "it with 'places search <name and city>' and 'places select <googlePlaceId> <sessionToken>'. The site publishes the "
111
111
  + "place's category in the byline; change it for this site with "
112
- + "'places category set <placeId> <category>'.",
112
+ + "'places category set <placeId> <category>'. A category override affects the release alone, never the "
113
+ + "page's stored revision.",
113
114
  },
114
115
  place: {
115
116
  type: "UUID",
@@ -418,7 +419,7 @@ function legalReference() {
418
419
  templateType: "TEMPLATE_TYPE_LEGAL",
419
420
  sourceRule:
420
421
  "Pull writes a .pm.json source containing template legal and data with documentKey, documentRole, summaryOfChanges, material and body. "
421
- + "Edit that source to change the draft; Markdown is not supported. To create one, add a .pm.json source and a manifest pages entry with file, title and path, without a pageId. Version, effectiveDate and supersedesVersion are assigned by Taproot and must not be authored.",
422
+ + "Edit that source to change the draft; Markdown is not supported. To create one, add a .pm.json source and a manifest pages entry with file, title and path, without a pageId. A pull keeps that never-saved entry and its file (keptPendingPages in the result) unless a page on the site already holds its path, then it refuses; save it with 'login --legal-drafts' and '--legal-drafts pages push'. Version, effectiveDate and supersedesVersion are assigned by Taproot and must not be authored.",
422
423
  }),
423
424
  fields: Object.freeze([
424
425
  Object.freeze({ name: "title", description: "The page title. It prints as the page's h1, so the body should not open with its own title." }),
@@ -1230,14 +1230,14 @@ async function parseRecipeBody(markdown, { file, convert, convertStep, firstLine
1230
1230
  }
1231
1231
  refuseRecipeStepProblems(problems);
1232
1232
  return {
1233
- introductionBody: lead.trim() === "" ? undefined : await convert(lead),
1233
+ introductionBody: lead.trim() === "" ? undefined : await convert(lead, firstLine),
1234
1234
  ingredientGroups,
1235
1235
  instructionSections,
1236
1236
  };
1237
1237
  }
1238
1238
 
1239
- async function parseAlbumBody(markdown, { file, convert, resolveImage }) {
1240
- const { lead, sections } = splitSections(markdown);
1239
+ async function parseAlbumBody(markdown, { file, convert, resolveImage, firstLine }) {
1240
+ const { lead, sections } = splitSections(markdown, firstLine);
1241
1241
  requireSectionTitles(sections, [ALBUM_IMAGES_HEADING], file, TEMPLATE_ALBUM);
1242
1242
  const images = [];
1243
1243
  for (const line of sections[0].lines) {
@@ -1257,7 +1257,7 @@ async function parseAlbumBody(markdown, { file, convert, resolveImage }) {
1257
1257
  if (images.length === 0) {
1258
1258
  throw fail("pages.album_images_missing", `'${file}' is an album whose Images section lists no images.`, file);
1259
1259
  }
1260
- return { introductionBody: lead.trim() === "" ? undefined : await convert(lead), images };
1260
+ return { introductionBody: lead.trim() === "" ? undefined : await convert(lead, firstLine), images };
1261
1261
  }
1262
1262
 
1263
1263
  function parseCount(fields, key, file, maximum) {
@@ -1347,7 +1347,7 @@ export async function typedDocumentFromMarkdown({
1347
1347
  }
1348
1348
  let data;
1349
1349
  if (template === TEMPLATE_ARTICLE) {
1350
- data = { body: await convert(markdown), place: fields.get("place") };
1350
+ data = { body: await convert(markdown, firstLine), place: fields.get("place") };
1351
1351
  } else if (template === TEMPLATE_PLACE_REVIEW) {
1352
1352
  const placeId = fields.get("placeId");
1353
1353
  const rating = fields.get("rating");
@@ -1359,10 +1359,10 @@ export async function typedDocumentFromMarkdown({
1359
1359
  file,
1360
1360
  );
1361
1361
  }
1362
- data = { placeId, rating, body: await convert(markdown) };
1362
+ data = { placeId, rating, body: await convert(markdown, firstLine) };
1363
1363
  } else if (template === TEMPLATE_ALBUM) {
1364
1364
  data = {
1365
- ...(await parseAlbumBody(markdown, { file, convert, resolveImage })),
1365
+ ...(await parseAlbumBody(markdown, { file, convert, resolveImage, firstLine })),
1366
1366
  seamless: parseFlag(fields, "seamless", file),
1367
1367
  borderWidth: parseCount(fields, "borderWidth", file, ALBUM_MAXIMUM_BORDER_WIDTH),
1368
1368
  place: fields.get("place"),
@@ -7,6 +7,19 @@ import { compareCliVersions } from "../cli-release.js";
7
7
  import { CLI_UPGRADE_COMMAND, CLI_VERSION, VERB_CHANGELOG } from "../constants.js";
8
8
  import { successResult } from "../session.js";
9
9
 
10
+ // The whole record outgrew the 64 KiB result bound in 0.57.0, so --since keeps
11
+ // the newest releases that fit this share of it and says which were left out.
12
+ const ENTRIES_BYTE_BUDGET = 56 * 1024;
13
+
14
+ function newestThatFit(entries) {
15
+ let bytes = 0;
16
+ for (let index = 0; index < entries.length; index += 1) {
17
+ bytes += Buffer.byteLength(JSON.stringify(entries[index]), "utf8");
18
+ if (bytes > ENTRIES_BYTE_BUDGET) return entries.slice(0, index);
19
+ }
20
+ return entries;
21
+ }
22
+
10
23
  /**
11
24
  * `changelog [--since <version>]` — what changed in each release, offline.
12
25
  *
@@ -21,9 +34,11 @@ export async function changelog(invocation) {
21
34
  const onProgress = invocation.onProgress ?? (() => {});
22
35
  const since = invocation.since;
23
36
  const installed = changelogEntryFor(CLI_VERSION);
24
- const entries = since === undefined
37
+ const recorded = since === undefined
25
38
  ? installed === undefined ? [] : [installed]
26
39
  : changelogEntriesSince(since);
40
+ const entries = newestThatFit(recorded);
41
+ const omitted = recorded.slice(entries.length);
27
42
  const earliest = earliestRecordedVersion();
28
43
  const startsBeforeRecord = since !== undefined && earliest !== undefined && compareCliVersions(since, earliest) < 0;
29
44
 
@@ -38,6 +53,12 @@ export async function changelog(invocation) {
38
53
  if (startsBeforeRecord) {
39
54
  notes.push(`The record starts at ${earliest}; changes before it are not listed.`);
40
55
  }
56
+ if (omitted.length > 0) {
57
+ notes.push(
58
+ `Releases ${omitted.at(-1).version} to ${omitted[0].version} are left out to keep the result within its size `
59
+ + "limit. They are in the installed package's src/changelog.json.",
60
+ );
61
+ }
41
62
 
42
63
  for (const entry of entries) {
43
64
  onProgress(`${entry.version}${entry.date === undefined ? "" : ` (${entry.date})`}: ${entry.note}`);
@@ -56,7 +77,7 @@ export async function changelog(invocation) {
56
77
  behavior: [...entry.behavior],
57
78
  help: [...entry.help],
58
79
  })),
59
- complete: !startsBeforeRecord,
80
+ complete: !startsBeforeRecord && omitted.length === 0,
60
81
  ...(notes.length === 0 ? {} : { notes }),
61
82
  });
62
83
  }
@@ -7,9 +7,11 @@ import {
7
7
  mintStagingPreviewHandoff,
8
8
  withRefusalGuidance,
9
9
  } from "../api.js";
10
- import { DEPLOY_TARGET_PRODUCTION, DEPLOY_TARGET_STAGING, VERB_DELIVERY_CHECK } from "../constants.js";
10
+ import { boundSkippedLinks } from "../chrome-additions.js";
11
+ import { linkedPageEntries, unlinkedSavedPageEntries } from "../chrome-input.js";
12
+ import { DEPLOY_TARGET_PRODUCTION, DEPLOY_TARGET_STAGING, LIMITS, VERB_DELIVERY_CHECK } from "../constants.js";
11
13
  import { probeDeliveryWithBrowser } from "../delivery-browser.js";
12
- import { checkDelivery, DELIVERY_LIMITS } from "../delivery-check.js";
14
+ import { checkDelivery, selectDeliveryRoutes } from "../delivery-check.js";
13
15
  import { SiteAuthoringError } from "../errors.js";
14
16
  import { openSession, successResult } from "../session.js";
15
17
  import { authorizeStagingHandoff } from "../staging-check.js";
@@ -44,17 +46,31 @@ function environmentFor(target) {
44
46
  * is exactly what a delivery check on a typed-content site has to prove (TR00893).
45
47
  */
46
48
  function routesToCheck(pages) {
47
- const usable = pages.filter((page) => page !== null && typeof page === "object" && typeof page.path === "string");
48
49
  const seenTemplates = new Set();
49
50
  const firstOfTemplate = [];
50
51
  const rest = [];
51
- for (const page of usable) {
52
+ for (const page of linkedPageEntries(pages)) {
52
53
  (seenTemplates.has(page.templateType) ? rest : firstOfTemplate).push(page);
53
54
  seenTemplates.add(page.templateType);
54
55
  }
55
- return [...firstOfTemplate, ...rest].map((page) =>
56
- page.path === "" ? "/" : `/${page.path.replace(/^\/+/u, "")}/`.replace(/\/\/$/u, "/")
57
- );
56
+ return [...firstOfTemplate, ...rest].map((page) => (page.path === "" ? "/" : `/${page.path}/`));
57
+ }
58
+
59
+ const UNCHECKED_ROUTE_LIMIT = 20;
60
+ const UNCHECKED_ROUTE_REASON = "omitted from the authored-route sample: the workspace manifest records a status other than published or approved (a stale status may not match the deployed site); the check may still fetch the page as a link from another page";
61
+ // Room kept for the envelope a verb wraps around its fields.
62
+ const RESULT_ENVELOPE_RESERVE_BYTES = 2048;
63
+
64
+ /** Saved manifest pages the check skips, bounded like the other report lists. */
65
+ function uncheckedRoutes(pages) {
66
+ // The home page is always probed, so it is never listed as unchecked.
67
+ const entries = unlinkedSavedPageEntries(pages).filter(({ path }) => path !== "/");
68
+ return {
69
+ items: entries.slice(0, UNCHECKED_ROUTE_LIMIT).map(({ path }) => ({ path, reason: UNCHECKED_ROUTE_REASON })),
70
+ total: entries.length,
71
+ truncated: entries.length > UNCHECKED_ROUTE_LIMIT,
72
+ basis: "workspace manifest status",
73
+ };
58
74
  }
59
75
 
60
76
  async function resolveTarget(client, siteId, target, invocation, onProgress, now) {
@@ -141,7 +157,13 @@ export async function deliveryCheck(invocation) {
141
157
 
142
158
  const resolved = await resolveTarget(client, siteId, target, invocation, onProgress, now);
143
159
  const routes = routesToCheck(manifest?.pages ?? []);
144
- onProgress(`Checking ${resolved.baseUrl} (${Math.min(routes.length + 1, DELIVERY_LIMITS.routes)} route(s), assets, runtime).`);
160
+ const unchecked = uncheckedRoutes(manifest?.pages ?? []);
161
+ if (unchecked.total > 0) {
162
+ onProgress(
163
+ `${unchecked.total} saved page(s) the workspace manifest records as not published or approved were left out of the authored-route sample because of their manifest status (a stale status may not match the deployed site; the check may still fetch one as a link from another page), so the verdict covers the sampled routes and the checks made from them; run pull after approving pages in the app, then check again.`,
164
+ );
165
+ }
166
+ onProgress(`Checking ${resolved.baseUrl} (${selectDeliveryRoutes(routes).sampled.length} route(s), assets, runtime).`);
145
167
  const report = await checkDelivery({
146
168
  fetch: client.fetch,
147
169
  timeoutSignal: client.timeoutSignal,
@@ -171,16 +193,18 @@ export async function deliveryCheck(invocation) {
171
193
  if (browser.status === "checked" && browser.returningCache?.status !== "checked") onProgress("Browser dimension: cache reuse on the returning load could not be observed; it is unchecked.");
172
194
 
173
195
  const verdict = report.verdict === "delivered" && browser.status === "checked" && !browser.ok ? "degraded" : report.verdict;
196
+ if (unchecked.total > 0) onProgress("The verdict covers the sampled routes and the checks made from them; a page left out of the sample for its manifest status can still be fetched as a link and affect it.");
174
197
  onProgress(
175
198
  verdict === "delivered"
176
199
  ? "Delivery verified over HTTP" + (browser.status === "checked" ? " and in a browser." : "; browser behaviour unchecked.")
177
200
  : `Delivery ${verdict}: ${report.failures.length} HTTP finding(s)` + (browser.status === "checked" && !browser.ok ? " and a browser mismatch." : "."),
178
201
  );
179
- return successResult(VERB_DELIVERY_CHECK, siteId, {
202
+ const fields = {
180
203
  environment,
181
204
  target: { ...report.target, resolvedFrom: resolved.source },
182
205
  deployment,
183
206
  verdict,
207
+ verdictCovers: "sampled routes and the checks made from them",
184
208
  routes: report.routes,
185
209
  assets: report.assets,
186
210
  links: report.links,
@@ -200,6 +224,16 @@ export async function deliveryCheck(invocation) {
200
224
  ? []
201
225
  : ["what a returning browser loads from its own cache"]),
202
226
  ],
227
+ };
228
+ // The unchecked list takes only the room the rest of the result leaves, so long paths never exceed the output bound.
229
+ // It is present in every report: no items and a total of 0 mean no saved page was left out for its status.
230
+ const room = Math.min(
231
+ 8 * 1024,
232
+ LIMITS.githubOutputBytes - Buffer.byteLength(JSON.stringify(fields), "utf8") - RESULT_ENVELOPE_RESERVE_BYTES,
233
+ );
234
+ return successResult(VERB_DELIVERY_CHECK, siteId, {
235
+ ...fields,
236
+ uncheckedRoutes: boundSkippedLinks(unchecked, Math.max(room, 0)),
203
237
  });
204
238
  });
205
239
  }
@@ -1,6 +1,7 @@
1
- import { getSiteImageDescription, listSiteImageDescriptions, updateSiteImageDescription, withRefusalGuidance } from "../api.js";
1
+ import { getSiteImageDescription, listSiteImageDescriptions, withRefusalGuidance } from "../api.js";
2
2
  import { VERB_MEDIA_IMAGES_DESCRIBE, VERB_MEDIA_IMAGES_GET, VERB_MEDIA_IMAGES_LIST } from "../constants.js";
3
3
  import { SiteAuthoringError } from "../errors.js";
4
+ import { imageDescriptionExistsError, writeImageDescription } from "../image-description-write.js";
4
5
  import { imageDescriptionOptions, imageListOptions, requireImageId } from "../image-description-contract.js";
5
6
  import { serializeResult } from "../output.js";
6
7
  import { openSession, successResult, warnIfExternalWritesPaused } from "../session.js";
@@ -47,8 +48,7 @@ export function translateImageDescriptionRefusal(error) {
47
48
  { field: "expectedRevision", status: error.status });
48
49
  }
49
50
  if (error instanceof ApiError && error.hasField("OnlyIfMissing")) {
50
- return new SiteAuthoringError("media.image_description_exists", "This image already has a default description; nothing changed.",
51
- { field: "onlyIfMissing", status: error.status });
51
+ return imageDescriptionExistsError(error.status);
52
52
  }
53
53
  if (error instanceof ApiError && error.hasField("DefaultDescription")) {
54
54
  return new SiteAuthoringError("media.image_description_invalid",
@@ -66,7 +66,7 @@ export async function mediaImagesDescribe(invocation) {
66
66
  const { client, siteId, onProgress } = session;
67
67
  const image = await withRefusalGuidance(onProgress, VERB_MEDIA_IMAGES_DESCRIBE, async () => {
68
68
  try {
69
- return await updateSiteImageDescription(client, siteId, imageId, body);
69
+ return await writeImageDescription(client, siteId, imageId, body);
70
70
  } catch (error) {
71
71
  throw translateImageDescriptionRefusal(error);
72
72
  }
@@ -43,7 +43,7 @@ import { outcomeUnknown, SiteAuthoringError } from "../errors.js";
43
43
  import { DESCRIPTION_MAXIMUM_LENGTH, DESCRIPTION_WARN_LENGTH, descriptionWarnings } from "../page-metadata.js";
44
44
  import { stableJson } from "../footer-draft-hash.js";
45
45
  import { outgoingTagIntent, preflightPageTagWrites, tagBaselineAfterWrite, translatePageTagRefusal } from "../page-tag-writes.js";
46
- import { CHECK_AREA, collectProblems, planStale, problemsOf, refuseProblems } from "../problems.js";
46
+ import { CHECK_AREA, appendAll, attachProblemsFile, collectProblems, planStale, problemsOf, refuseProblems, withFullProblems } from "../problems.js";
47
47
  import { RUNTIME_MIRROR_PATH_REASON, isRuntimeMirrorPath } from "../reserved-paths.js";
48
48
  import { boundedByBytes, openSession, successResult, warnIfExternalWritesPaused } from "../session.js";
49
49
  import { SETTINGS_TYPE_TAPROOT_STYLES } from "../settings-catalog.js";
@@ -121,6 +121,7 @@ import {
121
121
  writeManifest,
122
122
  writeWorkspaceJson,
123
123
  mediaReferenceCandidates,
124
+ retiredSourcesByFile,
124
125
  } from "../workspace.js";
125
126
 
126
127
  /**
@@ -502,7 +503,7 @@ function peekJsonTemplate(text) {
502
503
  * site deletes such a page on its next synchronization, but until then it is still listed,
503
504
  * so a pulled source of that kind is judged here, before its document is read.
504
505
  */
505
- function isRetiredGeneratedSource(source) {
506
+ export function isRetiredGeneratedSource(source) {
506
507
  if (source.template !== TEMPLATE_GENERATED || typeof source.text !== "string") return false;
507
508
  try {
508
509
  return RETIRED_GENERATED_PAGE_KINDS.includes(JSON.parse(source.text)?.data?.kind);
@@ -784,26 +785,33 @@ async function convertedWorkspacePageSource({ source, mediaManifest, content: in
784
785
  const { file } = source;
785
786
  if (source.sourceFormat === PAGE_SOURCE_FORMAT_MARKDOWN) {
786
787
  const resolveImage = makeResolveImage(mediaManifest, file);
787
- const convert = async (markdown) => {
788
- const converted = await content.markdownToProseMirror(markdown, { resolveImage });
788
+ // Only a free-form page collects every section decoration and background problem (TR01427).
789
+ const recoverSectionProblems = source.template === TEMPLATE_FREE_FORM;
790
+ const convert = async (markdown, firstLine = source.markdownFirstLine) => {
791
+ const converted = await content.markdownToProseMirror(markdown, { resolveImage, firstLine, recoverSectionProblems });
789
792
  return unwrapProseMirrorDocument(
790
793
  converted === null || typeof converted !== "object" ? undefined : converted.doc,
791
794
  file,
792
795
  );
793
796
  };
794
- const document = source.template === TEMPLATE_FREE_FORM
795
- ? await convert(source.markdown)
796
- : await typedDocumentFromMarkdown({
797
- template: source.template,
798
- fields: source.fields,
799
- markdown: source.markdown,
800
- file,
801
- convert,
802
- convertStep: (markdown, firstLine) => content.markdownToProseMirror(markdown, { resolveImage, recipeStep: true, firstLine }),
803
- firstLine: source.markdownFirstLine,
804
- resolveImage,
805
- });
806
- return { document };
797
+ try {
798
+ const document = source.template === TEMPLATE_FREE_FORM
799
+ ? await convert(source.markdown)
800
+ : await typedDocumentFromMarkdown({
801
+ template: source.template,
802
+ fields: source.fields,
803
+ markdown: source.markdown,
804
+ file,
805
+ convert,
806
+ convertStep: (markdown, firstLine) => content.markdownToProseMirror(markdown, { resolveImage, recipeStep: true, firstLine }),
807
+ firstLine: source.markdownFirstLine,
808
+ resolveImage,
809
+ });
810
+ return { document };
811
+ } catch (error) {
812
+ // A lone refusal is rethrown as raised, so the file is attached to its problems here.
813
+ throw attachProblemsFile(error, file);
814
+ }
807
815
  }
808
816
  let parsed;
809
817
  try {
@@ -936,7 +944,7 @@ export async function placedVideoProblems(client, siteId, planned) {
936
944
  const problems = [];
937
945
  for (const [videoId, file] of placements) {
938
946
  if (knownIds.has(videoId)) continue;
939
- problems.push(...problemsOf(
947
+ appendAll(problems, problemsOf(
940
948
  library.truncated
941
949
  ? documentError(
942
950
  "pages.video_library_unverifiable",
@@ -985,7 +993,7 @@ export async function placedFormProblems(client, siteId, planned, readLocalFormK
985
993
  localFormKeys = await readLocalFormKeys();
986
994
  localRead = true;
987
995
  }
988
- problems.push(...problemsOf(
996
+ appendAll(problems, problemsOf(
989
997
  index.archivedKeys.has(key)
990
998
  ? documentError(
991
999
  "pages.form_archived",
@@ -1264,11 +1272,7 @@ export async function planPages({
1264
1272
  // Sources of generated pages the site has since retired, which pull keeps
1265
1273
  // apart from the live pages (TR01195). Never sent; reported, not refused,
1266
1274
  // unless a push names that path.
1267
- const retiredByFile = new Map(
1268
- (Array.isArray(manifest.retiredGeneratedSources) ? manifest.retiredGeneratedSources : [])
1269
- .filter((entry) => typeof entry?.file === "string" && typeof entry?.path === "string")
1270
- .map((entry) => [entry.file, entry]),
1271
- );
1275
+ const retiredByFile = retiredSourcesByFile(manifest);
1272
1276
  for (const file of files) {
1273
1277
  const manifestEntry = manifestByFile.get(file);
1274
1278
  const retired = manifestEntry === undefined ? retiredByFile.get(file) : undefined;
@@ -1297,7 +1301,7 @@ export async function planPages({
1297
1301
  // reports it; a targeted one refuses only if the selection touches a
1298
1302
  // path it might be.
1299
1303
  if (targeted) claimants.push(source);
1300
- else problems.push(...problemsOf(source.fault ?? missingPathError(file), { ...area, file }));
1304
+ else appendAll(problems, problemsOf(source.fault ?? missingPathError(file), { ...area, file }));
1301
1305
  continue;
1302
1306
  }
1303
1307
  sources.push(source);
@@ -1313,7 +1317,7 @@ export async function planPages({
1313
1317
  continue;
1314
1318
  }
1315
1319
  if (targeted) throw error;
1316
- problems.push(...problemsOf(error, { ...area, file }));
1320
+ appendAll(problems, problemsOf(error, { ...area, file }));
1317
1321
  }
1318
1322
  }
1319
1323
 
@@ -1332,7 +1336,7 @@ export async function planPages({
1332
1336
  }
1333
1337
  if (!targeted || requestedPaths.has(source.pagePath)) {
1334
1338
  conflicted.add(source.pagePath);
1335
- problems.push(...problemsOf(
1339
+ appendAll(problems, problemsOf(
1336
1340
  documentError(
1337
1341
  "pages.path_conflict",
1338
1342
  `'${source.file}' and '${existing.file}' both claim page path '${source.pagePath}'.`,
@@ -1699,7 +1703,9 @@ export async function planPages({
1699
1703
  });
1700
1704
  }
1701
1705
 
1702
- return { targeted, sources, selected, planned, unresolved, staleGenerated, problems };
1706
+ // Both claimants of a contested path, so a caller can say neither was counted (the problem names only the later one).
1707
+ const conflictedFiles = sources.filter((source) => conflicted.has(source.pagePath)).map((source) => source.file);
1708
+ return { targeted, sources, selected, planned, unresolved, staleGenerated, problems, conflictedFiles };
1703
1709
  }
1704
1710
 
1705
1711
  function missingPathError(file) {
@@ -1875,15 +1881,15 @@ export async function pagesPush(invocation) {
1875
1881
  });
1876
1882
  const { planned, targeted, unresolved, staleGenerated } = plan;
1877
1883
  await preflightPageTagWrites(client, siteId, plan, invocation.pageTagCapabilities);
1878
- plan.problems.push(...latestPostsTagProblems(planned, manifest, { sendingOnly: true }));
1884
+ appendAll(plan.problems, latestPostsTagProblems(planned, manifest, { sendingOnly: true }));
1879
1885
  // A page that places a video names it by id, and only the library knows
1880
1886
  // whether that id is one of this site's videos. Asked once for the whole
1881
1887
  // push, before anything is written, so a page cannot be sent that
1882
1888
  // publishing would then refuse.
1883
- plan.problems.push(...await placedVideoProblems(client, siteId, planned));
1889
+ appendAll(plan.problems, await placedVideoProblems(client, siteId, planned));
1884
1890
  // Likewise a form: pages store its id, which only the site's own forms can supply.
1885
1891
  const placedForms = await placedFormProblems(client, siteId, planned, () => workspaceFormKeys(config.workspaceDir));
1886
- plan.problems.push(...placedForms.problems);
1892
+ appendAll(plan.problems, placedForms.problems);
1887
1893
 
1888
1894
  // Under apply, the workspace read ledger has already held every source and
1889
1895
  // manifest to the plan. What it cannot see is the site: every page the plan
@@ -1896,7 +1902,7 @@ export async function pagesPush(invocation) {
1896
1902
  for (const [file, expected] of invocation.plannedPages) {
1897
1903
  const page = byFile.get(file);
1898
1904
  if (page === undefined || stableJson(plannedPageWriteIdentity(page)) !== expected) {
1899
- throw planStale(`'${file}'`, file).withProblems(plan.problems);
1905
+ throw withFullProblems(planStale(`'${file}'`, file), plan.problems);
1900
1906
  }
1901
1907
  }
1902
1908
  const unplanned = planned.find((page) => !page.unchanged && !invocation.plannedPages.has(page.file));