@rathnasgala2/adapter-github-pages 0.1.0 → 0.1.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 +87 -0
- package/LICENSE +201 -0
- package/README.md +68 -10
- package/package.json +32 -12
- package/src/artifact-projection.js +12 -5
- package/src/capability.js +14 -3
- package/src/carrier.js +77 -33
- package/src/constants.js +7 -3
- package/src/deployment.js +61 -56
- package/src/errors.js +32 -0
- package/src/index.js +592 -66
- package/src/marker.js +4 -2
- package/src/oidc.js +97 -8
- package/src/public-read.js +107 -10
- package/src/recovery.js +6 -4
- package/src/redaction.js +8 -4
- package/src/request-catalog.js +7 -4
- package/src/rest.js +63 -24
- package/src/store.js +2 -1
- package/types/artifact-projection.d.ts +48 -0
- package/types/capability.d.ts +23 -0
- package/types/carrier.d.ts +49 -0
- package/types/constants.d.ts +86 -0
- package/types/deployment.d.ts +107 -0
- package/types/errors.d.ts +28 -0
- package/types/index.d.ts +316 -0
- package/types/marker.d.ts +26 -0
- package/types/oidc.d.ts +108 -0
- package/types/public-read.d.ts +37 -0
- package/types/recovery.d.ts +175 -0
- package/types/redaction.d.ts +38 -0
- package/types/request-catalog.d.ts +106 -0
- package/types/rest.d.ts +159 -0
- package/types/store.d.ts +66 -0
- package/src/index.d.ts +0 -246
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,93 @@ and this project adheres to
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.1.2] - 2026-10-23
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `destination.verificationBaseUrl` (optional, https): the origin that is
|
|
16
|
+
serving right now. Every public read used for verification (marker reads,
|
|
17
|
+
`inspectDestination`, `preflight`, `activate`'s fence read, `observe` and the
|
|
18
|
+
route reads) uses it when present and `publicBaseUrl` otherwise, joined the
|
|
19
|
+
same way. A redirect there is still `PAGES_PUBLIC_REDIRECT`.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- `observe` no longer reports a freshly activated generation as unverified
|
|
24
|
+
because the Pages CDN still serves the previous one. GitHub Pages serves
|
|
25
|
+
`cache-control: max-age=600` and its CDN ignores query strings and request
|
|
26
|
+
cache headers, so cache-busting is impossible. `observe` now re-observes the
|
|
27
|
+
marker and every staged route with a backoff (5 s doubling to 30 s) until the
|
|
28
|
+
marker and the artifact digest match, for at most the served `max-age`
|
|
29
|
+
(default 600 s, capped at 900 s) plus a 60 s margin, and then reports the last
|
|
30
|
+
observation's findings. A redirect (`PAGES_PUBLIC_REDIRECT`) and a generation
|
|
31
|
+
this run never staged still fail at once without waiting. The destination
|
|
32
|
+
accepts an optional `now` clock beside `sleep` for tests.
|
|
33
|
+
|
|
34
|
+
The waiting is bounded in requests too. The first pass reads the marker and
|
|
35
|
+
every staged route. Later passes re-read the marker only until it matches,
|
|
36
|
+
plus a rotating sample of at most 20 still-unmatched routes; once the marker
|
|
37
|
+
and the sample match, the remaining unmatched routes are read in the same
|
|
38
|
+
pass. Routes that matched are kept, and a site of 50 routes or fewer re-reads
|
|
39
|
+
what matched in earlier passes once more before reporting success. The digest
|
|
40
|
+
is computed over the whole coherent set. The request count is about passes x
|
|
41
|
+
(20 + 1) + 2 x routes; there is no request cap that can end the wait early.
|
|
42
|
+
Transient transport errors (ECONNRESET, ETIMEDOUT, ECONNREFUSED, EPIPE,
|
|
43
|
+
EAI_AGAIN, the undici socket and timeout codes, TimeoutError) are retried
|
|
44
|
+
within the deadline and reported as findings (`verified: false`) if they
|
|
45
|
+
persist, and the same code on three consecutive passes stops the wait.
|
|
46
|
+
Name-resolution, certificate and TLS errors, a body over the ceiling and
|
|
47
|
+
programming errors still throw at once. The declared `managedExecutionBudget`
|
|
48
|
+
stays at the schema maximum of 1500 seconds, below the true worst case (1500 s
|
|
49
|
+
activation poll plus up to 960 s of observe waiting).
|
|
50
|
+
|
|
51
|
+
- A redirecting public origin no longer throws out of the lifecycle. A site
|
|
52
|
+
whose repository still carried the `github.io` base after moving to a custom
|
|
53
|
+
domain made the public read's `redirect: 'error'` fetch throw (production
|
|
54
|
+
incident 2026-10-21), so the run died without a journal. `readPublic` now
|
|
55
|
+
returns `{status: 'redirect', toHost, location}` (the `Location` is read with
|
|
56
|
+
one extra credential-free `redirect: 'manual'` request, still followed
|
|
57
|
+
nowhere, bounded to ten seconds, body cancelled, http(s) targets only, and
|
|
58
|
+
only undici's exact refused-redirect error counts); `inspectDestination` and
|
|
59
|
+
`observe` carry `failure: {code: 'PAGES_PUBLIC_REDIRECT', toHost, location}`
|
|
60
|
+
and a `PAGES_PUBLIC_REDIRECT:` finding, and `preflight` refuses with it.
|
|
61
|
+
- Accept GitHub's `deployment_queued` Pages deployment status as temporary (keep
|
|
62
|
+
polling). It is in GitHub's REST reference but was missing from the accepted
|
|
63
|
+
vocabulary, so a real publish on 2026-10-06 stopped with
|
|
64
|
+
`PAGES_DEPLOYMENT_STATUS_UNKNOWN` and held the destination fence.
|
|
65
|
+
|
|
66
|
+
## [0.1.1] - 2026-09-26
|
|
67
|
+
|
|
68
|
+
### Added
|
|
69
|
+
|
|
70
|
+
- **PUB-L1:** `REDACTION_PLACEHOLDER` now comes from
|
|
71
|
+
`@rathnasgala2/adapter-protocol`, the one redaction sentinel every package
|
|
72
|
+
uses, instead of this package's own `'[redacted]'` literal. The value changes
|
|
73
|
+
from `'[redacted]'` to `'[REDACTED]'`; this constant is internal and was not
|
|
74
|
+
part of the published root export.
|
|
75
|
+
- **PUB-M11:** the manifest declares `"sideEffects": false`, so a bundler can
|
|
76
|
+
tree-shake an unused re-export from this package's barrel entry point instead
|
|
77
|
+
of conservatively retaining the whole thing.
|
|
78
|
+
- **PUB-L5:** `verifyPagesOidcToken` now checks the token's `exp`, `iat` and
|
|
79
|
+
(when present) `nbf` claims, each within a new `PAGES_OIDC_CLOCK_SKEW_SECONDS`
|
|
80
|
+
(300s) tolerance, raising `PAGES_OIDC_TOKEN_EXPIRED` or
|
|
81
|
+
`PAGES_OIDC_TOKEN_NOT_YET_VALID`. This is a belt-and-braces check: GitHub
|
|
82
|
+
Pages remains the authoritative relying party for token staleness (this
|
|
83
|
+
module's own trust-boundary documentation is unchanged), but failing here
|
|
84
|
+
first costs nothing and produces a far clearer diagnostic than a Pages-side
|
|
85
|
+
rejection.
|
|
86
|
+
- **PUB-M5:** `computeArtifactDigest` (marker-coordinate exclusion aside) now
|
|
87
|
+
delegates to `@rathnasgala2/adapter-protocol`'s implementation of the same
|
|
88
|
+
name instead of restating the `GALA-ARTIFACT-V2 ` formula locally.
|
|
89
|
+
- **PUB-H6:** every refusal this package raises is now a typed
|
|
90
|
+
`PagesAdapterError` (`src/errors.js`, exported from the package root) carrying
|
|
91
|
+
a stable `code` property (e.g.
|
|
92
|
+
`error.code === 'PAGES_OIDC_SUBJECT_MISMATCH'`), instead of a bare `Error` a
|
|
93
|
+
caller had to parse `CODE: detail` out of. `.message` is unchanged, so this is
|
|
94
|
+
additive, not breaking.
|
|
95
|
+
|
|
96
|
+
## [0.1.0] - 2026-09-22
|
|
97
|
+
|
|
11
98
|
### Changed
|
|
12
99
|
|
|
13
100
|
- **PUBLISH-S4-6a — `ADAPTER_VERSION` is the installed package version.**
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@ declares exactly the DEC-097 section 7 `github-pages` capability row.
|
|
|
6
6
|
|
|
7
7
|
## What it does
|
|
8
8
|
|
|
9
|
-
1. **stage** builds one deterministic
|
|
10
|
-
frozen artifact plus the reserved public generation marker, and
|
|
11
|
-
the caller-supplied Actions-artifact publisher. Nothing public
|
|
12
|
-
`staging: private` is literal.
|
|
9
|
+
1. **stage** builds one deterministic uncompressed POSIX.1-1988 ustar carrier
|
|
10
|
+
from the frozen artifact plus the reserved public generation marker, and
|
|
11
|
+
hands it to the caller-supplied Actions-artifact publisher. Nothing public
|
|
12
|
+
changes: `staging: private` is literal.
|
|
13
13
|
2. **activate** re-reads the served generation, checks the mandatory activation
|
|
14
14
|
fence, re-derives the artifact digest from the carrier bytes that will
|
|
15
15
|
actually be deployed, verifies the caller-supplied Pages OIDC token's
|
|
@@ -49,6 +49,9 @@ them as the weakest true claim rather than hiding them:
|
|
|
49
49
|
- it never mints a `pagesReconciliationRecovery` record, a run-attempt gap proof
|
|
50
50
|
or a tombstone: it validates the server-minted record and refuses a malformed
|
|
51
51
|
one;
|
|
52
|
+
- it never follows a redirect from the public origin and never serves or
|
|
53
|
+
configures a custom domain (`configuration.customDomains: false`): a redirect
|
|
54
|
+
is reported, not followed (see "A redirecting public origin");
|
|
52
55
|
- it declares `providerInventoryAssurance: none` and never claims complete
|
|
53
56
|
deployed inventory; and
|
|
54
57
|
- it declares `cacheInvalidation: none` and has no purge authority.
|
|
@@ -158,11 +161,12 @@ separately, so the deploy script can run it before `stage` uploads a carrier.
|
|
|
158
161
|
|
|
159
162
|
## The exact status vocabulary and poll schedule
|
|
160
163
|
|
|
161
|
-
The
|
|
162
|
-
`deployment_attempt_error` temporary
|
|
163
|
-
and the exact `5, 8, 12, 18, 27, 30`-then-`30`
|
|
164
|
-
`src/constants.js` and are asserted in
|
|
165
|
-
malformed or ambiguous status can never
|
|
164
|
+
The twelve accepted statuses, their temporary/terminal partition (with
|
|
165
|
+
`deployment_queued` and `deployment_attempt_error` temporary; the latter because
|
|
166
|
+
GitHub retries it automatically) and the exact `5, 8, 12, 18, 27, 30`-then-`30`
|
|
167
|
+
poll schedule live in `src/constants.js` and are asserted in
|
|
168
|
+
`test/index.test.js`. An unknown, malformed or ambiguous status can never
|
|
169
|
+
release the destination fence.
|
|
166
170
|
|
|
167
171
|
## Destination shape
|
|
168
172
|
|
|
@@ -173,7 +177,8 @@ malformed or ambiguous status can never release the destination fence.
|
|
|
173
177
|
repositoryId,
|
|
174
178
|
repositoryOwnerId,
|
|
175
179
|
apiOrigin, // https origin; defaults to https://api.github.com
|
|
176
|
-
publicBaseUrl, // https
|
|
180
|
+
publicBaseUrl, // https base the artifact was built for
|
|
181
|
+
verificationBaseUrl, // optional https base serving right now; verification reads use it
|
|
177
182
|
token, // caller-supplied installation token
|
|
178
183
|
oidcToken, // caller-supplied Pages OIDC JWT (or pass per-activate)
|
|
179
184
|
oidcClaims, // its expected ref/sha/run/job_workflow bindings
|
|
@@ -194,6 +199,59 @@ untars the carrier this adapter produced, and serves the result from a separate
|
|
|
194
199
|
public origin. `test/carrier.test.js` holds the codec goldens. What none of that
|
|
195
200
|
can prove is the live GitHub Pages deployment API itself; that is backlog W4-16.
|
|
196
201
|
|
|
202
|
+
## The origin the public reads go to
|
|
203
|
+
|
|
204
|
+
The artifact is built for `publicBaseUrl` (the publication's canonical base),
|
|
205
|
+
but the origin that answers over HTTPS right now can differ: the `github.io`
|
|
206
|
+
project path before the Pages CNAME is set, the custom base once the custom
|
|
207
|
+
domain serves. A destination may name it as `verificationBaseUrl`; every public
|
|
208
|
+
read used for verification (the marker read behind `inspectDestination`,
|
|
209
|
+
`preflight`, `activate`'s fence read and `observe`, and the route reads) uses it
|
|
210
|
+
when present and `publicBaseUrl` otherwise. Artifact-relative paths are joined
|
|
211
|
+
to either the same way, so the marker of an artifact built for a root base is
|
|
212
|
+
found at `<project path>/.well-known/gala-generation.json` while the project
|
|
213
|
+
path serves. It must be an https URL. A redirect at the verification origin is
|
|
214
|
+
still `PAGES_PUBLIC_REDIRECT`.
|
|
215
|
+
|
|
216
|
+
## A redirecting public origin
|
|
217
|
+
|
|
218
|
+
The adapter declares `customDomains: false`, but a site's `publicBaseUrl` can
|
|
219
|
+
still name a host the site has moved away from (a custom domain attached to the
|
|
220
|
+
Pages site while the repository keeps the `github.io` base), and the origin then
|
|
221
|
+
answers `301`/`302`/`307`/`308`. The public reads keep `redirect: 'error'` and
|
|
222
|
+
follow nothing; a redirect is classified instead of thrown:
|
|
223
|
+
|
|
224
|
+
- `readPublic` returns `{status: 'redirect', toHost, location}`. A refused
|
|
225
|
+
redirect exposes no `Location`, so the same credential-free URL is asked once
|
|
226
|
+
more with `redirect: 'manual'` to read it (still followed nowhere); `toHost`
|
|
227
|
+
and `location` are `null` when none could be read, when the probe takes more
|
|
228
|
+
than ten seconds, or when `Location` is not an http(s) URL; the probe's body
|
|
229
|
+
is cancelled unread. Only undici's exact refused-redirect failure (`TypeError`
|
|
230
|
+
whose cause is `unexpected redirect`) is a redirect; any other fetch error
|
|
231
|
+
still throws.
|
|
232
|
+
- `inspectDestination` and `observe` report the generation as unknown (never a
|
|
233
|
+
throw), add a finding that starts `PAGES_PUBLIC_REDIRECT:` and carry
|
|
234
|
+
`failure: {code: 'PAGES_PUBLIC_REDIRECT', toHost, location}`. `preflight`
|
|
235
|
+
refuses with the same finding, so the kernel stops before staging.
|
|
236
|
+
- The remedy is the base URL: set it to the redirect target and publish again.
|
|
237
|
+
|
|
238
|
+
This is a result, not a `PagesAdapterError`: a redirecting origin is a
|
|
239
|
+
destination fact the kernel journals, not an adapter defect.
|
|
240
|
+
|
|
241
|
+
## Errors
|
|
242
|
+
|
|
243
|
+
Every refusal this package raises is a `PagesAdapterError` (`src/errors.js`,
|
|
244
|
+
exported from the package root), never a bare `Error`: it carries a stable,
|
|
245
|
+
machine-readable `code` property alongside the ordinary `Error` message, so a
|
|
246
|
+
caller can write `error.code === 'PAGES_OIDC_SUBJECT_MISMATCH'` instead of
|
|
247
|
+
parsing `.message`. `.message` is `${code}: ${detail}`, so a caller matching a
|
|
248
|
+
code inside the message still works. The code vocabulary is closed and stable:
|
|
249
|
+
`grep -rn "new PagesAdapterError(" src` lists every code this package can raise,
|
|
250
|
+
grouped by the module that raises it (OIDC verification, the REST catalog, the
|
|
251
|
+
request catalog, carrier/capability construction, recovery). A new code is an
|
|
252
|
+
additive change; renaming or removing one is breaking and belongs in
|
|
253
|
+
`CHANGELOG.md`.
|
|
254
|
+
|
|
197
255
|
## Commands
|
|
198
256
|
|
|
199
257
|
```sh
|
package/package.json
CHANGED
|
@@ -1,39 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rathnasgala2/adapter-github-pages",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Managed GitHub Pages deployment adapter: deterministic
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Managed GitHub Pages deployment adapter: deterministic uncompressed ustar Pages carrier, raw Pages deployment REST catalog, bounded status polling and credential-free public verification.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
7
8
|
"engines": {
|
|
8
|
-
"node": "24.
|
|
9
|
-
"npm": "11.16.0"
|
|
9
|
+
"node": ">=24.0.0"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
"types": "./
|
|
13
|
+
"types": "./types/index.d.ts",
|
|
14
14
|
"import": "./src/index.js"
|
|
15
15
|
},
|
|
16
16
|
"./package.json": "./package.json"
|
|
17
17
|
},
|
|
18
|
-
"types": "./
|
|
18
|
+
"types": "./types/index.d.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"src/",
|
|
21
|
+
"types/",
|
|
21
22
|
"README.md",
|
|
22
23
|
"CHANGELOG.md",
|
|
23
24
|
"LICENSE"
|
|
24
25
|
],
|
|
25
26
|
"scripts": {
|
|
26
27
|
"typecheck": "tsc -p tsconfig.json",
|
|
27
|
-
"test": "node --test"
|
|
28
|
+
"test": "node --test",
|
|
29
|
+
"declarations:generate": "tsc -p tsconfig.declarations.json",
|
|
30
|
+
"declarations:check": "node ../../scripts/check-declarations.mjs adapter-github-pages"
|
|
28
31
|
},
|
|
29
32
|
"publishConfig": {
|
|
30
|
-
"access": "public"
|
|
33
|
+
"access": "public",
|
|
34
|
+
"provenance": true
|
|
31
35
|
},
|
|
32
36
|
"dependencies": {
|
|
33
|
-
"@rathnasgala2/adapter-protocol": "0.2.
|
|
34
|
-
"@rathnasgala2/schemas": "
|
|
37
|
+
"@rathnasgala2/adapter-protocol": "^0.2.1",
|
|
38
|
+
"@rathnasgala2/schemas": "3.8.0"
|
|
35
39
|
},
|
|
36
40
|
"devDependencies": {
|
|
37
|
-
"@rathnasgala2/adapter-conformance-kit": "0.1.
|
|
38
|
-
}
|
|
41
|
+
"@rathnasgala2/adapter-conformance-kit": "0.1.1"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/rathnasgala2/publish.git",
|
|
46
|
+
"directory": "packages/adapter-github-pages"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/rathnasgala2/publish/tree/main/packages/adapter-github-pages#readme",
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/rathnasgala2/publish/issues"
|
|
51
|
+
},
|
|
52
|
+
"keywords": [
|
|
53
|
+
"gala",
|
|
54
|
+
"galascribe",
|
|
55
|
+
"publish",
|
|
56
|
+
"adapter",
|
|
57
|
+
"github-pages"
|
|
58
|
+
]
|
|
39
59
|
}
|
|
@@ -15,7 +15,11 @@
|
|
|
15
15
|
* @module
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
computeArtifactDigest as computeArtifactDigestFromFiles,
|
|
20
|
+
domainDigest,
|
|
21
|
+
sha256Hex,
|
|
22
|
+
} from '@rathnasgala2/adapter-protocol';
|
|
19
23
|
|
|
20
24
|
import { DOMAIN_ARTIFACT, GENERATION_MARKER_PATH } from './constants.js';
|
|
21
25
|
|
|
@@ -66,13 +70,16 @@ export function digestEntries(entries) {
|
|
|
66
70
|
* composition root, or a conformance fixture) can pass `stage` a truthful
|
|
67
71
|
* `artifactDigest` without restating the projection.
|
|
68
72
|
*
|
|
73
|
+
* PUB-M5: excluding the marker is this package's own contribution; the
|
|
74
|
+
* digest formula itself delegates to `@rathnasgala2/adapter-protocol`'s
|
|
75
|
+
* `computeArtifactDigest`, the single implementation every S2 destination
|
|
76
|
+
* adapter verifies against.
|
|
77
|
+
*
|
|
69
78
|
* @param {readonly Readonly<{path: string, bytes: Buffer}>[]} files the file set
|
|
70
79
|
* @returns {string} the artifact digest
|
|
71
80
|
*/
|
|
72
81
|
export function computeArtifactDigest(files) {
|
|
73
|
-
return
|
|
74
|
-
files
|
|
75
|
-
.filter((file) => file.path !== GENERATION_MARKER_PATH)
|
|
76
|
-
.map((file) => projectEntry(file.path, file.bytes)),
|
|
82
|
+
return computeArtifactDigestFromFiles(
|
|
83
|
+
files.filter((file) => file.path !== GENERATION_MARKER_PATH),
|
|
77
84
|
);
|
|
78
85
|
}
|
package/src/capability.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* @module
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
import { PagesAdapterError } from './errors.js';
|
|
18
19
|
import {
|
|
19
20
|
ROLLBACK,
|
|
20
21
|
assertValidCapabilityDeclaration,
|
|
@@ -48,12 +49,15 @@ import {
|
|
|
48
49
|
* (2.8.1). The inventory is typed as an open record, so the profile is
|
|
49
50
|
* required here once, by name, and its absence is a refusal rather than an
|
|
50
51
|
* `undefined` digest.
|
|
52
|
+
*
|
|
53
|
+
* @type {NonNullable<(typeof ACTIVE_DIGEST_PROFILES)['providerCallClassBinding']>}
|
|
51
54
|
*/
|
|
52
55
|
export const CALL_CLASS_BINDING_PROFILE = (() => {
|
|
53
56
|
const profile = ACTIVE_DIGEST_PROFILES.providerCallClassBinding;
|
|
54
57
|
if (profile === undefined) {
|
|
55
|
-
throw new
|
|
56
|
-
'PAGES_DIGEST_PROFILE_MISSING
|
|
58
|
+
throw new PagesAdapterError(
|
|
59
|
+
'PAGES_DIGEST_PROFILE_MISSING',
|
|
60
|
+
'@rathnasgala2/schemas/digest-profiles exports no providerCallClassBinding profile',
|
|
57
61
|
);
|
|
58
62
|
}
|
|
59
63
|
return profile;
|
|
@@ -61,7 +65,8 @@ export const CALL_CLASS_BINDING_PROFILE = (() => {
|
|
|
61
65
|
|
|
62
66
|
const ROW_OR_UNDEFINED = getCapabilityRow('github-pages');
|
|
63
67
|
if (ROW_OR_UNDEFINED === undefined) {
|
|
64
|
-
throw new
|
|
68
|
+
throw new PagesAdapterError(
|
|
69
|
+
'PAGES_CAPABILITY_ROW_MISSING',
|
|
65
70
|
'adapter-protocol does not declare a github-pages capability row',
|
|
66
71
|
);
|
|
67
72
|
}
|
|
@@ -152,6 +157,9 @@ export function describeCapabilities(context) {
|
|
|
152
157
|
configuration: {
|
|
153
158
|
redirects: false,
|
|
154
159
|
headers: false,
|
|
160
|
+
// No custom-domain configuration or serving. A base URL that names a
|
|
161
|
+
// host the site has since moved away from is reported by the public
|
|
162
|
+
// reads as `PAGES_PUBLIC_REDIRECT`, never followed or configured.
|
|
155
163
|
customDomains: false,
|
|
156
164
|
notFoundBehavior: ROW.notFoundBehavior,
|
|
157
165
|
immutableCaching: false,
|
|
@@ -194,6 +202,9 @@ export function describeCapabilities(context) {
|
|
|
194
202
|
DOMAIN_PAGES_CREDENTIAL_EGRESS,
|
|
195
203
|
CREDENTIAL_EGRESS_PROFILE,
|
|
196
204
|
),
|
|
205
|
+
// The schema caps providerExecutionSeconds and totalSeconds at 1500, so
|
|
206
|
+
// the true worst case (1500 s activation poll plus up to 960 s of
|
|
207
|
+
// observe waiting) cannot be declared here.
|
|
197
208
|
managedExecutionBudget: {
|
|
198
209
|
verifiedHandoffSeconds: 120,
|
|
199
210
|
pagesCarrierConstructionSeconds: 300,
|