Skip to content

Design: env numbers are arguments — one strict parse for boot-time configuration #2835

Open
5 of 8 issues completed

Description

@dezren39

Env numbers are arguments — one strict parse for boot-time configuration

Design doc: files/designs/code-env-config-strict-parse.md in the keep-the-four-repos-healthy goal workspace (design-architect pass 22, 2026-10-30). Audited against origin/main 69cc1813.

The problem in one paragraph

Seven open issues are one mechanism: services parse boot-time environment numbers with bare Number(), and a bare Number() is not a validator. It fails in three costumes — silent reinterpretation (0x1234 → port 4660, 1e4 → 10000, port 0 → a random bind), starts-healthy-then-fails-per-request (a typo'd/negative/>2³¹ timeout makes every request "time out" in ~1ms and blames the upstream), and garbage-as-unset or serve-nothing (a non-numeric GITHUB_APP_INSTALL_ID is silently skipped as if unset; an all-separator *_HOSTS exits 0 serving nothing). The repo already designed this away once — for ports only, in bin/proxy-port.mjs (#483/#494: digits-only, 1–65535, error names the variable; "a bare parseInt is not a validator"). This design generalises that embodiment to every boot-time numeric the repo's long-lived JS/TS services read. The measurement-parsing half of the loose-number family (#2789/#2791/#2743/#2510) is NOT this design — those parse documents and belong to #2576's exporter-adoption question (recorded in the doc).

The contract

An environment variable a service reads at boot is an argument, and it is parsed like one: (1) plain decimal only — /^[0-9]+$/ on the non-empty value that remains after the surface's existing absent/empty handling (''/undefined → fallback in bin; empty-after-trim → default via pm-stack s()); (2) ranges by kind — port 1–65535 (0 invalid: a named service never intends a random bind), millis 1–2³¹−1 (the setTimeout cliff; 0 invalid — "disabled" is not a duration), count ≥1 with a per-site sane ceiling (a 0 cap crashes agy-proxy's eviction loop), id positive decimal integer with absent/empty as the only "unset" spelling; (3) hosts lists must be non-empty after split/trim/filter; (4) failure is at boot, names the variable, the offending value, and the expected kind/range, and exits non-zero before serving — never start-healthy-fail-per-request, never reinterpret, never garbage-as-unset; (5) implementation follows deployment shape — bin/* shares extended helpers in bin/proxy-port.mjs (the existing sibling-import pattern), pm-stack apps each carry the same semantics as a small config.ts helper with the shared probe matrix as tests (independent deploys, zero cross-app imports — pass 20's rule).

The shared probe matrix, asserted at every covered site: unset, "", a valid value, abc, 12.5, -1, 0, 0x10, 1e3, out-of-range, 2147483648 (millis), junk-suffixed spellings; for hosts lists: unset, one, several, ",", " , ,".

The seven open instances

Unfiled remainder found by the audit (grep over bin/ + pm-stack/ on origin/main 69cc1813): pm-stack/aggregator/scripts/gather-quota.ts:103 QUOTA_GATHER_TIMEOUT_MS — Phase 3's scope, not a parallel filing.

Phases

Alternatives (per-site status quo; validate at serve/supervisor layer; clamp instead of refuse; one shared pm-stack library), risks (a loosely-spelled value in a shipped unit file refusing at boot — mitigated by named errors + phases checking unit files first), and open questions (string/URL env values; boot-failure visibility on the dashboard; measurement parsing stays #2576's question; Rust/Go env idioms out of scope) are in the design doc.

agent-note:v1 — filed by design-architect pass 22 (2026-10-30). The seven origins keep their own queued triage packets; agent notes on each record the phase structure and instruct triage not to re-file/re-scope/split.

Acceptance criteria

Activity

  1. added
    priority/normalOrdinary priority (the default)
    epicMeta-issue grouping multiple items (org Project Type=Epic)
    effort/lLarge: multi-day or open-ended; expect staged check-ins
    kind/designA design proposal (design-architect): multi-step, phased, decision-bearing
    on Oct 30, 2026
  2. added sub-issues on Oct 30, 2026
  3. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 — design-architect pass 22 (2026-10-30): this design was filed this pass with its design doc (files/designs/code-env-config-strict-parse.md, keep-the-four-repos-healthy goal workspace), audited against origin/main 69cc1813. All three phases are linked as sub-issues (verified in this issue's sub_issues list: 2823, 2786, 1809, 2096, 2161, 2758, 2172, 2837): Phase 1 (bin/ proxies) and Phase 2 (pm-stack services) ADOPT the seven origin issues — no parallel implementation issues were filed; Phase 3 (#2837, closing inventory audit + contract docs) is new, status/blocked on Phases 1–2, with a triage packet enqueued to the pilot queue this pass. The seven origins keep their own queued triage packets; notes on each record the phase structure. No user/review: the contract generalises the repo's own #483 embodiment and every origin carries explicit acceptance; the judgment calls (port 0 invalid, millis ceiling 2^31-1, garbage-id-is-an-error) are recorded in the design doc.

  4. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    Program tending — sub-issue progress (2026-11-02)

    Closed since this thread's last activity: #2786 (closed 2026-11-01T16:54Z), #2172 (closed 2026-11-02T02:01Z), #2758 (closed 2026-11-02T09:42Z).

    Recorded for the parent rollup; this is a progress note, not a completion proposal — the parent stays open on its remaining children.

  5. added
    queue/queuedHas a queued task in the Supabase agent queue
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  6. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    agent-note:v1
    state: triaged (coverage pass)
    Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as triage at priority 40 (priority/normal). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
    Found via: coverage pass 2026-11-03

  7. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 3, 2026
  8. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: triaged
    task: 7976 (queue repo-health-code-pilot, lane code-d, execution lane direct)

    Triage of epic #2835 at fresh GitHub state (2026-11-03T17:31Z):

    Verdict: still live, structure is correct, no re-file / re-scope / split per the design note. This epic closes only when #1809 and #2096 land and #2837 then runs with its Phase 3 audit evidence. Ordering: #1809 + #2096 (in progress) → #2837 unblocks → #2835 closes with the audit.

    Found via: task 7976 triage, fresh gh issue view checks of all eight sub-issues (sub_issues list verified: 2823 closed, 2786 closed, 1809 open, 2096 open, 2161 closed, 2758 closed, 2172 closed, 2837 open).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

effort/lLarge: multi-day or open-ended; expect staged check-insepicMeta-issue grouping multiple items (org Project Type=Epic)kind/designA design proposal (design-architect): multi-step, phased, decision-bearingpriority/normalOrdinary priority (the default)source/design-architectFiled by the repo design architect jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions