Skip to content

aggregator: HTML not-found routes return 200, not 404 — /item/<unknown> and /quota/service/<unknown> contradict every sibling route in the same handler #2926

Closed

Description

@dezren39

Defect

The PM aggregator's two HTML "not found" routes return HTTP 200, while every sibling not-found route in the same handler returns 404:

  • pm-stack/aggregator/src/server.ts:885 — /item/<unknown>: return html(\

    Not found

    …no board item or roadmap row with subject ${id}

    `)—html()` defaults to status 200 (server.ts:214).
  • pm-stack/aggregator/src/server.ts:586-590 — /quota/service/<unknown>: same pattern, html() with no status argument.

Contrast, same file, same run of the handler:

  • /program/<unknown> passes 404 explicitly (server.ts:696-697).
  • The JSON twins pass 404: /api/program-project.json (server.ts:710), /api/quota/service.json (server.ts:767).
  • The fallthrough route returns json({ error: "not found", path }, 404) (server.ts:888).

Verified this run (main 48f7c867cbf95e9ed51ece83ae0d68d58785ca54)

Laptop probe (fixture source, loopback only, server.ts sha256 d68163b8… identical on sandbox main and the laptop clone; probe dir ~/git/fleet/probe-2026-10-30-laneB-item404/):

Request Result
GET /item/no-such-item-xyz 200
GET /quota/service/no-such-svc 200
GET /program/no-such-proj (control) 404
GET /api/quota/service.json?id=nope (control) 404
GET /nope-route (control) 404

Why it matters

  • Machine consumers, link checkers, uptime/health probes, and browser history treat these misses as successful pages; a mistyped or stale item/service link is indistinguishable from a real page by status.
  • fetchHandler (server.ts:~905) records a render as OK when res.status < 400, so every hit on a missing /item/… page is recorded in the impl(aggregator): service & page health page - live probes for every stack service, feed ages, last runs #1147 render registry as a successful page render — the health page's per-page "last rendered OK" signal is polluted by not-found traffic.
  • The inconsistency is in-file: a reader cannot tell whether 200 is deliberate for these two routes (nothing documents it) — the explicit 404s elsewhere say it is not.

Note: the unescaped ${id} interpolation on the /item line itself is the separate, already-tracked reflected-XSS issue #2267 — this issue is only about the status code, and the two fixes touch adjacent lines, so whoever takes one should check the other.

Acceptance criteria

  • GET /item/<unknown> and GET /quota/service/<unknown> return 404 with the same not-found HTML bodies as today.
  • Known item/service pages still return 200; no other route's status changes.
  • A test (aggregator suite or a handler-level check) pins both statuses, plus a 200 control for an existing item/service.
  • The render registry no longer records a missing-item hit as a successful render (follows automatically from the 404 once fetchHandler's < 400 rule sees it — verify, don't assume).

Activity

  1. added
    kind/bug
    priority/low
    queue/queued
    source/creator
    task/triage
    status/needs-triage
    app/pm-stack
    effort/xs
    on Oct 31, 2026
  2. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · state: filed

  3. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

    • Agent: repo-worker-code (OpenChamber scheduled lane)
    • Session / ID: OpenCode scheduled lane 2026-11-01; queue task 4172 (triage, attempt 1)
    • Found via: atomic claim from repo-health-code-pilot
    • Task: Revalidate the not-found status defect on current main and route a scoped fix task.
    • Current status: Fresh issue/PR ownership checks in progress; no files touched.
  4. added
    work/assigned
    queue/claimed
    status/in-progress
    and removed
    status/needs-triage
    queue/queued
    on Nov 1, 2026
  5. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  6. added
    work/assigned
    queue/claimed
    status/in-progress
    and removed
    status/in-progress
    queue/claimed
    work/assigned
    on Nov 1, 2026
  7. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    Already fixed on current main — closing with evidence (task 5476, lane C). Both not-found branches now pass 404 explicitly: pm-stack/aggregator/src/server.ts — the unknown /quota/service/<id> branch returns html(..., 404) and the unknown /item/<id> branch returns html(..., 404). Handler-level coverage already exists in pm-stack/aggregator/test/error-boundary-1211.test.ts ("consistent not-found semantics over HTTP (#1211)": "/item and /quota/service misses are 404, not 200", plus known-page 200 controls). Verified fresh 2026-11-02 on the laptop at main ddd0d42: bun test test/error-boundary-1211.test.ts — 6 pass, 0 fail, against a live loopback server. The fix landed under the #1211 not-found work after this issue's evidence snapshot (5abd39a); the packet's remaining asks (bodies unchanged, misses not recorded as successful renders — fetchHandler only records status < 400) are satisfied by the same state.

  8. removed
    status/in-progress
    queue/claimed
    work/assigned
    on Nov 2, 2026
  9. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane C shift
    • Session / ID: task 5476
    • Found via: queue claim
    • Task: Return 404 for missing aggregator item and quota-service pages.
    • Expectation: Done as already_done: behavior and tests were already on main (see closing comment for evidence); no code changed this shift, scratch worktree removed.
    • Links: task 5476
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/pm-stackeffort/xskind/bugpriority/lowsource/creatortask/triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions