canopycms 0.8.1 → 0.8.2
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.
- package/CHANGELOG.md +102 -47
- package/dist/api/admin-branch-health.d.ts +11 -0
- package/dist/api/admin-branch-health.js +36 -0
- package/dist/api/admin.d.ts +8 -1
- package/dist/api/branch-merge.js +1 -1
- package/dist/api/branch-review.js +20 -3
- package/dist/api/branch-status.js +30 -19
- package/dist/api/branch.d.ts +8 -3
- package/dist/api/branch.js +32 -3
- package/dist/api/client.d.ts +3 -1
- package/dist/api/client.js +4 -0
- package/dist/api/github-sync.d.ts +2 -0
- package/dist/api/github-sync.js +6 -1
- package/dist/api/pr-comment-sync.js +3 -1
- package/dist/branch-metadata-file.d.ts +66 -0
- package/dist/branch-metadata-file.js +14 -0
- package/dist/branch-metadata.d.ts +4 -2
- package/dist/branch-metadata.js +10 -2
- package/dist/cli/cli.js +28 -8
- package/dist/cli/generate-ai-content.js +13 -3
- package/dist/cli/init.js +2 -2
- package/dist/editor/BranchManager.d.ts +8 -4
- package/dist/editor/BranchManager.js +43 -18
- package/dist/editor/Editor.js +3 -2
- package/dist/editor/admin/SystemHealthPanel.js +65 -31
- package/dist/editor/admin/UnpublishedAtMergeAlert.d.ts +16 -0
- package/dist/editor/admin/UnpublishedAtMergeAlert.js +50 -0
- package/dist/editor/admin/useSystemHealth.d.ts +2 -0
- package/dist/editor/admin/useSystemHealth.js +21 -0
- package/dist/editor/branch-lock.d.ts +2 -0
- package/dist/editor/branch-lock.js +5 -3
- package/dist/editor/branch-status.d.ts +25 -1
- package/dist/editor/branch-status.js +75 -0
- package/dist/editor/components/EditorHeader.d.ts +6 -2
- package/dist/editor/components/EditorHeader.js +51 -30
- package/dist/editor/components/EntryHeader.d.ts +3 -1
- package/dist/editor/components/EntryHeader.js +2 -1
- package/dist/editor/components/TooltipDetail.d.ts +14 -0
- package/dist/editor/components/TooltipDetail.js +18 -0
- package/dist/editor/copy.d.ts +7 -0
- package/dist/editor/copy.js +9 -0
- package/dist/editor/hooks/useBranchManager.d.ts +8 -3
- package/dist/editor/hooks/useBranchManager.js +48 -5
- package/dist/pr-comments.d.ts +2 -0
- package/dist/pr-comments.js +20 -14
- package/dist/resource-generation.js +2 -3
- package/dist/submission-attribution.d.ts +1 -1
- package/dist/submission-attribution.js +20 -2
- package/dist/task-queue/task-queue.d.ts +5 -1
- package/dist/task-queue/task-queue.js +4 -2
- package/dist/types.d.ts +61 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/branch-merge.d.ts +68 -0
- package/dist/worker/branch-merge.js +228 -0
- package/dist/worker/canopy-state.d.ts +2 -0
- package/dist/worker/canopy-state.js +1 -1
- package/dist/worker/cms-worker.d.ts +1 -0
- package/dist/worker/cms-worker.js +5 -3
- package/dist/worker/git-sync.js +15 -8
- package/dist/worker/github-commits.d.ts +106 -0
- package/dist/worker/github-commits.js +485 -0
- package/dist/worker/github-gateway-http.js +3 -2
- package/dist/worker/github-gateway-wire.d.ts +22 -13
- package/dist/worker/github-gateway-wire.js +4 -1
- package/dist/worker/github-gateway.d.ts +16 -5
- package/dist/worker/github-gateway.js +22 -5
- package/dist/worker/github-mirror.d.ts +8 -0
- package/dist/worker/github-mirror.js +12 -1
- package/dist/worker/github-transfer.d.ts +3 -1
- package/dist/worker/github-transfer.js +3 -2
- package/dist/worker/history-rewrite.d.ts +13 -1
- package/dist/worker/history-rewrite.js +27 -3
- package/dist/worker/rebase.d.ts +13 -7
- package/dist/worker/rebase.js +351 -95
- package/dist/worker/task-runner.d.ts +1 -1
- package/dist/worker/task-runner.js +172 -34
- package/dist/worker/worker-context.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,9 +5,9 @@ packages release together, at one version.
|
|
|
5
5
|
|
|
6
6
|
## This build
|
|
7
7
|
|
|
8
|
-
Version `0.8.
|
|
8
|
+
Version `0.8.2`, built from [`74c7565`](https://github.com/safeinsights/canopycms/tree/74c756559271d91a988cf1ce2d250720062efd59).
|
|
9
9
|
|
|
10
|
-
Its entries are [0.8.
|
|
10
|
+
Its entries are [0.8.2](#082), under **Released**.
|
|
11
11
|
|
|
12
12
|
If you upgraded from a build on another branch, compare the `<!-- changeset: … -->` slugs in your previous build's `CHANGELOG.md` (`npm pack canopycms@<old>` fetches it) with this one's: entries whose slug your old file lacks are new to you.
|
|
13
13
|
|
|
@@ -24,7 +24,7 @@ Each entry has up to three parts:
|
|
|
24
24
|
`node_modules/canopycms/CHANGELOG.md`, assembled for that build: its **This build** section lists
|
|
25
25
|
what is new since the previous int on the same branch, or on a stable release links its entries, and its links point at the commit the build
|
|
26
26
|
came from. The copy in the repository holds released history and the entries from before changesets;
|
|
27
|
-
every entry written since is a file in [`.changeset/`](https://github.com/safeinsights/canopycms/blob/
|
|
27
|
+
every entry written since is a file in [`.changeset/`](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/.changeset/README.md) until a stable release
|
|
28
28
|
moves it here.
|
|
29
29
|
|
|
30
30
|
**Find your starting point.** From a stable pin, start at the first version under **Released**
|
|
@@ -62,6 +62,61 @@ entries under **Released**.
|
|
|
62
62
|
|
|
63
63
|
## Released
|
|
64
64
|
|
|
65
|
+
### 0.8.2
|
|
66
|
+
|
|
67
|
+
#### The editor says when a pull request is stuck, and what to do
|
|
68
|
+
|
|
69
|
+
<!-- changeset: editor-shows-held-prs -->
|
|
70
|
+
|
|
71
|
+
_First in 0.8.2._
|
|
72
|
+
|
|
73
|
+
**What changed.** A branch could sit stuck with nothing in the editor to say why. The branch bar and the branch card now show a "Needs action" badge, with what's wrong and what this person can do about it, and System health shows the same.
|
|
74
|
+
|
|
75
|
+
- A branch in review that conflicts with its base: the line gives its author, a reviewer and anyone else their own way forward.
|
|
76
|
+
- A pull request retargeted to another base on GitHub that has fallen behind it or conflicts with it: update it on the pull request, or ask an admin.
|
|
77
|
+
- A branch force-pushed on GitHub: submit is blocked, as nothing can reach GitHub until an admin sorts it out.
|
|
78
|
+
- A submit that failed before its pull request step ran: the line says the pull request may not have the latest changes, and how to finish it. The failure now stays until the submit is retried or made again, where another task's success could clear it.
|
|
79
|
+
- A branch in review with a failed sync now says it won't update from its base until it syncs.
|
|
80
|
+
|
|
81
|
+
#### Commits made on a pull request's branch on GitHub now reach the editor
|
|
82
|
+
|
|
83
|
+
<!-- changeset: github-commits-into-clones -->
|
|
84
|
+
|
|
85
|
+
_First in 0.8.2._
|
|
86
|
+
|
|
87
|
+
**What changed.** After Update branch or a maintainer's fix on GitHub, submitting a branch that had returned to editing failed for good with a 409 saying to try again shortly. Each sync now brings those commits into the branch's workspace, so the submit goes through.
|
|
88
|
+
|
|
89
|
+
- If both sides changed a file, the editor's version is kept and the pull request lists the file.
|
|
90
|
+
- A commit that isn't the base catching up sends an approved branch back to review.
|
|
91
|
+
- A branch that has merged GitHub's commits catches up with its base by merging it rather than rebasing, so nothing it settled is undone. So does a branch whose push failed for good, whose commits GitHub never received.
|
|
92
|
+
- A branch force-pushed on GitHub is left alone, and nothing more is pushed for it, so a commit removed there stays removed. System health says what a developer needs to do.
|
|
93
|
+
- A submit or push GitHub rejects because its branch moved runs again after the next sync, unless the branch has moved on since.
|
|
94
|
+
|
|
95
|
+
**Rolling back.** Don't roll the worker back past this version once it has run. An older worker rebases editing branches, and a rebase drops the merge commits this one makes: a version kept over GitHub's is replaced by GitHub's, and the result is force-pushed to the pull request. If you have to, first merge or delete every editing branch holding a merge commit, and let the task queue drain.
|
|
96
|
+
|
|
97
|
+
#### Pull requests from the editor stay up to date with their base
|
|
98
|
+
|
|
99
|
+
<!-- changeset: keep-editor-prs-current -->
|
|
100
|
+
|
|
101
|
+
_First in 0.8.2._
|
|
102
|
+
|
|
103
|
+
**What changed.** Where a repository requires branches to be up to date before merging, a pull request from the editor no longer waits behind its base for someone to click Update branch. When GitHub reports it behind, the next sync merges the base into it.
|
|
104
|
+
|
|
105
|
+
- Each update is a new commit, so required checks run again.
|
|
106
|
+
- An approval in CanopyCMS stays, because the pull request's changes are the same. In our test, GitHub kept an approval through a merge of the base that left the diff unchanged, under both "dismiss stale approvals" and "require approval of the most recent push". That test used a person's push under classic branch protection, so check it against your own rules.
|
|
107
|
+
- A pull request that conflicts with its base stays as it is. Withdraw it from review to resolve the conflict.
|
|
108
|
+
- Repositories that don't require up-to-date branches see no change.
|
|
109
|
+
|
|
110
|
+
#### A branch whose submit failed can't be approved, and a merge that may miss commits is flagged
|
|
111
|
+
|
|
112
|
+
<!-- changeset: unfinished-submit-rulings -->
|
|
113
|
+
|
|
114
|
+
_First in 0.8.2._
|
|
115
|
+
|
|
116
|
+
**What changed.** Approve is disabled while a branch's last submit has failed, with the reason beside it, and the API refuses it with a 409, because what's approved may not be what the pull request holds. Request changes stays open. A submit that fails after an approval sends the branch back to review and clears the verdict from the pull request. A submit that couldn't be queued counts as failed, and says to submit again.
|
|
117
|
+
|
|
118
|
+
If a pull request merges before a submit finishes, commits from that submit may not be in the merge. Archiving now records that. System health's Overview names the branch until an admin dismisses the warning or deletes the branch, the branch shows "Needs action", and only an admin can delete it meanwhile.
|
|
119
|
+
|
|
65
120
|
### 0.8.1
|
|
66
121
|
|
|
67
122
|
#### Content reads stop re-reading and re-parsing the schema cache
|
|
@@ -261,7 +316,7 @@ _First in 0.7.0._
|
|
|
261
316
|
|
|
262
317
|
**What changed.** The pull request a submit opens now lists the branch's unresolved editor comment threads: where each one is, the first line of its first comment (80 characters at most) and a link to it in the editor. Once every thread is resolved, it says so. The list is updated whenever a comment is added, replied to or resolved, as well as on submit. Comment excerpts are visible to everyone who can read the pull request, which on a public repository means everyone. Open threads do not block the merge or keep the pull request in draft. A pull request opened before this release shows no list until its branch is next submitted.
|
|
263
318
|
|
|
264
|
-
**To adopt.** Nothing, if your deploy replaces the worker along with the CMS, as `cdk deploy` of the canopycms-cdk stack does with the default `workerCode`. A worker on an earlier release fails each update of the list and marks the branch's sync failed until a later task succeeds, so a pipeline that leaves the worker behind must roll it no later than the CMS: see [Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/
|
|
319
|
+
**To adopt.** Nothing, if your deploy replaces the worker along with the CMS, as `cdk deploy` of the canopycms-cdk stack does with the default `workerCode`. A worker on an earlier release fails each update of the list and marks the branch's sync failed until a later task succeeds, so a pipeline that leaves the worker behind must roll it no later than the CMS: see [Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#rolling-the-worker-from-ci).
|
|
265
320
|
|
|
266
321
|
#### Pull request bodies link back to the editor
|
|
267
322
|
|
|
@@ -271,7 +326,7 @@ _First in 0.7.0._
|
|
|
271
326
|
|
|
272
327
|
**What changed.** The pull request a submit opens links to the branch in the editor, and each changed entry to that entry. A notice tells reviewers that comments on the pull request do not reach the editor, so the author will not see them. The links use the editor's URL from the submit, accepted only when its host is the one the request was addressed to (`X-Forwarded-Host`, else `Host`), which holds behind `canopycms-cdk`'s CloudFront distribution as it stands.
|
|
273
328
|
|
|
274
|
-
**To adopt.** Nothing, unless a proxy in front of the CMS sets neither header to the editor's public host: then set `editorUrl` in your Canopy config to the editor page's URL, e.g. `editorUrl: 'https://cms.example.org/edit'`. See [the config reference](https://github.com/safeinsights/canopycms/blob/
|
|
329
|
+
**To adopt.** Nothing, unless a proxy in front of the CMS sets neither header to the editor's public host: then set `editorUrl` in your Canopy config to the editor page's URL, e.g. `editorUrl: 'https://cms.example.org/edit'`. See [the config reference](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#definecanopyconfig-options).
|
|
275
330
|
|
|
276
331
|
#### CloudFront origin read timeout accepted up to 120 s; the editor waits 135 s
|
|
277
332
|
|
|
@@ -357,7 +412,7 @@ _First in 0.6.0._
|
|
|
357
412
|
|
|
358
413
|
**What changed.** `CanopyCmsService` takes `clerkOrganizationsAsGroups` (default `true`, unchanged), which the worker honours; in a deployment it, not the plugin's `useOrganizationsAsGroups`, decides the groups. When Clerk refuses the organization list with a 403 (Organizations disabled), the refresh now writes users with no groups and logs a warning, instead of failing whole; any other failure still keeps the last snapshot. Memberships are fetched instance-wide rather than per user. The scaffolds write `false` explicitly: `useOrganizationsAsGroups` in `canopycms init`'s `canopy.ts`, and `clerkOrganizationsAsGroups` in `canopycms init-deploy aws`'s CDK stack.
|
|
359
414
|
|
|
360
|
-
**To adopt.** On a Clerk instance without Organizations, set `clerkOrganizationsAsGroups: false` on `CanopyCmsService` and `useOrganizationsAsGroups: false` in `createClerkAuthPlugin`. See [Deploying to AWS](https://github.com/safeinsights/canopycms/blob/
|
|
415
|
+
**To adopt.** On a Clerk instance without Organizations, set `clerkOrganizationsAsGroups: false` on `CanopyCmsService` and `useOrganizationsAsGroups: false` in `createClerkAuthPlugin`. See [Deploying to AWS](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md).
|
|
361
416
|
|
|
362
417
|
### 0.5.0
|
|
363
418
|
|
|
@@ -369,7 +424,7 @@ _First in 0.5.0._
|
|
|
369
424
|
|
|
370
425
|
**What changed.** A `type: 'reference', list: true` field now edits as rows in stored order, like an `object` list: drag a row or use its "…" menu to move or remove it, open a row to swap its entry in place, and pick from Add under the rows to append. Neither control offers an entry the list already holds. Any `list: true` field, and any `block` field, takes `maxItems`. The editor stops adding at the cap and says why, a save over it is refused, and a production build fails on an entry over it, naming the entry, field, count and cap. Adding `maxItems` to a list that already holds more therefore fails the build until an editor removes the extra items. `maxItems` on a field that holds no items is refused when the entry schema registry is created.
|
|
371
426
|
|
|
372
|
-
**To adopt.** Set `maxItems: 3` on the list field in its entry schema. See [Field Types](https://github.com/safeinsights/canopycms/blob/
|
|
427
|
+
**To adopt.** Set `maxItems: 3` on the list field in its entry schema. See [Field Types](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#field-types).
|
|
373
428
|
|
|
374
429
|
#### SEO field location moves into config; reference pickers mark hidden entries and take a sort order — **breaking: `createNextCanopyContext({ seo })` and `AIContentConfig.seo` are removed**
|
|
375
430
|
|
|
@@ -379,7 +434,7 @@ _First in 0.5.0._
|
|
|
379
434
|
|
|
380
435
|
**What changed.** `defineCanopyConfig` takes `seo: { group?, fields? }`, the one place every surface reads an entry's `noindex` flag: the sitemap and `entryToMetadata` that `createNextCanopyContext` returns, AI content and the editor's reference picker. A per-call `seo`/`group`/`fields` still overrides it. The free `generateContentSitemap` takes `seo` as an argument and refuses to run without it when the config sets one; `createNextCanopyContext` and the AI content config refuse a leftover `seo`. A reference picker now badges an entry hidden from search as "Hidden from search", and picking one adds a note naming the setting on that entry's form, since a page listing only indexed entries won't show it. A reference field takes `optionSort`: `'label'` (the default), `'collection'`, or `{ field, direction }`. Point `field` at an ISO date, since strings compare as text.
|
|
381
436
|
|
|
382
|
-
**To adopt.** Move `seo` from `createNextCanopyContext({ seo })` and from `defineAIContentConfig({ seo })` into `defineCanopyConfig({ seo })`. See [Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/
|
|
437
|
+
**To adopt.** Move `seo` from `createNextCanopyContext({ seo })` and from `defineAIContentConfig({ seo })` into `defineCanopyConfig({ seo })`. See [Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#sitemap-and-seo-metadata) and [How References Work in the Editor](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#how-references-work-in-the-editor).
|
|
383
438
|
|
|
384
439
|
**Now deletable.** A shared `seo` constant passed separately to the Next context and the AI content config.
|
|
385
440
|
|
|
@@ -407,7 +462,7 @@ resolved without it.
|
|
|
407
462
|
**To adopt.** Where a reference renders its target's prose, set `includeBody: true` on that
|
|
408
463
|
reference field. Code that reads the body from a link-only reference's resolved type now sees
|
|
409
464
|
`string | undefined`; either set `includeBody: true` or handle the missing value. See
|
|
410
|
-
[Resolving References in a Listing](https://github.com/safeinsights/canopycms/blob/
|
|
465
|
+
[Resolving References in a Listing](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#resolving-references-in-a-listing).
|
|
411
466
|
|
|
412
467
|
### 0.3.3
|
|
413
468
|
|
|
@@ -824,7 +879,7 @@ URL.
|
|
|
824
879
|
2. For a branch preview: wrap views with `withCanopyPreview` in a `'use client'` module, add
|
|
825
880
|
`app/preview/[[...path]]/page.server.tsx`, set `editor.previewPrefix: '/preview'`, and serve that
|
|
826
881
|
route with `frame-ancestors 'self'`, not `X-Frame-Options: DENY` (see
|
|
827
|
-
[Live Preview](https://github.com/safeinsights/canopycms/blob/
|
|
882
|
+
[Live Preview](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#live-preview)).
|
|
828
883
|
3. A test reading view content from the route's server HTML must load the page in a browser.
|
|
829
884
|
Server output rendered during a preview request carries the signed-in asset prefix; keep it out
|
|
830
885
|
of cross-request caches (`unstable_cache`, module memos).
|
|
@@ -839,7 +894,7 @@ kept site styles ahead of Mantine's in the preview.
|
|
|
839
894
|
server components. A string path marks the form's spelling (`'a.0.b'` marks `a[0].b`), and an empty
|
|
840
895
|
path marks nothing. The editor counts and logs marks naming no field. `createEntrySchemaRegistry`
|
|
841
896
|
refuses a field name that is empty, all digits or contains `.`, `[` or `]`. See
|
|
842
|
-
[Live Preview](https://github.com/safeinsights/canopycms/blob/
|
|
897
|
+
[Live Preview](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#live-preview).
|
|
843
898
|
|
|
844
899
|
**To adopt.** Fix each path that stops compiling; the error lists valid ones. Rewrite computed paths
|
|
845
900
|
as literal segments, or type that component's prop as plain `FieldProps`. Pass `fieldProps` as
|
|
@@ -921,7 +976,7 @@ or a failed render) renders as its plain text, with no URL; any other form of th
|
|
|
921
976
|
fields are nested or renamed, pass the AI config's `seo` the same object you pass
|
|
922
977
|
`createNextCanopyContext({ seo })`, so the sitemap and AI content read the flag from the same
|
|
923
978
|
place. A field that links to a hidden section by plain URL needs a field transform; the README
|
|
924
|
-
shows [the recipe](https://github.com/safeinsights/canopycms/blob/
|
|
979
|
+
shows [the recipe](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#ai-content-configuration).
|
|
925
980
|
|
|
926
981
|
**Now deletable.** An `exclude.where` that re-read the `noindex` flag by hand.
|
|
927
982
|
|
|
@@ -943,7 +998,7 @@ A `markdown` field with `renderAs: 'mdx'` is checked as MDX, and `mdxAllow` narr
|
|
|
943
998
|
field or site-wide. New: field options `renderAs`, `mdxAllow`; config key `mdxAllow`; type
|
|
944
999
|
`MdxAllowlist`. (int.110) A component prop allowance can be `'string'` (or
|
|
945
1000
|
`{ type: 'string', maxLength }`): a quoted value only, never bare or `{…}`. See
|
|
946
|
-
[MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/
|
|
1001
|
+
[MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#mdx-content-cannot-run-code).
|
|
947
1002
|
|
|
948
1003
|
**To adopt.** Set `renderAs: 'mdx'` on each `markdown` field your site compiles as MDX, and
|
|
949
1004
|
`mdxAllow` to what your renderer takes. Set `executable: true` only on a field whose editors you
|
|
@@ -1080,7 +1135,7 @@ a format check.
|
|
|
1080
1135
|
|
|
1081
1136
|
- (int.93) Submit commits gain an `Edited-by: Name (id)` trailer; PR bodies gain a section that
|
|
1082
1137
|
re-submits replace, keeping human text. Options: `gitEditedByTrailers`, `gitCoAuthoredByTrailers`
|
|
1083
|
-
([reference](https://github.com/safeinsights/canopycms/blob/
|
|
1138
|
+
([reference](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#definecanopyconfig-options)).
|
|
1084
1139
|
- (int.110) Submit-commit trailers name every user who saved since the last submit commit, and
|
|
1085
1140
|
the PR-body section every user who edited the branch, not only the submitter; settings commits
|
|
1086
1141
|
(permissions, groups) carry the acting user's trailer.
|
|
@@ -1104,7 +1159,7 @@ saves only push the branch, and no failing PR task lands in System health.
|
|
|
1104
1159
|
that entry type goes unavailable: the editor says so, and its entries answer 503 with
|
|
1105
1160
|
`code: 'SCHEMA_UNAVAILABLE'`. Builds, static deploys and `generate-ai-content` still fail. The
|
|
1106
1161
|
worker holds the base branch for up to 30 minutes while that lasts; see
|
|
1107
|
-
[New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/
|
|
1162
|
+
[New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#new-schemas-wait-for-the-editor-deploy).
|
|
1108
1163
|
Public types gain optional `unavailable` on `EntryTypeConfig` and `FlatSchemaItem`, optional
|
|
1109
1164
|
`ApiResponse.code`, and a required `SchemaResolutionResult.issues`.
|
|
1110
1165
|
|
|
@@ -1142,7 +1197,7 @@ hang until the drain heartbeat lets termination continue. Its in-flight task is
|
|
|
1142
1197
|
new stack needs no steps.
|
|
1143
1198
|
|
|
1144
1199
|
**What changed.** (int.109) Detailed in
|
|
1145
|
-
[The worker instance](https://github.com/safeinsights/canopycms/blob/
|
|
1200
|
+
[The worker instance](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#the-worker-instance): IMDSv2 with a hop limit of 1; the
|
|
1146
1201
|
bundle is one file whose sha256 user data checks, readable as that one object; a file-system policy
|
|
1147
1202
|
refusing clients without TLS or IAM, replacing the worker's
|
|
1148
1203
|
`AmazonElasticFileSystemClientReadWriteAccess`; an encrypted gp3 root volume; a boot-time upgrade to
|
|
@@ -1196,10 +1251,10 @@ failure and exits non-zero on `selfStopped`, with a code outside `RestartPrevent
|
|
|
1196
1251
|
with its hash, as `worker/dist/index.js` and `index.js.sha256`. The default, `'asset'`, is
|
|
1197
1252
|
unchanged.
|
|
1198
1253
|
- `CanopyCmsService` alarms when the worker logs no git sync for 30 minutes. See
|
|
1199
|
-
[Worker-down alarm](https://github.com/safeinsights/canopycms/blob/
|
|
1254
|
+
[Worker-down alarm](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#worker-down-alarm).
|
|
1200
1255
|
|
|
1201
1256
|
**To adopt.** Optional. For parameter-only change sets, see
|
|
1202
|
-
[Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/
|
|
1257
|
+
[Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#rolling-the-worker-from-ci). For the alarm, pass
|
|
1203
1258
|
`alarmTopic`.
|
|
1204
1259
|
|
|
1205
1260
|
**Now deletable.** A manual `cdk deploy` after each canopycms bump whose only purpose is moving the
|
|
@@ -1210,7 +1265,7 @@ worker, and a hand-built alarm on the worker log group.
|
|
|
1210
1265
|
**What changed.** (int.112) The boot's `dnf upgrade` could be OOM-killed on every retry. A 1 GiB
|
|
1211
1266
|
swap file now goes on first; an upgrade that still fails starts the worker unpatched and notifies
|
|
1212
1267
|
`alarmTopic` if set; a retried step names itself when it gives up. See
|
|
1213
|
-
[The worker instance](https://github.com/safeinsights/canopycms/blob/
|
|
1268
|
+
[The worker instance](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#the-worker-instance).
|
|
1214
1269
|
|
|
1215
1270
|
**To adopt.** Deploy, which replaces the worker instance. The bundle needs none of this, so it is
|
|
1216
1271
|
not Template first and the worker contract stays at 1.
|
|
@@ -1276,7 +1331,7 @@ and operations may reuse GitHub fetches under 30 seconds old.
|
|
|
1276
1331
|
|
|
1277
1332
|
**To adopt.** Nothing. Seeding `remote.git` stages a copy of the repository beside the gateway's
|
|
1278
1333
|
mirror, so the root volume needs room for two
|
|
1279
|
-
([details](https://github.com/safeinsights/canopycms/blob/
|
|
1334
|
+
([details](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#the-worker-instance)).
|
|
1280
1335
|
|
|
1281
1336
|
#### The worker follows a rebased or deleted GitHub branch
|
|
1282
1337
|
|
|
@@ -1298,7 +1353,7 @@ changes the template too (the fallback bundle's key and hash), so only the contr
|
|
|
1298
1353
|
bundle-only roll is safe.
|
|
1299
1354
|
|
|
1300
1355
|
**To adopt.** Parameter mode: gate bundle-only rolls on the contract
|
|
1301
|
-
([recipe](https://github.com/safeinsights/canopycms/blob/
|
|
1356
|
+
([recipe](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#rolling-the-worker-from-ci)). The gate refuses a stack without the
|
|
1302
1357
|
`WorkerContract` output, so `cdk deploy` the template once, which adds it. A hand-installed unit
|
|
1303
1358
|
copies its `Environment=CANOPYCMS_WORKER_CONTRACT=` line from `worker/canopy-worker.service`.
|
|
1304
1359
|
|
|
@@ -1315,8 +1370,8 @@ units from the bundle's contract: 2 gets the split, an older bundle the single u
|
|
|
1315
1370
|
template, then roll the bundle; on an older template it stops with `template too old for this
|
|
1316
1371
|
bundle`. Inspect EFS only through `sudo /opt/canopy-worker/canopy-inspect <command>`, never from a root shell. A hand install
|
|
1317
1372
|
takes `worker/`'s three units and `gateway.env.example`
|
|
1318
|
-
([steps](https://github.com/safeinsights/canopycms/blob/
|
|
1319
|
-
[checklist](https://github.com/safeinsights/canopycms/blob/
|
|
1373
|
+
([steps](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#installing-the-units-by-hand)). After the first deploy, run the
|
|
1374
|
+
[checklist](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#first-deploy-checklist).
|
|
1320
1375
|
|
|
1321
1376
|
#### `canopycms-cdk`: `CanopyCmsService.attachTo`, and editor response headers — **behaviour change if you frame the CMS**
|
|
1322
1377
|
|
|
@@ -1327,7 +1382,7 @@ response headers policy. `CanopyCmsDistribution` sends the same headers: `frame-
|
|
|
1327
1382
|
`X-Frame-Options: SAMEORIGIN`, `nosniff`, HSTS and `X-Robots-Tag: noindex`. Unless your app sends
|
|
1328
1383
|
its own framing headers, no other origin can frame the editor or any page the CMS domain serves. Every such page is
|
|
1329
1384
|
marked `noindex`. The editor's default preview is same-origin and unaffected. See
|
|
1330
|
-
[Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/
|
|
1385
|
+
[Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#serving-the-editor-from-a-distribution-you-already-own).
|
|
1331
1386
|
|
|
1332
1387
|
**To adopt.** If you wired the Function URL into your own distribution by hand, delete those
|
|
1333
1388
|
behaviors and call `attachTo`, passing your CMS build's `assetPrefix` as `editorAssetPrefix` and a
|
|
@@ -1503,7 +1558,7 @@ one the exclusions leave out. A throw or any other return is logged and treated
|
|
|
1503
1558
|
**To adopt.** If your site's routes, sitemap or bylines decide that some entries have no page,
|
|
1504
1559
|
apply the same rule here, for example `referenceLink: (target, { body }) =>
|
|
1505
1560
|
!body?.trim() ? false : undefined` in `defineAIContentConfig` from `canopycms/ai`. See
|
|
1506
|
-
[AI Content Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
1561
|
+
[AI Content Configuration](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#ai-content-configuration).
|
|
1507
1562
|
|
|
1508
1563
|
**Now deletable.** A `fieldTransforms` entry that re-renders a reference field only to drop or
|
|
1509
1564
|
change its link.
|
|
@@ -1578,7 +1633,7 @@ _First in int.115._
|
|
|
1578
1633
|
entry the base branch also changed, the "updated on the base branch" notice and the branch's
|
|
1579
1634
|
conflict count now stay until the branch merges, so a reviewer still sees which entries replaced a
|
|
1580
1635
|
base change. They used to clear on the next sync, about five minutes later. README's new [Drafts
|
|
1581
|
-
and Unpublishing](https://github.com/safeinsights/canopycms/blob/
|
|
1636
|
+
and Unpublishing](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#drafts-and-unpublishing) section covers long-lived branches and
|
|
1582
1637
|
unpublishing.
|
|
1583
1638
|
|
|
1584
1639
|
#### The editor calls the content drawer "All content"
|
|
@@ -1890,7 +1945,7 @@ editor carries an unsaved draft of a stamped entry onto its stamped version.
|
|
|
1890
1945
|
The flag is refused off a top-level `datetime`, on `list: true`, and with `required: true`.
|
|
1891
1946
|
|
|
1892
1947
|
**To adopt.** Add `stampOnPublish: true` to the date field your site sorts or labels by, such as
|
|
1893
|
-
`{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/
|
|
1948
|
+
`{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#stamping-a-publication-date).
|
|
1894
1949
|
|
|
1895
1950
|
**Now deletable.** A build step or hook that writes a missing publication date into new entries.
|
|
1896
1951
|
|
|
@@ -1937,7 +1992,7 @@ preview/form divider is now keyboard-resizable within the same 15–85% the spli
|
|
|
1937
1992
|
stored at, and `react-split-pane` is no longer a dependency.
|
|
1938
1993
|
`EditorPanes`, `EditorPanesProps`, the `PaneLayout` type and the `SPLIT_PERCENT_*` and `DEFAULT_*_SPLIT_PERCENT` constants are
|
|
1939
1994
|
no longer exported from `canopycms/client`. See
|
|
1940
|
-
[Your root layout](https://github.com/safeinsights/canopycms/blob/
|
|
1995
|
+
[Your root layout](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#editor-customization).
|
|
1941
1996
|
|
|
1942
1997
|
**To adopt.** Nothing, unless you import `EditorPanes` or those constants: render `CanopyEditor`
|
|
1943
1998
|
instead, which lays out its own panes. Hiding your site chrome on the editor route is now
|
|
@@ -2048,7 +2103,7 @@ never ended. `canopycms-auth-clerk` skips it while the editor is mounted, and ex
|
|
|
2048
2103
|
**To adopt.** Nothing for the editor, if your edit page uses `useClerkAuthConfig()` or
|
|
2049
2104
|
`ClerkSignIn`. If your CMS build renders `<SignIn>`, `UserButton` or `OrganizationSwitcher` on your
|
|
2050
2105
|
own pages, mount the hook as in
|
|
2051
|
-
[Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/
|
|
2106
|
+
[Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/packages/canopycms-auth-clerk/README.md#clerk-components-on-your-own-pages).
|
|
2052
2107
|
Your own Server Actions in the CMS build still 403 behind OAC.
|
|
2053
2108
|
|
|
2054
2109
|
**Now deletable.** Any local patch of `window.__internal_onBeforeSetActive` (or 6.x's
|
|
@@ -2089,12 +2144,12 @@ fast naming the ARN, the field and the keys present, never a value.
|
|
|
2089
2144
|
**To adopt.** Nothing, unless one of those secrets holds a JSON document: then set the matching
|
|
2090
2145
|
prop. The scaffolded stack fills them from the repository _variables_
|
|
2091
2146
|
`CANOPY_GITHUB_TOKEN_SECRET_JSON_FIELD` and `CLERK_SECRET_KEY_SECRET_JSON_FIELD`
|
|
2092
|
-
([why the prefix](https://github.com/safeinsights/canopycms/blob/
|
|
2147
|
+
([why the prefix](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#repository-secrets-and-variables)); a stack scaffolded earlier
|
|
2093
2148
|
adds the props to `infrastructure/bin/app.ts` and `infrastructure/lib/cms-stack.ts` and the two `env`
|
|
2094
2149
|
lines to `.github/workflows/deploy-cms.yml`, or re-runs the generator and diffs. `cdk synth` refuses a `…JsonField` prop without its `…SecretArn`, and an ARN carrying the ECS `:KEY::` suffix
|
|
2095
2150
|
(also in `secretsArns`). Don't use CDK's `secretValueFromJson`: it resolves the plaintext into the deployed
|
|
2096
2151
|
resource's configuration, readable by anyone who can describe it. Only `CLERK_SECRET_KEY` goes through Secrets Manager; `CLERK_JWT_KEY` and the publishable
|
|
2097
|
-
key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/
|
|
2152
|
+
key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#security-model)).
|
|
2098
2153
|
|
|
2099
2154
|
**Now deletable.** A wrapper that fetches the secret, parses it and re-exports one field into the
|
|
2100
2155
|
worker's environment, such as a `jq` step in user data or a wrapper entrypoint around
|
|
@@ -2106,7 +2161,7 @@ worker's environment, such as a `jq` step in user data or a wrapper entrypoint a
|
|
|
2106
2161
|
`githubToken` is not deprecated and stays the documented default; `canopycms` neither depends on
|
|
2107
2162
|
nor imports `@octokit/auth-app`. Register one App per site, not one shared across repositories:
|
|
2108
2163
|
anyone holding an App's key can mint a token for any of its installations
|
|
2109
|
-
([why](https://github.com/safeinsights/canopycms/blob/
|
|
2164
|
+
([why](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/ARCHITECTURE.md#why-one-github-app-per-site-not-one-shared-across-an-organisation)).
|
|
2110
2165
|
|
|
2111
2166
|
**To adopt with `canopycms-cdk`** (existing stacks need no edit). `CanopyCmsServiceProps` takes
|
|
2112
2167
|
`githubAppId`, `githubAppInstallationId`, `githubAppPrivateKeySecretArn` and
|
|
@@ -2119,7 +2174,7 @@ anyone holding an App's key can mint a token for any of its installations
|
|
|
2119
2174
|
`verify` checks an existing installation's permissions: run it, since an App missing a
|
|
2120
2175
|
permission only shows up later, as `sync-failed`. `create` needs an interactive terminal and
|
|
2121
2176
|
never edits an existing JSON secret (create one and point the JSON-field prop at it)
|
|
2122
|
-
([details](https://github.com/safeinsights/canopycms/blob/
|
|
2177
|
+
([details](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#register-it-with-canopycms-init-github-app)).
|
|
2123
2178
|
2. Set the three props and **remove `githubTokenSecretArn`** (with its JSON field). A partial set
|
|
2124
2179
|
of the three is refused at synth, and so is an App alongside a token.
|
|
2125
2180
|
3. In the generated workflow, store them as `CANOPY_GITHUB_APP_ID`,
|
|
@@ -2130,7 +2185,7 @@ anyone holding an App's key can mint a token for any of its installations
|
|
|
2130
2185
|
|
|
2131
2186
|
The private key is ARN-only; passing the key itself is refused at synth. Its ARN joins the worker's
|
|
2132
2187
|
IAM policy automatically, so you need not add it to `secretsArns`. See
|
|
2133
|
-
[Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/
|
|
2188
|
+
[Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#authenticating-as-a-github-app).
|
|
2134
2189
|
|
|
2135
2190
|
```bash
|
|
2136
2191
|
canopycms init-github-app create -- \
|
|
@@ -2178,7 +2233,7 @@ downloads the `.pem` from the App's settings page.
|
|
|
2178
2233
|
|
|
2179
2234
|
**What changed.** The worker re-reads a Secrets Manager secret (the GitHub token or the Clerk secret
|
|
2180
2235
|
key) when the operation using it fails. Timings, costs and the store-before-revoke order are in
|
|
2181
|
-
[Rotating a secret](https://github.com/safeinsights/canopycms/blob/
|
|
2236
|
+
[Rotating a secret](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#rotating-a-secret).
|
|
2182
2237
|
|
|
2183
2238
|
**To adopt.** Nothing for credentials from `*_SECRET_ARN`, which is every scaffolded deployment. A
|
|
2184
2239
|
GitHub App private key is still read only at boot: store the new key, replace the instance, and
|
|
@@ -2232,12 +2287,12 @@ also check the bucket policy for its grant.
|
|
|
2232
2287
|
5. `withCanopy()` adds sharp's libvips to Next's file tracing (not for a static export) and, on
|
|
2233
2288
|
Next 16 and later, sets `turbopack: {}` when your config has neither `turbopack` nor your own
|
|
2234
2289
|
`webpack` and it can read your Next version. A webpack build still fails its image transforms
|
|
2235
|
-
([Dual Build Support](https://github.com/safeinsights/canopycms/blob/
|
|
2290
|
+
([Dual Build Support](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#dual-build-support)).
|
|
2236
2291
|
|
|
2237
2292
|
**Breaking:** a stack setting `platform` on `fromImageAsset` without `architecture` gets an arm64
|
|
2238
2293
|
function while `platform` still decides the image, so `Platform.LINUX_AMD64` builds an image the
|
|
2239
2294
|
function cannot run. A stack setting neither moves to arm64 with a matching image, built under QEMU
|
|
2240
|
-
on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/
|
|
2295
|
+
on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#where-the-image-is-built)).
|
|
2241
2296
|
|
|
2242
2297
|
**To adopt.**
|
|
2243
2298
|
|
|
@@ -2266,7 +2321,7 @@ reason; `platform` on `fromImageAsset`; and, with `withCanopy()`, a hand-written
|
|
|
2266
2321
|
|
|
2267
2322
|
**What changed.** `media.uploadUrl` (s3 adapter; an absolute http(s) URL or a site-relative path)
|
|
2268
2323
|
replaces the `url` that `beginUpload()` returns, leaving the presign's `fields` untouched, so
|
|
2269
|
-
uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
2324
|
+
uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#media-configuration) for the
|
|
2270
2325
|
CloudFront behavior it expects.
|
|
2271
2326
|
|
|
2272
2327
|
**To adopt.** Optional. Set it from an environment variable: a site-relative value works only where
|
|
@@ -2291,7 +2346,7 @@ needs `lazyPublicTransforms: true`) let you pass a deterministically named role,
|
|
|
2291
2346
|
bucket's stack computes `arn:aws:iam::<account>:role/<name>` from literals instead of a
|
|
2292
2347
|
`Fn::GetStackOutput` reference only the CDK CLI resolves. The constructs re-attach
|
|
2293
2348
|
`AWSLambdaBasicExecutionRole` (and the VPC policy) that `lambda.Function` drops from a role you
|
|
2294
|
-
pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/
|
|
2349
|
+
pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#cross-account-asset-bucket).
|
|
2295
2350
|
|
|
2296
2351
|
**To adopt.** Optional:
|
|
2297
2352
|
|
|
@@ -2401,7 +2456,7 @@ public JWKS PEM, used only to verify signatures.
|
|
|
2401
2456
|
to variables (Settings → Secrets and variables → Actions → Variables); `bin/app.ts` refuses the
|
|
2402
2457
|
deploy at synth while it is unset. Check that `bin/app.ts` passes `CLERK_SECRET_KEY` as
|
|
2403
2458
|
`clerkSecretKeySecretArn` (read by the worker), never in the Lambda's `environment`, unless you keep
|
|
2404
|
-
`clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/
|
|
2459
|
+
`clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/docs/deploying-to-aws.md#security-model)).
|
|
2405
2460
|
|
|
2406
2461
|
#### `readByUrlPath` answers only where `listEntries` publishes — **breaking (routing)**
|
|
2407
2462
|
|
|
@@ -2500,7 +2555,7 @@ basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
|
|
2500
2555
|
Then pass `baseUrl` to `assetUrl` only if Next serves `/assets` (local adapter, `next dev`, S3 with
|
|
2501
2556
|
no distribution): `assetUrl(image, { width: 960, baseUrl: BASE_PATH })`. Assets on CloudFront via
|
|
2502
2557
|
`AssetSupport` stay at the distribution root; pass no `baseUrl` (mount table under "Where `/assets`
|
|
2503
|
-
is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
2558
|
+
is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#media-configuration)). Two traps:
|
|
2504
2559
|
|
|
2505
2560
|
- Don't pass a deployment `basePath` to `contentStaticParams({ basePath })`; that option filters by
|
|
2506
2561
|
a nested route prefix and emits zero params, building green.
|
|
@@ -2659,7 +2714,7 @@ Under `exactOptionalPropertyTypes: true`, omit keys instead of assigning `undefi
|
|
|
2659
2714
|
`withTrailingSlash` and `isAbsoluteUrl` from `canopycms/server`; `defineSeoFieldGroup()` from
|
|
2660
2715
|
`canopycms`; `generateContentSitemap` and `entryToMetadata` from `canopycms-next`, bound on
|
|
2661
2716
|
`createNextCanopyContext`'s result. See
|
|
2662
|
-
[Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/
|
|
2717
|
+
[Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#sitemap-and-seo-metadata). Every routable entry type is in
|
|
2663
2718
|
the sitemap unless `exclude`d or `noindex`; one `noindex` predicate drives both robots metadata and
|
|
2664
2719
|
sitemap exclusion. `trailingSlash` is never inferred. `lastModified` defaults to `updatedAt`, a
|
|
2665
2720
|
filesystem mtime. An empty SEO field counts as unset. `siteUrl` must be absolute, colliding URLs are
|
|
@@ -2716,7 +2771,7 @@ underscore-prefixed files are skipped.
|
|
|
2716
2771
|
|
|
2717
2772
|
**What changed.** New scaffolds write `defaultBranchAccess: 'deny'` and
|
|
2718
2773
|
`defaultPathAccess: { read: 'allow' }`
|
|
2719
|
-
([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/
|
|
2774
|
+
([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#public-read-on-server-deployments)).
|
|
2720
2775
|
|
|
2721
2776
|
**To adopt.** An older scaffold's `defaultBranchAccess: 'allow'` is wider than recommended;
|
|
2722
2777
|
consider `'deny'`. If you deleted `defaultPathAccess: { read: 'allow' }`, anonymous visitors get no content until you
|
|
@@ -2769,7 +2824,7 @@ re-checked an entry's type (a `switch` on `meta.entryType` can merge them into o
|
|
|
2769
2824
|
**What changed.** `BlockComponentRegistry<Blocks>` (types only, from `canopycms`; `BlockValueOf<Blocks, 'hero'>`
|
|
2770
2825
|
gives one template's value type) requires exactly
|
|
2771
2826
|
one component per block template name when written as an object literal. See
|
|
2772
|
-
[Block Component Registries](https://github.com/safeinsights/canopycms/blob/
|
|
2827
|
+
[Block Component Registries](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#block-component-registries) and
|
|
2773
2828
|
`apps/example1/app/components/PostView.tsx`.
|
|
2774
2829
|
|
|
2775
2830
|
```ts
|
|
@@ -2791,7 +2846,7 @@ templates against the schema.
|
|
|
2791
2846
|
|
|
2792
2847
|
**What changed.** Spreading a `const` field array into several schemas, and nesting
|
|
2793
2848
|
`defineInlineFieldGroup()` inside a block template, are documented
|
|
2794
|
-
([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/
|
|
2849
|
+
([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#reusable-field-fragments)); `defineFieldFragment()` is an
|
|
2795
2850
|
identity helper for them.
|
|
2796
2851
|
|
|
2797
2852
|
```ts
|
|
@@ -2810,7 +2865,7 @@ field by composing from the same `const` field object.
|
|
|
2810
2865
|
A block template holding a `reference` field is a shared block; `read()`/`readByUrlPath()` resolve
|
|
2811
2866
|
it, and listings do with
|
|
2812
2867
|
[`resolveReferences`](#listings-resolve-references-and-a-resolved-reference-carries-urlpath-and-optionally-its-body-16--breaking-type-level)
|
|
2813
|
-
(0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/
|
|
2868
|
+
(0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#shared--referenced-blocks).
|
|
2814
2869
|
|
|
2815
2870
|
**Now deletable.** A second `read()` in page code to unwrap a shared block's reference.
|
|
2816
2871
|
|
|
@@ -2832,7 +2887,7 @@ Not retro-documented, apart from these:
|
|
|
2832
2887
|
|
|
2833
2888
|
#### The registry is keyed by entry-type name (0.0.42)
|
|
2834
2889
|
|
|
2835
|
-
**What changed.** `createEntrySchemaRegistry` keys are the entry-type names that `.collection.json` files name in `entry.schema`, and `EntryTypesFromRegistry` derives the typed entry-type map from them. Schema-variable keys (`{ postSchema }`) still work but derive nothing; [README's registry convention](https://github.com/safeinsights/canopycms/blob/
|
|
2890
|
+
**What changed.** `createEntrySchemaRegistry` keys are the entry-type names that `.collection.json` files name in `entry.schema`, and `EntryTypesFromRegistry` derives the typed entry-type map from them. Schema-variable keys (`{ postSchema }`) still work but derive nothing; [README's registry convention](https://github.com/safeinsights/canopycms/blob/74c756559271d91a988cf1ce2d250720062efd59/README.md#convention-why-key-the-registry-by-entry-type-name) says when to keep them.
|
|
2836
2891
|
|
|
2837
2892
|
**To adopt.**
|
|
2838
2893
|
|
|
@@ -75,6 +75,10 @@ interface RepairedContentDuplicate {
|
|
|
75
75
|
interface RepairContentDuplicatesData {
|
|
76
76
|
resolved: RepairedContentDuplicate[];
|
|
77
77
|
}
|
|
78
|
+
/** Response type for POST /admin/branch-dirs/:dirName/dismiss-unpublished */
|
|
79
|
+
export type DismissUnpublishedResponse = ApiResponse<{
|
|
80
|
+
dismissed: true;
|
|
81
|
+
}>;
|
|
78
82
|
/** Response type for POST /admin/branch-dirs/:dirName/repair-content-duplicates */
|
|
79
83
|
export type RepairContentDuplicatesResponse = ApiResponse<RepairContentDuplicatesData>;
|
|
80
84
|
/**
|
|
@@ -110,5 +114,12 @@ export declare const ADMIN_BRANCH_HEALTH_ROUTES: {
|
|
|
110
114
|
}, {
|
|
111
115
|
dirName: string;
|
|
112
116
|
}>, undefined, RepairContentDuplicatesResponse>;
|
|
117
|
+
readonly dismissUnpublished: import("./route-builder.js").RouteDefinition<z.ZodObject<{
|
|
118
|
+
dirName: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
dirName: string;
|
|
121
|
+
}, {
|
|
122
|
+
dirName: string;
|
|
123
|
+
}>, undefined, DismissUnpublishedResponse>;
|
|
113
124
|
};
|
|
114
125
|
export {};
|
|
@@ -607,6 +607,41 @@ const repairBranchDir = defineEndpoint({
|
|
|
607
607
|
guards: ['admin'],
|
|
608
608
|
handler: repairBranchDirHandler,
|
|
609
609
|
});
|
|
610
|
+
/**
|
|
611
|
+
* Stop listing a branch merged with an unfinished submit. Bookkeeping, so it leaves `updatedAt`.
|
|
612
|
+
* The same stat guard as purge: the update's lock would otherwise create the directory.
|
|
613
|
+
*/
|
|
614
|
+
const dismissUnpublishedHandler = async (_gc, ctx, _req, params) => {
|
|
615
|
+
const baseRoot = getDefaultBranchBase(ctx.services.config.mode);
|
|
616
|
+
const dirPath = resolveDirWithinBase(baseRoot, params.dirName);
|
|
617
|
+
if (!dirPath) {
|
|
618
|
+
return { ok: false, status: 400, error: 'Invalid directory name' };
|
|
619
|
+
}
|
|
620
|
+
const dirExists = await fs
|
|
621
|
+
.stat(dirPath)
|
|
622
|
+
.then(() => true)
|
|
623
|
+
.catch(() => false);
|
|
624
|
+
if (!dirExists) {
|
|
625
|
+
return { ok: false, status: 404, error: 'Directory not found' };
|
|
626
|
+
}
|
|
627
|
+
const saved = await getBranchMetadataFileManager(dirPath, baseRoot).update((current) => current?.branch.unpublishedAtMerge ? { branch: { unpublishedAtMerge: undefined } } : null, { keepUpdatedAt: true });
|
|
628
|
+
if (saved === null) {
|
|
629
|
+
return { ok: false, status: 409, error: 'This warning was already dismissed.' };
|
|
630
|
+
}
|
|
631
|
+
return { ok: true, status: 200, data: { dismissed: true } };
|
|
632
|
+
};
|
|
633
|
+
const dismissUnpublished = defineEndpoint({
|
|
634
|
+
namespace: 'admin',
|
|
635
|
+
name: 'dismissUnpublished',
|
|
636
|
+
method: 'POST',
|
|
637
|
+
path: '/admin/branch-dirs/:dirName/dismiss-unpublished',
|
|
638
|
+
params: branchDirParamsSchema,
|
|
639
|
+
responseType: 'DismissUnpublishedResponse',
|
|
640
|
+
response: {},
|
|
641
|
+
defaultMockData: { dismissed: true },
|
|
642
|
+
guards: ['admin'],
|
|
643
|
+
handler: dismissUnpublishedHandler,
|
|
644
|
+
});
|
|
610
645
|
/**
|
|
611
646
|
* Repair duplicate content IDs in a healthy branch's content tree by
|
|
612
647
|
* archiving the quarantined (losing) file(s) with a dot-prefixed name --
|
|
@@ -643,4 +678,5 @@ export const ADMIN_BRANCH_HEALTH_ROUTES = {
|
|
|
643
678
|
purgeBranchDir,
|
|
644
679
|
repairBranchDir,
|
|
645
680
|
repairContentDuplicates,
|
|
681
|
+
dismissUnpublished,
|
|
646
682
|
};
|
package/dist/api/admin.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { Task, QueueStats, CorruptTaskFile } from '../task-queue/cms-task-q
|
|
|
11
11
|
import type { BuildIdentity, WorkerStatusReport } from '../types.js';
|
|
12
12
|
import { type OperatingMode } from '../operating-mode/index.js';
|
|
13
13
|
import type { SchemaIssue } from '../schema/types.js';
|
|
14
|
-
export type { BranchHealthResponse, PurgeBranchDirResponse, RepairBranchDirResponse, RepairContentDuplicatesResponse, } from './admin-branch-health.js';
|
|
14
|
+
export type { BranchHealthResponse, DismissUnpublishedResponse, PurgeBranchDirResponse, RepairBranchDirResponse, RepairContentDuplicatesResponse, } from './admin-branch-health.js';
|
|
15
15
|
type WorkerLivenessState = 'alive' | 'stale' | 'absent';
|
|
16
16
|
export interface WorkerLiveness {
|
|
17
17
|
/**
|
|
@@ -145,6 +145,13 @@ export declare const ADMIN_ROUTES: {
|
|
|
145
145
|
}, {
|
|
146
146
|
dirName: string;
|
|
147
147
|
}>, undefined, import("./admin-branch-health.js").RepairContentDuplicatesResponse>;
|
|
148
|
+
readonly dismissUnpublished: import("./route-builder.js").RouteDefinition<z.ZodObject<{
|
|
149
|
+
dirName: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
150
|
+
}, "strip", z.ZodTypeAny, {
|
|
151
|
+
dirName: string;
|
|
152
|
+
}, {
|
|
153
|
+
dirName: string;
|
|
154
|
+
}>, undefined, import("./admin-branch-health.js").DismissUnpublishedResponse>;
|
|
148
155
|
readonly status: import("./route-builder.js").RouteDefinition<undefined, undefined, AdminStatusResponse>;
|
|
149
156
|
readonly listTasks: import("./route-builder.js").RouteDefinition<z.ZodObject<{
|
|
150
157
|
status: z.ZodEnum<["pending", "processing", "completed", "failed", "corrupt"]>;
|
package/dist/api/branch-merge.js
CHANGED
|
@@ -45,7 +45,7 @@ const markAsMergedHandler = async (gc, ctx, _req, params) => {
|
|
|
45
45
|
}
|
|
46
46
|
// Update branch status to 'archived'
|
|
47
47
|
const meta = getBranchMetadataFileManager(branchContext.branchRoot, branchContext.baseRoot);
|
|
48
|
-
await meta.
|
|
48
|
+
await meta.update((current) => current === null ? null : { branch: buildMergedBranchUpdate(current.branch) });
|
|
49
49
|
// Optionally delete remote branch (disabled by default for safety)
|
|
50
50
|
// if (ctx.services.githubService && req.body?.deleteRemoteBranch) {
|
|
51
51
|
// try {
|
|
@@ -8,7 +8,7 @@ import { syncPrComments } from './pr-comment-sync.js';
|
|
|
8
8
|
import { CommentStore } from '../comment-store.js';
|
|
9
9
|
import { getErrorMessage } from '../utils/error.js';
|
|
10
10
|
import { REQUEST_CHANGES_NOTE_MAX_LENGTH } from '../authorization/review-role.js';
|
|
11
|
-
import { getBranchProtection } from '../authorization/index.js';
|
|
11
|
+
import { getBranchProtection, isAdmin } from '../authorization/index.js';
|
|
12
12
|
import { sanitizeDisplayName } from '../submission-attribution.js';
|
|
13
13
|
/** Optional on the wire: a bodiless request means no note. */
|
|
14
14
|
const requestChangesBodySchema = z
|
|
@@ -130,8 +130,11 @@ const approveBranchHandler = async (gc, ctx, req, _params) => {
|
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
const meta = getBranchMetadataFileManager(branchContext.branchRoot, branchContext.baseRoot);
|
|
133
|
-
// As for request changes, the status on disk decides, in the step that writes.
|
|
133
|
+
// As for request changes, the status on disk decides, in the step that writes. So does an
|
|
134
|
+
// unfinished submit: what's approved may not be what the pull request holds.
|
|
134
135
|
let found;
|
|
136
|
+
let unfinished = false;
|
|
137
|
+
let notQueued = false;
|
|
135
138
|
const updated = await meta.saveIf({
|
|
136
139
|
branch: {
|
|
137
140
|
name: branchContext.branch.name,
|
|
@@ -140,8 +143,22 @@ const approveBranchHandler = async (gc, ctx, req, _params) => {
|
|
|
140
143
|
},
|
|
141
144
|
}, (existing) => {
|
|
142
145
|
found = existing?.branch.status;
|
|
143
|
-
|
|
146
|
+
unfinished = existing?.branch.submitUnfinished === true;
|
|
147
|
+
notQueued = existing?.branch.submitNotQueued === true;
|
|
148
|
+
return found === 'submitted' && !unfinished;
|
|
144
149
|
});
|
|
150
|
+
if (unfinished && found === 'submitted') {
|
|
151
|
+
return {
|
|
152
|
+
ok: false,
|
|
153
|
+
status: 409,
|
|
154
|
+
error: "This branch's last submit didn't finish, so it can't be approved until it does. " +
|
|
155
|
+
(notQueued
|
|
156
|
+
? 'Use "Request changes" to send it back to its editor.'
|
|
157
|
+
: isAdmin(req.user.groups)
|
|
158
|
+
? 'Retry the submit from the "Tasks" tab in "System health".'
|
|
159
|
+
: 'Ask an admin to retry the submit.'),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
145
162
|
if (!updated)
|
|
146
163
|
return approveConflict(found);
|
|
147
164
|
// Against the branch the save returned, as for request changes. Best-effort: syncPrComments
|