Commit f4f48b9
authored
Add vault data layer for auto-triage (#64590)
* Draft: vault data layer for auto-triage (direction proposal)
Signed-off-by: André Ahlert <andre@aex.partners>
* Phase 1: Persist author profiles across sessions
Add disk-backed caching for author profiles with a 7-day TTL.
Previously profiles were stored only in an in-memory dict and
re-fetched from the GitHub API on every run. Now they are saved
to the breeze build cache on first fetch and loaded from disk
on subsequent runs, falling back to the API when the cache
entry is missing or expired.
Signed-off-by: André Ahlert <andre@aex.partners>
* Phase 2: Materialize PR metadata to vault on fetch
Save PR metadata (number, title, author, labels, head_sha, checks
state, etc.) to the breeze build cache after each GraphQL fetch.
The vault uses a 4-hour TTL and validates against head_sha so
stale entries for PRs that received new commits are discarded.
This lays the groundwork for Phase 3 where the triage flow
can load known PRs from the vault instead of re-fetching from
the API.
Signed-off-by: André Ahlert <andre@aex.partners>
* Address review feedback: top-level imports and strip cached_at
Move get_cached_author_profile and save_author_profile imports to
module scope. Strip the internal cached_at field from disk-cached
profiles so callers get a consistent shape regardless of source.
Signed-off-by: André Ahlert <andre@aex.partners>
* Phases 3-6: Hybrid lookups, check/workflow caching, directed review questions
Phase 3: _fetch_check_status_counts now tries the vault before
hitting the GraphQL API. Results are keyed by head_sha so they
never go stale. Same for _find_workflow_runs_by_status with a
10-minute TTL.
Phase 4: Check status counts are persisted to vault after API
fetch. No TTL needed since the same SHA always produces the same
check results.
Phase 5: generate_review_questions() in pr_vault.py produces
deterministic verification questions from the diff (large PR,
missing tests, version fields, breaking changes, exception
consistency). These are appended to the LLM user message via
assess_pr so the model addresses each one.
Phase 6: Workflow runs are cached with a 10-minute TTL. This
eliminates the 4+ REST calls per PR on repeated triage runs
within the TTL window.
Signed-off-by: André Ahlert <andre@aex.partners>
* Address code review: atomic writes, partial check guard, thread safety, false positives
- Use atomic file writes (temp file + os.replace) in CacheStore.save
to prevent corrupt reads from concurrent threads.
- Skip caching check status when IN_PROGRESS/QUEUED/PENDING counts
are present to avoid persisting incomplete CI results.
- Add threading.Lock to _author_profile_cache to prevent redundant
API calls from concurrent workers.
- Scan only added lines (not removed) in generate_review_questions
to avoid false positives from removed deprecation notices.
- Document that review questions are active in sequential mode only
(diff_text not yet available at background LLM submission time).
- Document the intentional use of time.time() for persistent TTLs.
- Add tests for scan_cached_pr_numbers and invalidate_stale_caches
covering success, corrupt files, stale SHA, and multi-cache scenarios.
Signed-off-by: André Ahlert <andre@aex.partners>
* Fix ruff format and mypy type errors in vault layer
Remove extra blank line in pr_commands.py (ruff format).
Fix dataclass field annotations in test_pr_vault.py: list -> list | None
to match None defaults (mypy assignment error).
Signed-off-by: André Ahlert <andre@aex.partners>
---------
Signed-off-by: André Ahlert <andre@aex.partners>1 parent 7efa372 commit f4f48b9
7 files changed
Lines changed: 766 additions & 10 deletions
File tree
- dev/breeze
- src/airflow_breeze
- commands
- utils
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
210 | 212 | | |
211 | 213 | | |
212 | 214 | | |
| 215 | + | |
213 | 216 | | |
214 | 217 | | |
215 | 218 | | |
216 | 219 | | |
| 220 | + | |
217 | 221 | | |
218 | 222 | | |
219 | 223 | | |
| |||
243 | 247 | | |
244 | 248 | | |
245 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
246 | 260 | | |
247 | 261 | | |
248 | 262 | | |
| |||
255 | 269 | | |
256 | 270 | | |
257 | 271 | | |
| 272 | + | |
258 | 273 | | |
259 | 274 | | |
260 | 275 | | |
| |||
1016 | 1031 | | |
1017 | 1032 | | |
1018 | 1033 | | |
| 1034 | + | |
1019 | 1035 | | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
1020 | 1042 | | |
1021 | 1043 | | |
1022 | 1044 | | |
| |||
1053 | 1075 | | |
1054 | 1076 | | |
1055 | 1077 | | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
1056 | 1082 | | |
1057 | 1083 | | |
1058 | 1084 | | |
| |||
1788 | 1814 | | |
1789 | 1815 | | |
1790 | 1816 | | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
1791 | 1822 | | |
1792 | 1823 | | |
1793 | 1824 | | |
| |||
1829 | 1860 | | |
1830 | 1861 | | |
1831 | 1862 | | |
| 1863 | + | |
1832 | 1864 | | |
1833 | 1865 | | |
1834 | 1866 | | |
| |||
1904 | 1936 | | |
1905 | 1937 | | |
1906 | 1938 | | |
1907 | | - | |
| 1939 | + | |
| 1940 | + | |
1908 | 1941 | | |
1909 | | - | |
1910 | | - | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
1911 | 1951 | | |
1912 | 1952 | | |
1913 | 1953 | | |
| |||
1939 | 1979 | | |
1940 | 1980 | | |
1941 | 1981 | | |
1942 | | - | |
| 1982 | + | |
| 1983 | + | |
1943 | 1984 | | |
1944 | 1985 | | |
1945 | 1986 | | |
| |||
1989 | 2030 | | |
1990 | 2031 | | |
1991 | 2032 | | |
1992 | | - | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
1993 | 2039 | | |
1994 | 2040 | | |
1995 | 2041 | | |
| |||
7885 | 7931 | | |
7886 | 7932 | | |
7887 | 7933 | | |
| 7934 | + | |
7888 | 7935 | | |
| 7936 | + | |
| 7937 | + | |
| 7938 | + | |
| 7939 | + | |
| 7940 | + | |
| 7941 | + | |
7889 | 7942 | | |
7890 | 7943 | | |
7891 | 7944 | | |
| |||
7900 | 7953 | | |
7901 | 7954 | | |
7902 | 7955 | | |
7903 | | - | |
| 7956 | + | |
| 7957 | + | |
| 7958 | + | |
| 7959 | + | |
7904 | 7960 | | |
7905 | 7961 | | |
7906 | 7962 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
158 | | - | |
| 159 | + | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
164 | 170 | | |
165 | 171 | | |
166 | 172 | | |
| |||
645 | 651 | | |
646 | 652 | | |
647 | 653 | | |
| 654 | + | |
648 | 655 | | |
649 | 656 | | |
650 | 657 | | |
651 | 658 | | |
| 659 | + | |
| 660 | + | |
652 | 661 | | |
653 | 662 | | |
654 | 663 | | |
| |||
658 | 667 | | |
659 | 668 | | |
660 | 669 | | |
661 | | - | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
662 | 673 | | |
663 | 674 | | |
664 | 675 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
69 | 76 | | |
| 77 | + | |
| 78 | + | |
70 | 79 | | |
71 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
72 | 93 | | |
73 | 94 | | |
74 | 95 | | |
| |||
77 | 98 | | |
78 | 99 | | |
79 | 100 | | |
| 101 | + | |
80 | 102 | | |
81 | 103 | | |
82 | 104 | | |
| |||
142 | 164 | | |
143 | 165 | | |
144 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
145 | 184 | | |
146 | 185 | | |
147 | 186 | | |
| |||
0 commit comments