Repository navigation
Load lib/agentic through Zeitwerk alone; drop 57 require_relative lines, add loader spec - #78
Open
minerva-sky wants to merge 1 commit into
Open
minerva-sky wants to merge 1 commit into
minerva-sky wants to merge 1 commit into
Conversation
lib/agentic.rb makes Zeitwerk the single code loader and says files must not require_relative their siblings. 57 lines in 26 files did it anyway, all reintroduced by the codenamev#7 merge two months after 11c9407 took the count to zero, because nothing tested the promise behind the rule. Delete all 57 (every target is a loader-managed file under lib/agentic/) plus the inline require_relative in VerificationHub#add_strategy_from_factory, which did a path lookup on every call. Add spec/zeitwerk_spec.rb: a fresh process eager-loads the gem with force: true (so lib/agentic/cli is walked too) and resolves Agentic::CLI, and a second example fails on any require_relative that comes back under lib/agentic/. Closes codenamev#57 Co-Authored-By: Claude Fable 5.1 <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.
Closes #57.
lib/agentic.rbopens with a rule: Zeitwerk is the single loader, files must notrequire_relativetheir siblings. Then 26 files underlib/agentic/break it, 57 times. The history is exact: 11c9407 took the count to zero in July and wrote the rule; #7 brought every line back in one merge in September. No build went red in between, because nothing tested the promise behind the rule. A rule the codebase breaks 57 times is a comment, and this PR makes it a rule again.What changed
require_relativeunderlib/agentic/is gone. I checked each target: all 57 resolve to loader-managed files, none to a gem or anything outside the tree. Stdlib and gemrequires stay, as the header says they should.require_relative "strategy_factory"insideVerificationHub#add_strategy_from_factoryis gone too. It did a path lookup on every call for a constant the loader serves on first reference.spec/zeitwerk_spec.rb, two examples. The first boots a fresh interpreter,require "agentic", finds the gem's loader and callseager_load(force: true)solib/agentic/cli(excluded from normal eager loading) is walked as well, then resolvesAgentic::CLI. Fresh process on purpose: inside the suite, spec_helper has already loaded half the tree, and a file that only loads because its neighbour loaded first would hide. The second example grepslib/agentic/**/*.rbforrequire_relativeand names file and line on any hit. The first tests the promise, the second tests the rule. Together they cost about 0.35s.No constant, method, signature, or file path changes.
require "agentic"consumers see nothing. Zeitwerk already owned these files, so autoload timing is the same work the deleted lines did, once per constant, never per call.Evidence
event_dispatcher_integration_spec.rb:291, the wall-clock< 0.1assertion fix: de-flake EventDispatcher integration timing spec #36 de-flakes. I ran that example in isolation on untouchedupstream/mainand it fails there too, so it is not this diff.standardrbclean.Agentic::CLI,Agentic::CLI::Streaming::EnhancedProgressTracker,Agentic::HumanIntervention::Portalall resolve afterforce: true.Zeitwerk::Registry.loadersis semi-internal. I checked it exists in both 2.6.16 (locked) and 2.8.3 (where deps: refresh the dev lockfile within its constraints; cap parallel and simplecov for the 3.2 floor #75 lands), and the spec aborts with a clear message if the tag lookup ever returns nil.Rebase note
#68 rewrites
security/secure_error_mixin.rbfrom line 4 down; this PR deletes line 3 of the same file. Whichever lands second gets a one-line conflict on that file and nothing else. The other open PRs touchingworkspace.rb(#30, #67, #73) andfile_generation_capability.rb(#50) work hundreds of lines below the deleted requires.Intended labels:
loop:drain.Panel
Three seats per expert, majority rule per criterion.
bundle exec rakehas no other lint slot for it).Module#autoload, which the VM serializes per constant, so no new race; every deleted target is loader-managed; no top-level side effects depended on load order (register_standard_capabilitiesandSchemas.register_all!are explicit calls).require "agentic/security"andrequire "agentic/human_intervention/portal"bare, both still load.12/12 criteria cleared, 0 revisions.
🤖 Generated with Claude Code