Commit 9517351
committed
fix(github): write through all three PR-state cache fields together
The AI review flagged a real defect: cachedFetchLivePullRequestMergeState
/ cachedFetchLivePullRequestState / cachedFetchLivePullRequestHeadSha
each wrote through only the ONE field they cared about, but all three
share a single prStateFetchedAt freshness stamp. A live fetch from any
one of them would make the OTHER two fields look "fresh" to a
subsequent reader despite never having been fetched, so that reader
would silently return undefined for a field that was simply never
populated -- indistinguishable from a confirmed-empty GitHub value.
All three narrow live-fetchers already hit the exact same GET
/pulls/{n} endpoint, just extracting one field each, so there's no
extra API cost to fixing this: a new internal fetchAndCachePrStateFields
helper fetches the full payload once and writes mergeable_state, state,
and headSha through together (headSha omitted, not nulled, when absent,
preserving the existing PARTIAL-UPDATE CONTRACT so a prior headSha the
files cache depends on is never cleared). It also only writes when the
fetch actually succeeds, so a transient failure no longer poisons the
cache with a false "confirmed fresh" stamp the way the old per-field
writes did. The three public, uncached narrow fetchers used by the
act-boundary/gate-override callers are untouched.
Also fixes a second, separate flagged issue: `{ token: "installation-token" }`
in six of this PR's own new test fixtures tripped the deterministic
generic_secret_assignment scanner (a keyword-shaped heuristic, not a
real credential format) -- renamed to `"fake-installation-token"`,
which the scanner's own placeholder-value allowlist already recognizes,
without touching the shared scanner itself.
Rebased onto current main (renumbered migration 0093->0094 to resolve
a collision with #2616, and again to catch up with #2632). Full local
gate (test:ci, npm audit) green; no other changes.1 parent d831fe5 commit 9517351
3 files changed
Lines changed: 115 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2792 | 2792 | | |
2793 | 2793 | | |
2794 | 2794 | | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
2795 | 2831 | | |
2796 | 2832 | | |
2797 | 2833 | | |
| |||
2816 | 2852 | | |
2817 | 2853 | | |
2818 | 2854 | | |
2819 | | - | |
| 2855 | + | |
| 2856 | + | |
2820 | 2857 | | |
2821 | 2858 | | |
2822 | 2859 | | |
| |||
2831 | 2868 | | |
2832 | 2869 | | |
2833 | 2870 | | |
2834 | | - | |
2835 | | - | |
2836 | | - | |
| 2871 | + | |
| 2872 | + | |
2837 | 2873 | | |
2838 | 2874 | | |
2839 | 2875 | | |
2840 | | - | |
| 2876 | + | |
2841 | 2877 | | |
2842 | 2878 | | |
2843 | 2879 | | |
| |||
2851 | 2887 | | |
2852 | 2888 | | |
2853 | 2889 | | |
2854 | | - | |
2855 | | - | |
2856 | | - | |
| 2890 | + | |
| 2891 | + | |
2857 | 2892 | | |
2858 | 2893 | | |
2859 | 2894 | | |
| |||
2873 | 2908 | | |
2874 | 2909 | | |
2875 | 2910 | | |
2876 | | - | |
2877 | | - | |
2878 | | - | |
| 2911 | + | |
| 2912 | + | |
2879 | 2913 | | |
2880 | 2914 | | |
2881 | 2915 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 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 | + | |
56 | 87 | | |
57 | 88 | | |
58 | 89 | | |
| |||
196 | 227 | | |
197 | 228 | | |
198 | 229 | | |
199 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
200 | 236 | | |
201 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
202 | 245 | | |
203 | 246 | | |
204 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
205 | 262 | | |
206 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
207 | 268 | | |
208 | 269 | | |
209 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13301 | 13301 | | |
13302 | 13302 | | |
13303 | 13303 | | |
13304 | | - | |
| 13304 | + | |
13305 | 13305 | | |
13306 | 13306 | | |
13307 | 13307 | | |
| |||
13333 | 13333 | | |
13334 | 13334 | | |
13335 | 13335 | | |
13336 | | - | |
| 13336 | + | |
13337 | 13337 | | |
13338 | 13338 | | |
13339 | 13339 | | |
| |||
13370 | 13370 | | |
13371 | 13371 | | |
13372 | 13372 | | |
13373 | | - | |
| 13373 | + | |
13374 | 13374 | | |
13375 | 13375 | | |
13376 | 13376 | | |
| |||
13411 | 13411 | | |
13412 | 13412 | | |
13413 | 13413 | | |
13414 | | - | |
| 13414 | + | |
13415 | 13415 | | |
13416 | 13416 | | |
13417 | 13417 | | |
| |||
13472 | 13472 | | |
13473 | 13473 | | |
13474 | 13474 | | |
13475 | | - | |
| 13475 | + | |
13476 | 13476 | | |
13477 | 13477 | | |
13478 | 13478 | | |
| |||
13555 | 13555 | | |
13556 | 13556 | | |
13557 | 13557 | | |
13558 | | - | |
| 13558 | + | |
13559 | 13559 | | |
13560 | 13560 | | |
13561 | 13561 | | |
| |||
0 commit comments