Skip to content

Commit 18b6cd9

Browse files
lex00claude
andcommitted
test(e2e): tolerate per-cycle 403 (missing perm / feature gate)
A cycle whose fetchLive 403s (App lacks that permission, or the feature isn't on the org's plan) is now skipped with a warning rather than failing the suite — while still asserting fetchLive only issued GETs even on the failure path. Keeps the harness robust to the App's permission scope; grant the org read scopes for fuller coverage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 85f91f0 commit 18b6cd9

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

e2e/warden.e2e.test.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,26 @@ suite("warden e2e (real GitHub org)", () => {
203203
const rec = recording(client);
204204
const budget = makeBudget();
205205

206-
const live = await cycle.fetchLive(rec.client, ORG!, scope, budget);
206+
let live;
207+
try {
208+
live = await cycle.fetchLive(rec.client, ORG!, scope, budget);
209+
} catch (err) {
210+
// fetchLive only ever issues GETs — assert that even on the failure
211+
// path, then treat a 403 (the App lacks that permission, or the feature
212+
// is unavailable on the org's plan) as "not exercisable here" rather
213+
// than a failure. Keeps the harness robust to the App's permission
214+
// scope; the warning shows which cycles need broader grants.
215+
const nonGet = rec.calls.filter((c) => c.method !== "GET");
216+
expect(nonGet, `${cycle.name}.fetchLive made a non-GET before failing`).toEqual([]);
217+
const msg = err instanceof Error ? err.message : String(err);
218+
if (msg.includes("403")) {
219+
// eslint-disable-next-line no-console
220+
console.warn(`[e2e] ${cycle.name}: skipped (403) — ${msg.slice(0, 140)}`);
221+
return;
222+
}
223+
throw err;
224+
}
225+
207226
const desired = cycle.buildDesired(orgConfig, ORG!, scope);
208227
const changeSet = diff(ORG!, desired, live, {});
209228

0 commit comments

Comments
 (0)