@celilo/e2e 0.11.1 → 0.11.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celilo/e2e",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "description": "E2E test infrastructure for Celilo-deployed applications. Provides a simulated internet with DNS hierarchy, ACME server, firewalls, and target machines in Docker.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -38,7 +38,7 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@celilo/cli-display": "^0.1.10",
41
- "@celilo/event-bus": "^0.2.0",
41
+ "@celilo/event-bus": "^0.3.0",
42
42
  "yaml": "^2.8.0",
43
43
  "zod": "^3.24.1"
44
44
  },
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * Does this push touch the npm-consumer-smoke consumer path?
4
+ *
5
+ * This list used to live in `npm-consumer-smoke.yml`'s `on.push.paths`, where
6
+ * it decided whether the WORKFLOW TRIGGERED at all. That made a required status
7
+ * check that often posted no status: a push touching none of these paths
8
+ * created no run, so the `npm-consumer-smoke*` context branch protection
9
+ * requires never reported, and the PR was blocked on a check that was never
10
+ * going to run (celilo#603).
11
+ *
12
+ * The workflow now always triggers and always reports; this decides whether it
13
+ * does the expensive Docker work. Same paths, same intent — the filter moved
14
+ * from "should CI speak" to "should CI do the work".
15
+ *
16
+ * DEFAULT TO RUNNING. Every uncertainty here resolves to `true`. Skipping when
17
+ * we should have run is a silent false green on a release-path gate; running
18
+ * when we needn't costs a few minutes of builder time.
19
+ */
20
+
21
+ /** Kept verbatim from the trigger's former `paths:` list. */
22
+ export const CONSUMER_PATHS = [
23
+ 'packages/e2e/**',
24
+ 'packages/registry-server/**',
25
+ // The publish driver (moved from the dead apps/celilo/scripts/publish.ts).
26
+ 'apps/celilo/src/cli/commands/publish/**',
27
+ 'scripts/publish.ts',
28
+ // (The derived release graph lives at packages/e2e/scripts/workspace-graph.ts,
29
+ // already covered by packages/e2e/** above.)
30
+ // Every workspace package.json — the actual input to the package graph.
31
+ // Narrowed to workspace members (not **/package.json) so a devDependency bump
32
+ // in an unrelated dir doesn't fire this heavy Docker job; the cheap sync gate
33
+ // in ci.yml catches graph drift on every PR regardless.
34
+ 'apps/*/package.json',
35
+ 'packages/*/package.json',
36
+ 'package.json',
37
+ ];
38
+
39
+ interface PushCommit {
40
+ added?: string[];
41
+ modified?: string[];
42
+ removed?: string[];
43
+ }
44
+
45
+ export interface PushPayload {
46
+ commits?: PushCommit[];
47
+ total_commits?: number;
48
+ }
49
+
50
+ export function touchesConsumerPath(files: string[]): boolean {
51
+ return files.some((file) => CONSUMER_PATHS.some((glob) => new Bun.Glob(glob).match(file)));
52
+ }
53
+
54
+ export function pushIsRelevant(payload: PushPayload): boolean {
55
+ const commits = payload.commits ?? [];
56
+
57
+ // No commit list to reason from — a payload shape we don't understand is not
58
+ // evidence that nothing changed.
59
+ if (commits.length === 0) return true;
60
+
61
+ // Forgejo caps `commits[]` on a large push while `total_commits` reports the
62
+ // real number. The unlisted commits are exactly the ones we cannot inspect.
63
+ if ((payload.total_commits ?? commits.length) > commits.length) return true;
64
+
65
+ // A commit carrying none of the three arrays told us nothing about its
66
+ // files. That is not the same as a commit that changed nothing — no such
67
+ // commit exists — so it is an unknown, and unknowns run.
68
+ if (commits.some((c) => !c.added && !c.modified && !c.removed)) return true;
69
+
70
+ return touchesConsumerPath(
71
+ commits.flatMap((c) => [...(c.added ?? []), ...(c.modified ?? []), ...(c.removed ?? [])]),
72
+ );
73
+ }
74
+
75
+ if (import.meta.main) {
76
+ const eventPath = process.env.GITHUB_EVENT_PATH;
77
+ // A manual dispatch (or any non-push event) means someone asked for it.
78
+ const relevant =
79
+ process.env.GITHUB_EVENT_NAME !== 'push' || !eventPath
80
+ ? true
81
+ : pushIsRelevant(await Bun.file(eventPath).json());
82
+ console.log(relevant ? 'true' : 'false');
83
+ }