Repository navigation
Add a Y2038 suite and move the existing 2038-limit tests into it - #224
Merged
Merged
Conversation
Most 2038 behaviour can be probed today with far-future dates and large durations, so the new `y2038` suite steps through values at the 32-bit signed and unsigned limits (and wider) for each time-bearing carrier. A cache that rejects, caps or wraps a value looks the same on the wire, so the first failing value in each series shows where behaviour changes. Moved, with ids and definitions unchanged (checked by diffing the exported suite before and after): the `max-age`, `Age`, `Expires` and `CDN-Cache-Control` large-value tests that previously lived in cc-freshness, age-parse, expires-parse and cdn-cache-control. New tests, all prefixed `y2038-`: - delta-seconds overflow for `max-age`, `s-maxage`, `stale-while-revalidate`, `stale-if-error` and `Age`, including 2^32 and 2^64 (which wrap to zero), and `Age` generation near 2^31 - far-future and past `Expires`, and far-future and past `Date` - `Last-Modified` after `Date` and at the epoch, 1969 and 1901 - `If-Modified-Since` echoed on revalidation, `If-Modified-Since` in the far future and past, and `If-Unmodified-Since`/`If-Range` forwarded unchanged - `Expires` and `Last-Modified` preserved on a stored response - boundary dates in asctime, and RFC 850 dates inside and outside the 50-year window (computed relative to now) Each test depends on an existing non-Y2038 control. `If-Unmodified-Since` and `If-Range` have no such control, so the suite adds an ordinary-date one for each. Not covered: a response with no `Date` (Node always adds one, so the engine would need an option to suppress it), and the clock rollover itself, which needs a cache with a controllable clock. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The first pass moved every existing large-value test. The ones that aren't tied to the 32-bit signed limit go back to where they were, byte for byte: `max-age=99999999999`, the `Expires` in 2286, and the two `CDN-Cache-Control` tests. Still moved: `max-age` and `Age` at 2147483647 to 2147483649, and the `Expires` of 19 Jan 2038 03:14:08. Test ids and definitions are unchanged throughout. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The y2038 suite keeps what sits on or near the 32-bit limits. Values that aren't tied to them now live with the existing tests for the same header: - `max-age` and `s-maxage` of 315360000, 99999999999, 2^63-1, 2^64 and a 100-digit number, and a `Date` in 9999 with `max-age=2` (cc-freshness) - `Age` at the same large values (age-parse) - `stale-while-revalidate` and `stale-if-error` of 99999999999 (stale) - `Expires` in 2262 and 9999, in IMF-fixdate and asctime (expires-parse) - `Expires` and `Last-Modified` preserved on a stored response, for 2262 and 9999 (other) - `If-Modified-Since` echoed exactly on revalidation, for 2262 and 9999 (conditional-lm) Also reduce the y2038 description to its first sentence. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Review of the current head (863976e). I found no blocking defects. I didn't run any of the new tests against a cache, so the cache-side expectations are as untested as the PR description says. Checked
Minor points
The first test to run against real caches should be the exact-echo This review was generated by Claude (Sonnet 5.5) at the PR author's request and posted with their go-ahead. It's a static read of the diff and the engine code plus the comparison scripts above; no human has checked the individual findings line by line. 🤖 Generated with Claude Code |
It named expected_type, which those requests don't set. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a
y2038suite that probes how caches cope with the Year 2038 problem (time held in a signed 32-bit integer), and moves the existing tests at that limit into it.Most 2038 behaviour can be tested now, because the origin controls every header it sends: far-future dates and large delta-seconds exercise the same arithmetic. A cache that rejects, caps or wraps a value looks the same on the wire (a miss), so each series steps through values and the first failing one shows where behaviour changes.
Migration
7 tests move into the new suite with their ids and definitions unchanged:
max-ageandAgeat 2147483647, 2147483648 and 2147483649 (the 32-bit signed limit), and theExpiresofTue, 19 Jan 2038 03:14:08 GMT. Large-value tests that aren't tied to that limit stay where they were:max-age=99999999999, theExpiresin 2286, and the twoCDN-Cache-Controltests. I exported the full suite before and after: all 371 existing definitions are identical, and the other suites keep their remaining tests in the same order. The moved tests keep their existingdepends_on; several still point atfreshness-nonerather than a stronger control, which I left alone to keep the move pure.New tests
109 tests: 85 in
y2038(ids prefixedy2038-) and 24 in the suites they belong to. The 32-bit limit tests go in the new suite; large values that aren't tied to it (99999999999, 2^63 and 2^64, a 100-digit number, a 10-yearmax-age, and the dates in 2262 and 9999) go with the existing tests for the same header:cc-freshness:max-ageands-maxageat those values, and aDatein 9999 withmax-age=2.age-parse:Ageat those values.stale:stale-while-revalidateandstale-if-errorat99999999999.expires-parse:Expiresin 2262 and 9999, in both IMF-fixdate and asctime.other:ExpiresandLast-Modifiedpreserved on a stored response.conditional-lm:If-Modified-Sinceechoed exactly on revalidation.What
y2038covers:max-age,s-maxage,stale-while-revalidate,stale-if-errorandAgeat 2^31 and 2^32 (which wraps to zero). AlsoAgegeneration near 2^31.ExpiresandDate: boundary dates from 1901 to 2106,max-agewinning over a pastExpires, and a far-futureDatewithmax-age=2going stale.Last-Modified: afterDate, and at the epoch, 1969 and 1901, for heuristic freshness.If-Modified-Sinceechoed exactly on revalidation,If-Modified-Sincein the far future and past, andIf-Unmodified-Since/If-Rangeforwarded unchanged.ExpiresandLast-Modifiedunchanged on a stored response.Tests where a wrong answer means serving a stale response as fresh are
required(Ageoverflow, far-futureDatewithmax-age=2, pastExpires, the RFC 850 window). Hit-expecting tests areoptimal, since a cache may cap lifetimes by policy. Informational tests arecheck.Every new test depends on an existing control in its own suite or a related one.
If-Unmodified-SinceandIf-Rangehave none, soy2038adds an ordinary-date control for each.Not covered
Date: Node always adds one, so the engine would need an option to suppress it.Verification
standardand schema validation pass, and everydepends_onresolves.If-Modified-Sincetests are the ones I'd check first.Test plan and code were drafted by Claude (Sonnet 5.5) from a plan the author supplied, with the author setting the approach (migrate the existing tests, keep their ids, depend on non-Y2038 controls). The author has not reviewed the individual test definitions line by line.
🤖 Generated with Claude Code