diff --git a/.github/scripts/build_publish_payload.py b/.github/scripts/build_publish_payload.py index 03cafd54..044f3903 100644 --- a/.github/scripts/build_publish_payload.py +++ b/.github/scripts/build_publish_payload.py @@ -127,6 +127,7 @@ def normalize_worker_interface( workers_json: dict[str, Any], functions_json: dict[str, Any], trigger_types_json: dict[str, Any] | None = None, + baseline_trigger_types_json: dict[str, Any] | None = None, ) -> dict[str, list[dict[str, Any]]]: workers = _extract_array(workers_json, "workers") worker = _match_worker(workers, worker_name) @@ -162,12 +163,20 @@ def normalize_worker_interface( } ) + baseline_ids = { + tt["id"] + for tt in _extract_array(baseline_trigger_types_json or {}, "trigger_types") + if isinstance(tt.get("id"), str) + } + triggers = [] if trigger_types_json: for trigger_type in _extract_array(trigger_types_json, "trigger_types"): tt_id = trigger_type.get("id") if not isinstance(tt_id, str) or tt_id.startswith("engine::"): continue + if tt_id in baseline_ids: + continue triggers.append(_normalize_registry_trigger_type(trigger_type)) return {"functions": functions, "triggers": triggers} diff --git a/.github/scripts/collect_worker_interface.py b/.github/scripts/collect_worker_interface.py index e2f2e877..21adf387 100644 --- a/.github/scripts/collect_worker_interface.py +++ b/.github/scripts/collect_worker_interface.py @@ -70,8 +70,15 @@ def main() -> int: parser.add_argument("--worker", required=True) parser.add_argument("--out", default="worker-interface.json") parser.add_argument("--wait-seconds", type=int, default=0) + parser.add_argument("--trigger-types-baseline", default="") args = parser.parse_args() + baseline_json = None + if args.trigger_types_baseline: + baseline_path = pathlib.Path(args.trigger_types_baseline) + if baseline_path.exists(): + baseline_json = json.loads(baseline_path.read_text(encoding="utf-8")) + workers_json = wait_for_worker(args.worker, args.wait_seconds) functions_json = run_iii("engine::functions::list", {"include_internal": True}) trigger_types_json = collect_trigger_types() @@ -81,6 +88,7 @@ def main() -> int: workers_json=workers_json, functions_json=functions_json, trigger_types_json=trigger_types_json, + baseline_trigger_types_json=baseline_json, ) pathlib.Path(args.out).write_text(json.dumps(interface, indent=2) + "\n", encoding="utf-8") print(json.dumps(interface, indent=2)) diff --git a/.github/workflows/_publish-registry.yml b/.github/workflows/_publish-registry.yml index 071e0ebf..49db51d9 100644 --- a/.github/workflows/_publish-registry.yml +++ b/.github/workflows/_publish-registry.yml @@ -93,6 +93,15 @@ jobs: cat iii-engine.log || true exit 1 + - name: Snapshot engine trigger types baseline + run: | + set -euo pipefail + iii trigger \ + --function-id='engine::trigger-types::list' \ + --payload='{"include_internal": false}' \ + > trigger-types-baseline.json + cat trigger-types-baseline.json + - name: Start local worker for interface collection env: WORKER: ${{ inputs.worker }} @@ -190,7 +199,12 @@ jobs: env: WORKER: ${{ inputs.worker }} run: | - args=("--worker" "$WORKER" "--out" "worker-interface.json" "--wait-seconds" "120") + args=( + "--worker" "$WORKER" + "--out" "worker-interface.json" + "--wait-seconds" "120" + "--trigger-types-baseline" "trigger-types-baseline.json" + ) python3 .github/scripts/collect_worker_interface.py "${args[@]}" - name: Assert worker interface was collected