Repository navigation
fix: ArtifactGraph on stdlib TSort; declare every runtime dependency lib/ requires - #74
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/ requires `require "agentic"` could not load ArtifactGraph or AuthenticationSystem outside the dev bundle: artifact_graph.rb required rgl (Gemfile-only) and authentication_system.rb required base64 (a bundled gem since Ruby 3.4, and never used), while event_pipeline.rb required concurrent only through dry-core's transitive dependency. - ArtifactGraph keeps a Hash of artifact name => referenced names and lets TSort sort it; one Tarjan pass serves topological_sort and detect_cycles. detect_cycles now reports the artifacts that actually form each cycle, and a self-reference counts as one (TSort alone ignores self-loops). - The dead `require "base64"` is gone. - The gemspec declares concurrent-ruby (~> 1.3) and tsort (a bundled gem from Ruby 4.1); rgl leaves the Gemfile. - spec/lib_requires_spec.rb walks every require under lib/ and fails on anything that is neither Ruby's own library nor a declared runtime dependency, treating promoted-to-bundled gems as needing a declaration. Against main it reports exactly rgl, base64 and concurrent. Closes codenamev#63. 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 #63.
Install the gem the way a consumer does (a Gemfile with only
gem "agentic") andAgentic::ArtifactGraphraisesLoadError: cannot load such file -- rgl/adjacency,Agentic::HumanIntervention::AuthenticationSystemraisesLoadError: cannot load such file -- base64on Ruby >= 3.4. rgl lived in the Gemfile's dev group, base64 rode in on vcr's dependency, andrequire "concurrent"only worked because dry-core happens to depend on it.Workspace#initializebuilds anArtifactGraph, so the CLI and artifact-generator paths were broken for anyone outside the dev bundle. All three came in with #7; the published 0.2.0 predates them, so no released version is affected yet.What changes
ArtifactGraphkeeps a Hash of artifact name => referenced names and lets stdlibTSortsort it. One Tarjan pass (TSort.strongly_connected_components) serves bothtopological_sortanddetect_cycles; the functional form keeps TSort's methods off the class's public surface. Public methods, arities, return shapes,CircularDependencyError, and the dependencies-before-dependents guarantee are unchanged. Declaring rgl instead would have added four runtime gems (rgl, pairing_heap, rexml, stream) for eight graph methods; the CONSTITUTION's "auditable in an afternoon" core says no.detect_cyclesnow reports the artifacts that actually form each cycle, which is what its docstring always promised, instead of every vertex in the graph. A self-reference is handled explicitly (TSort alone treats a self-loop as a non-cycle).dependencies_ofreturns references in the order the artifact declared them rather than vertex-insertion order; nothing documented or in lib/ depends on either order.require "base64"is gone; the file never callsBase64.concurrent-ruby ~> 1.0(the same bound dry-* already asks for, so no consumer resolution changes) andtsort(a bundled gem from Ruby 4.1, same treatment asloggerandcgi). rgl leaves the Gemfile; the lock drops rgl, pairing_heap and stream.spec/lib_requires_spec.rbwalks everyrequireunder lib/ and fails on anything that is neither Ruby's own library nor a declared runtime dependency. Default gems Ruby has promoted (or announced it will promote) to bundled gems count as needing a declaration, viaGem::BUNDLED_GEMS::SINCEplus a literal copy of 4.0's table for interpreters without it. Run againstmainit reports exactly rgl ×3, base64 and concurrent, and nothing else. No network, ~50 ms.Tests: graph + workspace + guard + pack specs 84/84; full suite 1393 examples on Ruby 4.0.2 with only the known
event_dispatcher_integration_spec.rb:291wall-clock flake that #36 de-flakes. A 20,000-deep reference chain sorts in 42 ms (TSort uses an explicit stack).Follow-ups, not in this PR: #64 refreshes the dev lock (its base64 hunk is identical to this one, so either merge order is clean);
authentication_system.rbalso requiresopensslandjsonwithout using them (same orphan pattern, one seat noticed it, trivial to drop with #58's deprecation).Intended labels:
loop:drain,loop:deps.Panel
TSort.*form chosen overinclude TSortso nothing new goes public. Nit taken: none needed.add_node: every rough edge is pre-existing and byte-equivalent to rgl's behaviour, and the LLM entry path already normalisesreferenceswithArray(). One seat predictedSystemStackErroron a ~2000-deep chain; two seats and a direct 20k-node run refute it.BUNDLED_GEMS::SINCEthere) gives the same verdict on all 35 requires; deterministic, no network. Nits taken: the literal fallback list now carries 4.0's full table (so CI's verdict matches local), and the require list is deduped beforefind_by_path.dependents_ofis a full scan now where rgl was O(out-degree); only caller is a single pass-through inWorkspace.ArtifactGraphnever shipped (0.2.0 is the last release), nothing serialises the graph, saved agents and plans untouched. Nit taken:concurrent-rubyloosened from~> 1.3to~> 1.0so no downstream lock pinned at 1.2.x hits a resolver conflict.🤖 Generated with Claude Code