Commit d771b51
authored
fix(health): add finite stale-content grace (#7577)
* docs(health): plan stale-content grace
* test(health): reproduce stale-content grace gap
* test(docs): define graced stale-content summary
* test(monitor): reproduce stale-content grace alert
* fix(health): add finite stale-content grace
* test(health): reproduce per-entity grace gap
* test(health): cover count-driven grace clock
* Address PR review feedback (#7577)
Extend stale-content grace to per-entity checks and keep count-driven grace on one stable Redis deadline.
* fix(health): make stale-content grace a genuine one-shot window
Review of #7577 found the grace was not finite for two reachable source
classes, and that its production wiring had no end-to-end coverage.
The deadline was re-derived from the live observation on every sweep. A feed
that keeps publishing while staying just past its budget therefore advanced
its own deadline forever and could never reach the warning bucket, and a
source that changed which evidence shape applied was granted a second window
without ever recovering. Both alarms were silent for the whole time, since the
scheduled monitor's ceiling was satisfied too.
Redis is now the single source of truth for the deadline in both modes. Every
graced source claims one anchor with HSETNX and republishes that stored value,
so the window cannot slide or be re-granted. The claim runs after
classification and is gated on the status a key actually received, so a
higher-precedence failure (REDIS_PARTIAL, EMPTY, STALE_SEED) can no longer
burn the source's single anchor while publishing no grace at all.
Also from the review:
- Split the grace pipeline by urgency. Only the claim decides what the
response publishes; the recovery cleanup now goes through ctx.waitUntil
instead of adding a round trip to nearly every sweep.
- Give the grace hash a refreshed TTL so retired registry names and
per-deploy preview keys reap themselves.
- Drop the seedMetaByName precompute, which was provably identical to the
fallback it bypassed.
- Collapse the three copy-pasted deadline branches into one declared table.
- Restore the #3845 provenance comments and document why the window is
source-agnostic.
- Re-bound the docs gate on staleContent (<= ok + warn, still true) instead
of dropping the check.
- Give the monitor ceiling explicit clock-skew slack, and keep graced entries
visible in its report rather than filtering them into silence.
Tests: the helpers were the only thing covered, so the wiring could have been
deleted green. Adds handleHealth-level coverage for the claim, the
fail-closed path, and the cached-snapshot guard.1 parent 8b0758c commit d771b51
11 files changed
Lines changed: 1224 additions & 57 deletions
File tree
- api
- docs
- plans
- zh
- scripts
- tests
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
Lines changed: 196 additions & 0 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
67 | 81 | | |
68 | | - | |
69 | | - | |
70 | | - | |
| 82 | + | |
| 83 | + | |
71 | 84 | | |
72 | | - | |
| 85 | + | |
73 | 86 | | |
74 | 87 | | |
75 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
76 | 122 | | |
77 | 123 | | |
78 | 124 | | |
79 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
80 | 130 | | |
81 | 131 | | |
82 | 132 | | |
| |||
430 | 480 | | |
431 | 481 | | |
432 | 482 | | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
433 | 488 | | |
434 | 489 | | |
435 | 490 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1622 | 1622 | | |
1623 | 1623 | | |
1624 | 1624 | | |
1625 | | - | |
1626 | | - | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
1627 | 1630 | | |
1628 | 1631 | | |
1629 | 1632 | | |
| |||
1663 | 1666 | | |
1664 | 1667 | | |
1665 | 1668 | | |
1666 | | - | |
1667 | | - | |
1668 | | - | |
1669 | | - | |
1670 | | - | |
1671 | | - | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
1672 | 1683 | | |
1673 | 1684 | | |
1674 | 1685 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
190 | 202 | | |
191 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
192 | 209 | | |
193 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
194 | 230 | | |
195 | 231 | | |
196 | 232 | | |
| |||
0 commit comments