Repository navigation
106 lines (98 loc) · 4.79 KB
/
Copy pathfrontend-codegen-drift.yml
File metadata and controls
106 lines (98 loc) · 4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# #7122: Drift guard for frontend TypeScript types generated from
# canonical Python dataclasses.
#
# Runs `gen_frontend_types.py --check`. If the committed
# `autobot-frontend/src/types/_generated/workflow.ts` differs from what
# the script would emit today (i.e. a backend dataclass field was added,
# removed, or retyped without re-running the generator), the job fails
# and asks the contributor to re-run the script and commit.
#
# Catches the same class of drift bug as #7044 (frontend `TemplateStep`
# silently mismatched the backend `to_status_dict()` shape for 18
# months). Codegen + this guard makes the drift impossible to introduce
# silently.
#
# #7226: extended path filter to cover all MANIFEST sources
# (status_enums + workflow_automation models).
# #7269 followup: install pydantic so backend Pydantic-using sources
# (like services/workflow_automation/models.py) load correctly. Source
# files are loaded via spec_from_file_location, bypassing package
# __init__.py, but they still need their direct imports installed.
#
# Security: this workflow does NOT interpolate any untrusted GitHub
# event data (no issue titles, PR bodies, commit messages, head_ref,
# etc.) into run: commands. All inputs are static repo paths.
name: frontend-codegen-drift
on:
pull_request:
# ready_for_review is REQUIRED here: the jobs below are gated on
# draft == false, and marking a PR ready fires ONLY this event. Without
# it a required context stays `skipped` and the PR can never merge.
types: [opened, synchronize, reopened, ready_for_review]
paths:
# Canonical sources covered by MANIFEST (#7122 / #7226)
- 'autobot_shared/workflow/types.py'
- 'autobot_shared/status_enums.py'
- 'autobot_shared/auth/permissions.py'
- 'autobot-backend/services/workflow_automation/models.py'
# Codegen output + tooling
- 'autobot-frontend/src/types/_generated/**'
- 'autobot-infrastructure/shared/scripts/gen_frontend_types.py'
- '.github/workflows/frontend-codegen-drift.yml'
- 'requirements-ci/framework.txt'
- 'constraints/shared.txt' # #21471: CI-plane versions live here
push:
branches: [main]
paths:
- 'autobot_shared/workflow/types.py'
- 'autobot_shared/status_enums.py'
- 'autobot_shared/auth/permissions.py'
- 'autobot-backend/services/workflow_automation/models.py'
- 'autobot-frontend/src/types/_generated/**'
- 'autobot-infrastructure/shared/scripts/gen_frontend_types.py'
- 'requirements-ci/framework.txt'
- 'constraints/shared.txt' # #21471: CI-plane versions live here
# #14434: without this, every push left its predecessors queued. 42 of a 271-run
# sample were for commits no longer at their branch tip - work nothing would ever
# read, each still fetching its actions. During GitHub's 2026-08-17 archive-download
# degradation that wasted load became failures on unrelated pull requests (#14444).
#
# cancel-in-progress is guarded on the event rather than set to a bare `true`:
# #13432 found that cancelling base-branch runs meant each merge cancelled the
# previous merge's verification, and merges arrive faster than a suite completes -
# of 39 completed base runs, 26 were cancelled and NONE succeeded. Six of the
# workflows this was applied to also trigger on push to main, so the guard
# is load-bearing there and harmless where it is not.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
check-drift:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version-file: '.python-version'
cache: 'pip'
cache-dependency-path: |
requirements*.txt
autobot-backend/requirements*.txt
autobot-slm-backend/requirements*.txt
requirements-ci/framework.txt
constraints/shared.txt
- name: Install minimal codegen deps
# The MANIFEST sources import pydantic, and autobot_shared/workflow/types.py
# reads RetryConfig from ssot_constants, which loads ssot_config and so
# pydantic-settings. requirements-ci/framework.txt lists both bare and its
# -c line takes their versions from constraints/shared.txt (#21471), so
# this job resolves the same versions as every other install.
run: pip install -r requirements-ci/framework.txt
- name: Run codegen drift check
run: |
python3 autobot-infrastructure/shared/scripts/gen_frontend_types.py --check