Skip to content

Conversation

@penalosa
Copy link
Contributor

@penalosa penalosa commented Feb 9, 2026

Fixes #6008

@penalosa penalosa requested review from a team as code owners February 9, 2026 18:23
@kentonv
Copy link
Member

kentonv commented Feb 9, 2026

IMO we should also adjust the validation code to still enforce that the date can't be newer than today.

diff --git a/src/workerd/io/compatibility-date.c++ b/src/workerd/io/compatibility-date.c++
index be2ec8b4f..6db121f05 100644
--- a/src/workerd/io/compatibility-date.c++
+++ b/src/workerd/io/compatibility-date.c++
@@ -115,6 +115,16 @@ static void compileCompatibilityFlags(kj::StringPtr compatDate,
                 "date supported by this server binary is \"",
                 SUPPORTED_COMPATIBILITY_DATE, "\"."));
       }
+
+      // workerd is built with SUPPORTED_COMPATIBILITY_DATE set a little bit into the futurue, so
+      // that the build can support setting the compat date to today until the next release is
+      // ready. But we don't want people to actually set their compat date in the future, so let's
+      // check against the clock time as well.
+      if (CompatDate::today() < parsedCompatDate) {
+        errorReporter.addError(
+            kj::str("Can't set compatibility date in the future: ", parsedCompatDate));
+      }
+
       break;
 
     case CompatibilityDateValidation::CURRENT_DATE_FOR_CLOUDFLARE:

@penalosa penalosa requested a review from a team as a code owner February 9, 2026 18:39
@MattieTK
Copy link
Member

MattieTK commented Feb 9, 2026

We should do a changelog on this or some other kind of comms. New docs and link to them as part of the error message. Happy to help do that.

@vicb
Copy link
Contributor

vicb commented Feb 9, 2026

@penalosa Looks like this test needs to be updated

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.

Set the supported compatibility date to a week in the future

5 participants