From 5271217e2cf635228690d93d843b4b741e83d029 Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Wed, 1 Jun 2022 08:39:55 -0700 Subject: [PATCH] Add an assertion for the Y10K bug --- src/__Private/is_compatible_schema_version.hack | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/__Private/is_compatible_schema_version.hack b/src/__Private/is_compatible_schema_version.hack index adbeb3a08..707e01984 100644 --- a/src/__Private/is_compatible_schema_version.hack +++ b/src/__Private/is_compatible_schema_version.hack @@ -21,6 +21,12 @@ use namespace HH\Lib\Str; * Facebook\HHAST\SCHEMA_VERSION. */ function is_compatible_schema_version(string $other_version): bool { + invariant( + Str\length($other_version) === Str\length(SCHEMA_VERSION) && + Str\length($other_version) === Str\length(LATEST_BREAKING_SCHEMA_VERSION), + '%s needs updating or a Y10K bug occurs', + __FILE__, + ); return Str\compare($other_version, SCHEMA_VERSION) <= 0 && Str\compare($other_version, LATEST_BREAKING_SCHEMA_VERSION) >= 0; }