Skip to content

env numbers: strict parse for the last pm-stack sites + write the #2835 contract - #10770

Merged
dezren39 merged 1 commit into
mainfrom
fix/2837-env-number-closing-inventory
Nov 16, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/2837-env-number-closing-inventory

Conversation

@dezren39

@dezren39 dezren39 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

What this does

Phase 3 (closing inventory) of design #2835 for code#2837: the last uncoerced numeric env parses in pm-stack/ are converted, and the env-number contract is written where the next service meets it.

  • pm-stack/aggregator/scripts/gather-quota.ts — QUOTA_SUBCOMMAND_TIMEOUT_MS parses digits-only millis 1..2147483647 and fails at boot naming the variable and value. This is the successor of the audit's QUOTA_GATHER_TIMEOUT_MS site (the constant was renamed when the subcommand took over quota reading; the coercion survived).
  • pm-stack/aggregator/src/config.ts — ALERT_ACK_WINDOW_MIN becomes a strict count >= 1 via parseAggregatorCount instead of Number() + clamp (garbage no longer silently becomes 15).
  • pm-stack/README.md — new "Environment numbers" section: spelling (decimal digits only), kind ranges (port, millis, count, id), boot-failure rule, and the exemption rule.
  • bin/proxy-port.mjs — header states the same contract alongside the existing bin proxies: *_PROXY_PORT parsed with bare parseInt — invalid values crash opaquely or bind the wrong port #483 port note.

Inventory and dispositions (grep of bin/, pm-stack/, pkgs/, scripts/, .opencode/ at 0cd5bd4b09)

site disposition
pm-stack/aggregator/scripts/gather-quota.ts QUOTA_SUBCOMMAND_TIMEOUT_MS converted here (successor of audit site :103 QUOTA_GATHER_TIMEOUT_MS)
pm-stack/aggregator/src/config.ts ALERT_ACK_WINDOW_MIN converted here
.opencode/skills/.../fleet-merge.ts FLEET_MAX_RETRIES gone — file no longer exists in the tree; nothing to convert
bin/socket-activation.mjs LISTEN_FDS, LISTEN_PID exempt — systemd socket-activation protocol, not service configuration; integer-guarded with a safe null (direct bind) fallback
bin/opencode-route-proxy.mjs OPENCODE_ROUTE_PROXY_NOW_MS exempt — test/incident-replay clock pin, Number.isFinite guarded, falls back to wall clock
pkgs/id/e2e/playwright.config.ts TEST_PORT exempt — test-only, `
pkgs/pkarr-worker/src/index.ts DNS_TTL exempt — optional DNS response TTL with a tolerant default; not a boot-time service argument
pkgs/bedside-and-away/external/gateway/proxy.mjs GATEWAY_PORT exempt — vendored external gateway; already Number.isInteger-checked with an explicit 1024–65535 boot throw

No site is left undispositioned; no straggler needed a follow-up issue.

Verification

  • bun run typecheck (aggregator) — clean.
  • bun test test/config.test.ts — 10 pass, 0 fail.
  • Bad-value smoke: QUOTA_SUBCOMMAND_TIMEOUT_MS=abc bun run scripts/gather-quota.ts → error: QUOTA_SUBCOMMAND_TIMEOUT_MS="abc" is not a valid millisecond count (expected an integer 1-2147483647), exit 1.

Closes #2837 (closing evidence also recorded on the issue). The design issue #2835 closes with this evidence once merged.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…e the #2835 contract

Phase 3 of #2835 (code#2837):
- pm-stack/aggregator/scripts/gather-quota.ts: QUOTA_SUBCOMMAND_TIMEOUT_MS
  (and the since-renamed QUOTA_GATHER_TIMEOUT_MS remainder) now parses
  digits-only millis 1..2^31-1 and fails at boot naming the variable.
- pm-stack/aggregator/src/config.ts: ALERT_ACK_WINDOW_MIN parses as a
  strict count >= 1 via parseAggregatorCount instead of Number() + clamp.
- pm-stack/README.md: the environment-number contract (spelling, kind
  ranges, boot-failure rule, named exemptions).
- bin/proxy-port.mjs: the same contract stated in the header for the
  bin/ family.
@dezren39
dezren39 requested a review from a team as a code owner November 16, 2026 13:56
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T13:56:08.384839Z
We couldn’t complete this review. Comment @codex review to try again.
674cfc8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aa217dca-6f49-4acb-9e7d-0c1fa5c8f748
Commits

Reviewing files that changed from the base of the PR and between 10fdd27 and 674cfc8.

Files selected for processing: 4

  • bin/proxy-port.mjs
  • pm-stack/README.md
  • pm-stack/aggregator/scripts/gather-quota.ts
  • pm-stack/aggregator/src/config.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@dezren39
dezren39 merged commit a756d08 into main Nov 16, 2026
1 check passed
@dezren39
dezren39 deleted the fix/2837-env-number-closing-inventory branch November 16, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 3 of #2835 — closing inventory audit for the env-number contract + contract docs

1 participant