From 83625188c62226fb412c7c6fc5edf56c7e376fd2 Mon Sep 17 00:00:00 2001 From: Florent Beaurain Date: Thu, 28 May 2026 10:41:42 +0200 Subject: [PATCH] Require sorbet-runtime from each checker entrypoint packwerk 3.3.0 dropped its runtime dependency on sorbet-runtime. The README documents adding individual checkers to packwerk.yml's `require:` list (e.g. `- packwerk/privacy/checker`), which bypasses the umbrella `packwerk-extensions.rb` entrypoint where `require 'sorbet-runtime'` currently lives. Once packwerk no longer pulls sorbet-runtime in for us, evaluating a checker file hits `extend T::Sig` / `T.let` before `T` is defined and fails with `uninitialized constant Packwerk::Privacy::T (NameError)`. Load sorbet-runtime at the top of each documented entrypoint so individual checker requires are self-sufficient. The require cascades through `package.rb`, `validator.rb`, etc., which also use `T::` constants. Co-Authored-By: Claude Opus 4.7 (1M context) --- lib/packwerk/folder_privacy/checker.rb | 1 + lib/packwerk/layer/checker.rb | 1 + lib/packwerk/privacy/checker.rb | 1 + lib/packwerk/visibility/checker.rb | 1 + 4 files changed, 4 insertions(+) diff --git a/lib/packwerk/folder_privacy/checker.rb b/lib/packwerk/folder_privacy/checker.rb index b3c0afe..a5d9005 100644 --- a/lib/packwerk/folder_privacy/checker.rb +++ b/lib/packwerk/folder_privacy/checker.rb @@ -1,6 +1,7 @@ # typed: strict # frozen_string_literal: true +require 'sorbet-runtime' require 'packwerk/folder_privacy/package' require 'packwerk/folder_privacy/validator' diff --git a/lib/packwerk/layer/checker.rb b/lib/packwerk/layer/checker.rb index f691349..86cb5b7 100644 --- a/lib/packwerk/layer/checker.rb +++ b/lib/packwerk/layer/checker.rb @@ -1,6 +1,7 @@ # typed: strict # frozen_string_literal: true +require 'sorbet-runtime' require 'packwerk/layer/config' require 'packwerk/layer/layers' require 'packwerk/layer/package' diff --git a/lib/packwerk/privacy/checker.rb b/lib/packwerk/privacy/checker.rb index a7f4340..2ec8bfa 100644 --- a/lib/packwerk/privacy/checker.rb +++ b/lib/packwerk/privacy/checker.rb @@ -1,6 +1,7 @@ # typed: strict # frozen_string_literal: true +require 'sorbet-runtime' require 'packwerk/privacy/package' require 'packwerk/privacy/validator' diff --git a/lib/packwerk/visibility/checker.rb b/lib/packwerk/visibility/checker.rb index 8d1de12..4c11237 100644 --- a/lib/packwerk/visibility/checker.rb +++ b/lib/packwerk/visibility/checker.rb @@ -1,6 +1,7 @@ # typed: strict # frozen_string_literal: true +require 'sorbet-runtime' require 'packwerk/visibility/package' require 'packwerk/visibility/validator'