ADR-014 - Remove depth-first link expansion / dependency resolution#4
Open
richardTowers wants to merge 2 commits into
Open
ADR-014 - Remove depth-first link expansion / dependency resolution#4richardTowers wants to merge 2 commits into
richardTowers wants to merge 2 commits into
Conversation
Delete the LinkGraph traversal now that the breadth-first batch-SQL
implementation is the default, and drop the LINK_EXPANSION_IMPLEMENTATION
flag so LinkExpansion and DependencyResolution are thin entry points to
the new expander/resolver.
Removed: app/models/link_graph{,/node,/node_collection_factory}.rb,
lib/link_expansion/{link_reference,content_cache}.rb,
lib/dependency_resolution/link_reference.rb, and their specs.
Retained: app/queries/links.rb and app/queries/edition_links.rb, which
the new dependency resolver uses at the root; and
lib/link_expansion/edition_hash.rb.
Docs updated to describe the breadth-first / two-batch-SQL model and the
new console-debugging entry points.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Now that the breadth-first resolver is the only caller of Queries::Links, strip the has_own_links / is_linked_to EXISTS optimisation and its next_allowed_link_types_from/to and parent_content_ids parameters. These existed solely to let the old depth-first traversal prune which nodes were worth visiting and so minimise its one-query-per-node count. The breadth-first resolver batches a whole level per query, never passes those parameters, and only reads each link's content_id, so the whole machinery was computed-or-skipped but never consumed. This takes the class from ~240 lines to ~70 and drops the EXISTS subqueries the ADR flagged as significant SQL complexity. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <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.
This is the fourth in the series of ADR-014 PRs, starting with alphagov#4097
This removes the old implementation, and cleans up any code that's no longer required.