GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(aggregator): validate dns/aa section stamps in health feedSections (#2242) by dezren39 · Pull Request #3091 · developing-today/code

fix(aggregator): validate dns/aa section stamps in health feedSections (#2242) #3091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
dezren39 merged 1 commit into main from queue/4321-2242-feedsections-stamps
Oct 31, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix(aggregator): validate dns/aa section stamps in health feedSections (#2242) #3091

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
df2ea24
fix(aggregator): validate dns/aa section stamps in health feedSection…
dezren39 Oct 31, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
fix(aggregator): validate dns/aa section stamps in health feedSections (
#2242)

feedSections blindly computed ageMs from Date.parse: a garbage dns generatedAt rendered NaN/null and a future aa generatedAt rendered age 0 (maximally fresh) for as long as the skew lasted. The from() helper now applies the #1564 convention already used for the top-level stamp: unparseable -> present:false with an invalid generatedAt (...) note; beyond GENERATED_AT_FUTURE_SKEW_MS (60s) in the future -> present:false with a descriptive note. isDnsSection/isAaSection additionally require Number.isFinite(Date.parse(generatedAt)). Regression tests cover garbage and future stamps for both sections plus the inside-skew live case; full aggregator suite 692 pass / 7 fail, identical fail set to clean main (690/7).
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 committed Oct 31, 2026
commit df2ea248b766b780258dbbf1506b6875bc9e07d4

There are no files selected for viewing

4 changes: 3 additions & 1 deletion 4 pm-stack/aggregator/src/aa.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1092,10 +1092,12 @@ export function aaSectionFromSupabase(
export function isAaSection(v: unknown): v is AaFeedSection {
if (typeof v !== "object" || v === null) return false;
const s = v as Partial<AaSection> & Partial<AaAbsentSection>;
if (s.status === "absent") return typeof s.reason === "string" && typeof s.generatedAt === "string";
if (s.status === "absent")
return typeof s.reason === "string" && typeof s.generatedAt === "string" && Number.isFinite(Date.parse(s.generatedAt));
if (s.status !== "ok") return false;
return (
typeof s.generatedAt === "string" &&
Number.isFinite(Date.parse(s.generatedAt)) &&
typeof s.batch === "string" &&
Array.isArray(s.rankings) &&
s.rankings.length > 0 &&
Expand Down
1 change: 1 addition & 0 deletions 1 pm-stack/aggregator/src/dns.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export function isDnsSection(v: unknown): v is DnsSection {
const s = v as Partial<DnsSection>;
return (
typeof s.generatedAt === "string" &&
Number.isFinite(Date.parse(s.generatedAt)) &&
Array.isArray(s.entries) &&
s.entries.length > 0 &&
s.entries.every(
Expand Down
19 changes: 18 additions & 1 deletion 19 pm-stack/aggregator/src/health.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,24 @@ function feedSections(feed: FleetFeed | null, now: number): FeedSectionHealth[]
if (!feed) return [];
const from = (generatedAt: string | undefined, present: boolean, note?: string): Partial<FeedSectionHealth> => {
const ts = generatedAt ?? feed.generatedAt;
return { present, generatedAt: ts, ageMs: Math.max(0, now - Date.parse(ts)), ...(note ? { note } : {}) };
const parsed = Date.parse(ts);
// Section stamps get the same validation as the top-level one
// (#2242, mirroring #1564): an unparseable stamp must not render
// as ageMs NaN/null, and a stamp beyond the future-skew bound
// must not render as ageMs 0 (maximally fresh) for as long as
// the skew lasts. Either way the section reports absent with a
// legible note instead of a fabricated age.
if (!Number.isFinite(parsed)) {
return { present: false, generatedAt: ts, note: `invalid generatedAt (${ts})` };
}
if (parsed - now > GENERATED_AT_FUTURE_SKEW_MS) {
return {
present: false,
generatedAt: ts,
note: `generatedAt (${ts}) is ${ageMsText(parsed - now)} in the future — never fresh`,
};
}
return { present, generatedAt: ts, ageMs: Math.max(0, now - parsed), ...(note ? { note } : {}) };
};
const aa = feed.aa;
const aaNote =
Expand Down
44 changes: 44 additions & 0 deletions 44 pm-stack/aggregator/test/health.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,50 @@ describe("buildHealth probes", () => {
expect(view.degraded).toBe(true);
});

test("garbage dns/aa section stamps render absent with an invalid-generatedAt note, never NaN (#2242)", async () => {
const { fetcher } = fakeFetcher(allUp);
const feed = feedAt(5 * 60_000);
(feed.dns as { generatedAt: string }).generatedAt = "not-a-date";
(feed as unknown as { aa: unknown }).aa = { status: "ok", generatedAt: "garbage!!", batch: "b", rankings: [], configs: [], testRuns: [] };
const view = await buildHealth(inputs({ feed }), { fetcher, cache: createProbeCache(), now: NOW });
const dns = view.feed.sections.find((x) => x.key === "dns");
expect(dns?.present).toBe(false);
expect(dns?.note).toContain("invalid generatedAt (not-a-date)");
expect(dns?.ageMs).toBeUndefined();
const aa = view.feed.sections.find((x) => x.key === "aa");
expect(aa?.present).toBe(false);
expect(aa?.note).toContain("invalid generatedAt (garbage!!)");
expect(aa?.ageMs).toBeUndefined();
// Untouched sections render exactly as before.
const orch = view.feed.sections.find((x) => x.key === "orchestration");
expect(orch?.present).toBe(true);
expect(orch?.ageMs).toBe(5 * 60_000);
});

test("future dns/aa section stamps render absent with a future note, never age 0 (#2242)", async () => {
const { fetcher } = fakeFetcher(allUp);
const feed = feedAt(5 * 60_000);
const future = new Date(NOW + 3_600_000).toISOString();
(feed.dns as { generatedAt: string }).generatedAt = future;
(feed as unknown as { aa: unknown }).aa = { status: "ok", generatedAt: future, batch: "b", rankings: [], configs: [], testRuns: [] };
const view = await buildHealth(inputs({ feed }), { fetcher, cache: createProbeCache(), now: NOW });
const dns = view.feed.sections.find((x) => x.key === "dns");
expect(dns?.present).toBe(false);
expect(dns?.note).toContain("in the future");
expect(dns?.ageMs).toBeUndefined();
const aa = view.feed.sections.find((x) => x.key === "aa");
expect(aa?.present).toBe(false);
expect(aa?.note).toContain("in the future");
expect(aa?.ageMs).toBeUndefined();
// A stamp inside the 60s skew bound still renders as a live section.
const feed2 = feedAt(5 * 60_000);
(feed2.dns as { generatedAt: string }).generatedAt = new Date(NOW + 30_000).toISOString();
const view2 = await buildHealth(inputs({ feed: feed2 }), { fetcher, cache: createProbeCache(), now: NOW });
const dns2 = view2.feed.sections.find((x) => x.key === "dns");
expect(dns2?.present).toBe(true);
expect(dns2?.ageMs).toBe(0);
});

test("fixtures mode never probes and reports fixtures for every service", async () => {
const { fetcher, calls } = fakeFetcher(allUp);
const view = await buildHealth(
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.