invariants.go ×7

Frontier kind: Code frontier

unlabeled · c_5111f2955169

3 tests · 2738 LOC · 136 files · introduces 0 tests · 23 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges23 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
441 ranges2738 lines · 136 files · Browse complete extent
All tests (intent)
3 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 23 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/scanner/scheduleinvariants/invariants.go 23 introduced LOC · 7 ranges

Open complete file

198 // expected to not be able to fire (BUFFER_ONE / BUFFER_ALL waiting on a prior
199 // running workflow). What remains is counted as an anomaly.
200 > func (a *Activities) runOverdueScan(ctx context.Context, query string) error { invariants.go
201 > const subScanner = "overdue_next_action_time"
202 > metricName := metrics.ScheduleInvariantsScannerOverdueNextActionTimeCount.Name()
203 >
204 > // maxChecks bounds the number of per-schedule DescribeSchedule calls per namespace
205 > // per scan pass, so a namespace with a large backlog of overdue schedules can't
206 > // hammer the frontend. Schedules beyond the cap are left unchecked for this pass.
207 > maxChecks := a.opts().OverdueNextActionTimeMaxChecksPerNamespace
208 > for _, nsName := range a.ListAllNamespaces() {
209 > var nsAnomalies, checked int64
210 > var scanErr error
211 > for scheduleID, err := range a.schedulesInNamespace(ctx, nsName, query) {
212 > if err != nil {
213 scanErr = err
214 break
215 }
216 > if checked >= int64(maxChecks) { invariants.go
217 a.logger.Warn("overdue scan hit per-namespace check cap; remaining schedules left unchecked this pass",
218 tag.WorkflowNamespace(nsName),
222 break
223 }
224 > checked++ invariants.go
225 > if a.scheduleIsExpectedNotToFire(ctx, nsName, scheduleID) {
226 continue
227 }
228 > nsAnomalies++ invariants.go
229 > a.logger.Warn("schedule was expected to fire but doesn't appear to have done so",
230 > tag.WorkflowNamespace(nsName),
231 > tag.ScheduleID(scheduleID))
232 }
233 > if scanErr != nil { invariants.go
234 a.recordScanError(nsName, subScanner, scanErr)
235 continue
236 }
237 > a.emitCount(metricName, nsName, nsAnomalies) invariants.go
238 }
239 > return nil invariants.go
240 }
241