Files
nxdns/admin/src/features/activity/relatedLinks.ts
T
mokhtar fa323c7ed4
Gates / test (push) Successful in 1m40s
Gates / package (push) Successful in 3m58s
Gates / container (push) Successful in 14s
CI / gates (push) Successful in 12m51s
Gates / frontend (push) Successful in 1m18s
Gates / test-aarch64 (push) Successful in 6m57s
milestone 29: activity — history, live and policy simulation on one surface
query log, live and lookup merge into /activity. history filters live
in the url, so a pasted link or back/forward reproduces the exact
view; the result column separates servfail and nxdomain from success
in the list. live is follow-by-default with freeze, and a streamed
row opens its in-memory provenance detail — no correlation invented
for rows sqlite has not written. lookup survives as the current
policy simulation under /activity/test. investigation links carry
absolute bounds, and the diagnostics page now honors since/until
instead of ignoring them. the old routes are gone without aliases.
2026-08-22 10:52:56 +02:00

43 lines
1.6 KiB
TypeScript

/**
* The absolute bounds an investigation link carries.
*
* Every link out of a query detail is time-scoped on purpose: a relative window
* would answer a different question tomorrow than it does today, and the whole
* point of linking to an episode is that the link keeps showing that episode.
*/
import type { ActivitySearch } from "./search";
/** The five-minute window the redesign puts around one query. */
export const RELATED_WINDOW_SECONDS = 300;
export interface Bounds {
since: number;
until: number;
}
/**
* The bounds for "all activity for this domain/client", decided per bound.
*
* When the reader arrived from a bounded investigation, that bound is the one
* they are working in and it carries over. A bound they never set falls back to
* the five-minute window around this query — never to no bound at all, which
* would answer with the whole retained history and lose the episode in it. The
* two bounds are decided separately, so a half-bounded origin keeps its half.
*/
export function relatedBounds(ts: number, origin: Pick<ActivitySearch, "since" | "until">): Bounds {
return {
since: origin.since ?? ts - RELATED_WINDOW_SECONDS,
until: origin.until ?? ts + RELATED_WINDOW_SECONDS,
};
}
/**
* The Diagnostics window around one query. Fixed at five minutes either side of
* the query, not inherited: the reader is asking what else was failing while
* this query was answered, which is a question about the query's own moment.
*/
export function diagnosticsBounds(ts: number): Bounds {
return { since: ts - RELATED_WINDOW_SECONDS, until: ts + RELATED_WINDOW_SECONDS };
}