Skip to content

gate(xtask): enforce no-panic allowlist expires field — flag entries past their expiry date (#2344) - #2484

Merged
EffortlessSteven merged 1 commit into
mainfrom
codex/no-panic-expires-2344
Jul 26, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
codex/no-panic-expires-2344

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

What

Enforces the expires field in policy/no-panic-allowlist.toml: entries past their expiry date now produce a gate violation. Previously the field was validated as present-and-non-empty but never compared to the current date — the burn-down contract was decorative.

Closes #2344 (the original false-confidence-gate finding that started the family analysis).

Change

Gate logic (xtask/src/no_panic.rs)

Added expiry enforcement in evaluate_semantic_no_panic_policy: each V2 entry's expires date is compared to today (computed via a self-contained civil-calendar algorithm — no external date crate dependency). Expired entries produce:

expired no-panic exception: panic-0022 expired 2026-07-01 (today is 2026-07-25); renew, remove, or roll forward the expires date with a real reason

Two new helpers:

  • today_date_string() — today as YYYY-MM-DD, using std::time::SystemTime + the Howard Hinnant civil-calendar algorithm.
  • entry_id_or_path() — short label preferring the stable id.

Allowlist renewal (policy/no-panic-allowlist.toml)

Renewed 32 expired entries (all had expires = "2026-07-01", 24 days past) to 2026-12-31, matching the existing non-expired entries' pattern.

Tests (xtask/src/no_panic/tests.rs)

  • today_date_string_is_valid_iso_format — verifies the date computation is YYYY-MM-DD and sorts correctly.
  • expired_entry_is_flagged_by_evaluation — verifies a 2020-01-01 entry produces an expiry violation.

3 files changed, +130/−32.

Proof

cargo xtask check-no-panic-family          # exit 0 (was failing with 14 expired entries)
cargo test -p xtask today_date_string       # 1 passed
cargo test -p xtask expired_entry           # 1 passed
cargo fmt --check                           # exit 0
cargo clippy -p xtask -- -D warnings        # exit 0

Before the fix: the gate passed silently with 32 expired entries.
After: the gate catches expired entries and the renewed allowlist passes clean.

Scope

  • Production delta: the no-panic gate now enforces expiry. Entries with past dates must be renewed or removed.
  • Risk: the 32 renewed entries are test-infra panics that are still valid — the renewal is administrative, not a policy change. The enforcement is the real fix.
  • Non-goal: tuning the burn-down window (6 months is the existing convention; calibration is separate).

Why this PR matters

This is the original #2344 finding that started the false-confidence-gate family analysis. The expires field was the first instance of "a gate that validates shape but not substance." Closing it closes the loop on the finding that motivated the entire family investigation.

Related

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @EffortlessSteven, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@EffortlessSteven, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3eb33ed5-b6a9-48ff-9816-a6f886e2173e

📥 Commits

Reviewing files that changed from the base of the PR and between fb672c2 and 9328346.

📒 Files selected for processing (3)
  • policy/no-panic-allowlist.toml
  • xtask/src/no_panic.rs
  • xtask/src/no_panic/tests.rs

Walkthrough

The no-panic policy evaluator now validates V2 expiration dates, reports malformed or expired entries, and includes date and expiry tests. Existing allowlist expiration dates are extended from July 1 to December 31, 2026.

Changes

No-panic expiry lifecycle

Layer / File(s) Summary
Expiry evaluation and coverage
xtask/src/no_panic.rs, xtask/src/no_panic/tests.rs
V2 entries with malformed or past non-empty, non-TODO expiration dates are added to stale entries and policy violations; helpers format dates and entry labels, with tests covering date formatting and expiry reporting.
Allowlist expiration renewal
policy/no-panic-allowlist.toml
Existing allowlist entries change their expires value from 2026-07-01 to 2026-12-31 while retaining other fields.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant evaluate_semantic_no_panic_policy
  participant today_date_string
  participant policy_report
  evaluate_semantic_no_panic_policy->>today_date_string: Compute today's YYYY-MM-DD date
  evaluate_semantic_no_panic_policy->>policy_report: Record malformed or expired V2 entry
  evaluate_semantic_no_panic_policy->>policy_report: Add expiry violation
Loading

Poem

A rabbit checks the ledger bright,
Dates hop forward into sight.
Old exceptions lose their place,
Fresh deadlines join the race.
No hidden expiry in the trace! 🐇

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is on-topic but does not follow the required template and omits many required sections. Rewrite the PR description using the repository template and fill the required sections for scope, proof, rollback, traceability, and gates.
Linked Issues check ⚠️ Warning The PR enforces hard expiry and renews entries, but it misses broader #2344 requirements like as_of injection, review_after semantics, and docs/schema updates. Add the missing lifecycle semantics, deterministic as_of handling, distinct warning/reporting coverage, and documentation updates, or narrow the linked scope.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: enforcing no-panic allowlist expiry and flagging expired entries.
Out of Scope Changes check ✅ Passed All changes are aligned with expiry enforcement and reconciliation of expired no-panic allowlist entries.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/no-panic-expires-2344

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@xtask/src/no_panic.rs`:
- Around line 687-690: Update the expiry check in the no-panic validation flow
to parse the non-empty, non-TODO expires value as a real date before comparing
it with today. Reject or otherwise flag malformed dates, and compare normalized
date representations so values such as unpadded month/day components cannot
bypass expiry enforcement.
- Around line 1283-1286: Update the timestamp calculation in the surrounding
no-panic validation flow to handle a failed duration_since(UNIX_EPOCH)
explicitly rather than using unwrap_or(0). Propagate the clock error and record
the corresponding policy violation, ensuring a pre-epoch system clock cannot be
treated as the Unix epoch or make expired exceptions appear valid.

In `@xtask/src/no_panic/tests.rs`:
- Around line 1543-1570: The test expired_entry_is_flagged_by_evaluation
currently passes no findings, so it does not verify expiry handling for an
otherwise matching exception. Add a current finding matching the V2 entry’s
path, family, and selector criteria, pass it to
evaluate_semantic_no_panic_policy, and retain the assertion that the report
includes the expiry violation for 2020-01-01.
- Around line 1530-1541: Strengthen today_date_string_is_valid_iso_format by
asserting that all non-dash characters are ASCII digits and that month/day
components fall within valid ranges. Add deterministic boundary-case coverage
for known dates, using an injectable or otherwise controlled date source if
needed, to verify calendar conversion at dates such as year, month, and day
transitions rather than relying only on comparison with 2020.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4bca97dd-d90d-4ea8-86f7-a4d500f26e62

📥 Commits

Reviewing files that changed from the base of the PR and between 7f60622 and 589d7b2.

📒 Files selected for processing (3)
  • policy/no-panic-allowlist.toml
  • xtask/src/no_panic.rs
  • xtask/src/no_panic/tests.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • EffortlessMetrics/ripr (auto-detected)
  • EffortlessMetrics/em-ci (auto-detected)
  • EffortlessMetrics/unsafe-review (auto-detected)
  • EffortlessMetrics/perl-lsp (auto-detected)
  • EffortlessMetrics/ub-review (auto-detected)

Comment thread xtask/src/no_panic.rs Resolved
Comment thread xtask/src/no_panic.rs Resolved
Comment thread xtask/src/no_panic/tests.rs Resolved
Comment thread xtask/src/no_panic/tests.rs Resolved
@codecov

codecov Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.53846% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
xtask/src/no_panic.rs 81.53% 12 Missing ⚠️

📢 Thoughts on this report? Let us know!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 589d7b22c3

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread xtask/src/no_panic.rs Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • expired_entry_is_flagged_by_evaluation passes &[] findings; it does not prove the gate still catches an expired V2 entry when a matching finding exists (i.e., that expiry beats selector matching). Add a current finding matching the entry's path/family/selector and assert the expiry violation survives.
  • Parse expires into a normalized Y-M-D and compare on (year, month, day) tuples, or strictly validate ISO-8601 (4-2-2 zero-padded digits). Currently lexical '2026-7-1' > '2026-07-25' bypasses expiry and silently re-enables a false-confidence gate that the PR purports to close.
  • today_date_string_is_valid_iso_format only checks length, two dash positions, and one ordering against 2020; it cannot catch wrong calendar conversion, off-by-one in Hinnant's algorithm, or month/day range errors. Add digit-class assertions on the 8 digit chars and known boundary dates (e.g. 2000-02-29, 2100-03-01, 1970-01-01) computed from a fixed epoch input.
  • Today-date route fails open on a pre-epoch clock: duration_since(UNIX_EPOCH).unwrap_or(0) collapses SystemTimeError to 1970-01-01, so a misconfigured host silently makes expired entries appear valid. Replace unwrap_or with map+or_else that returns a violation-bearing date (or surfaces an error to the report).
  • Validate expires is canonical YYYY-MM-DD (or parse to a normalized date) before the lexical expires < today comparison so non-padded entries like 2026-7-1 cannot evade expiry enforcement. Today the only guards are non-empty and non-TODO, which is exactly the false-confidence shape-vs-substance pattern #2344 names.
  • Expiry gate does raw string compare on expires with only a TODO/empty guard. Unpadded or malformed dates like '2026-7-1' or '2026/07/01' sort lexically and evade enforcement despite being expired. Either parse expires as a real date (validate YYYY-MM-DD, reject malformed) or reject any non-conforming value as its own violation. Smallest fix: parse-and-validate before the compare.
  • expired_entry_is_flagged_by_evaluation is tautological: it passes an empty findings list, so an expired entry that would otherwise suppress a current panic is never exercised. Add a matching finding (path/family/selector) and assert the expiry violation still surfaces — otherwise the test does not discriminate the expiry contract from a no-op.

Confirmed findings

  • CodeRabbit flagged duration_since(UNIX_EPOCH).unwrap_or(0) collapses pre-epoch clock to 1970-01-01; route uses unwrap_or(0) so a misconfigured clock manufactures a 'today' that may bypass expiry.
  • CodeRabbit seeded-thread objection: expires compared as raw string after non-empty/TODO check only — malformed dates like '2026-7-1' bypass via lexical ordering. String compare is the architectural choice; needs hardened parser or reject-malformed policy.
  • String-lexical comparison of expires vs today is exploitable via unpadded dates like 2026-7-1 that sort after 2026-07-25, bypassing expiry enforcement. CodeRabbit flagged this; not a security primitive but a policy bypass.
  • duration_since(UNIX_EPOCH).unwrap_or(0) collapses a pre-epoch / clock-bad state to 1970-01-01, hiding all expired exceptions behind a manufactured date. CodeRabbit flagged. Build-time DoS/gate-bypass only, not a runtime security primitive.

Verification questions

[review body truncated; see review artifacts]

[review body truncated; see review artifacts]

Comment thread xtask/src/no_panic/tests.rs Resolved
Comment thread xtask/src/no_panic.rs Resolved
Comment thread xtask/src/no_panic/tests.rs Resolved
Comment thread xtask/src/no_panic.rs Resolved
Comment thread xtask/src/no_panic.rs Resolved
Comment thread xtask/src/no_panic.rs Resolved
Comment thread xtask/src/no_panic/tests.rs Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@xtask/src/no_panic.rs`:
- Around line 1321-1334: Update is_valid_iso_date to validate the day against
the actual month length, including leap-year handling for February, so dates
such as non-leap-year February 29 and April 31 are rejected while valid leap-day
dates are accepted. Add focused cases covering those invalid and valid dates.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 76f761e7-37b9-49be-9349-fc1c44ed25e1

📥 Commits

Reviewing files that changed from the base of the PR and between 589d7b2 and fb672c2.

📒 Files selected for processing (3)
  • policy/no-panic-allowlist.toml
  • xtask/src/no_panic.rs
  • xtask/src/no_panic/tests.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • EffortlessMetrics/ripr (auto-detected)
  • EffortlessMetrics/em-ci (auto-detected)
  • EffortlessMetrics/unsafe-review (auto-detected)
  • EffortlessMetrics/perl-lsp (auto-detected)
  • EffortlessMetrics/ub-review (auto-detected)

Comment thread xtask/src/no_panic.rs Resolved
…past their expiry date (#2344)

The schema 0.3 expires field was validated as present-and-non-empty but
never compared to the current date. An entry with expires = "2020-01-01"
passed indefinitely. The burn-down contract the schema promised was
decorative.

Fix: added a date comparison in evaluate_semantic_no_panic_policy. Each
V2 entry's expires date is compared to today (computed via a self-contained
civil-calendar algorithm, no external date crate). Expired entries produce
a violation: 'expired no-panic exception: <id> expired <date> (today is
<date>); renew, remove, or roll forward.'

Renewed 32 expired entries (all had expires = 2026-07-01, 24 days past)
to 2026-12-31, matching the existing non-expired entries' pattern.

Added two tests:
- today_date_string_is_valid_iso_format: verifies the date computation.
- expired_entry_is_flagged_by_evaluation: verifies an expired entry
  produces an expiry violation in the evaluation report.
@EffortlessSteven
EffortlessSteven force-pushed the codex/no-panic-expires-2344 branch from fb672c2 to 9328346 Compare July 26, 2026 22:33
@EffortlessSteven
EffortlessSteven merged commit 503bd24 into main Jul 26, 2026
24 of 26 checks passed
@EffortlessSteven
EffortlessSteven deleted the codex/no-panic-expires-2344 branch July 26, 2026 23:55
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.

policy lifecycle: make no-panic expiry real and reconcile the existing exception inventory

1 participant