Make InheritableSetting's raw stores internal (series finale)#2810
Open
ericproulx wants to merge 10 commits into
Open
Make InheritableSetting's raw stores internal (series finale)#2810ericproulx wants to merge 10 commits into
ericproulx wants to merge 10 commits into
Conversation
Router::Pattern::Path reads exactly six values; the merged dump of both full stores in Endpoint#prepare_default_path_settings carried everything else as dead weight. The nil-tolerant guards in Path replace the key?-presence checks (absent and nil are equivalent under the always- present-keys snapshot). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…r private namespace_stackable and namespace_inheritable are no longer public API: every semantic key is reachable only through its dedicated accessor. inherit_from's peer access continues to work through protected. The storage-engine specs reach in explicitly via __send__. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… doc Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…er impact Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Danger ReportNo issues found. |
grape-swagger reads the stackable store directly (documentation adder, token owner resolver, and the route param parser that walks the StackableValues chain), so only namespace_inheritable narrows to protected; namespace_stackable stays public, documented as read-only with the dedicated accessors preferred. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
root_prefix and format stand in for the arbitrary keys the storage specs used; the api_spec recompile regression keeps its intent through the version_options reader; inside_route_spec's captured settings hash was never consumed and is removed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
External reads warn with a pointer to the semantic accessors so grape-swagger gets a migration signal; Grape itself reads the ivar (with a protected raw reader for inherit_from/copy_state_from peer access) and never warns. Storage specs move to add_helper/helpers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Matches the stackable side: internal access reads the ivar, the protected reader exists purely for inherit_from/copy_state_from peer access. Also repairs the deprecation message, which an earlier conversion had mangled into Setting#@namespace_stackable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Data.define with nil defaults, following the RescueOptions / VersionOptions precedent: Path reads typed members instead of hash keys, so a mistyped member fails loudly instead of returning nil. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Producer-side placement following the RescueOptions / VersionOptions precedent, and it fixes the dependency direction: Util no longer constructs a Router-namespace class; Router::Pattern::Path depending on Util is the normal direction. Building the snapshot must stay on InheritableSetting regardless, since only it may touch the raw stacks. 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.
The finale of the
InheritableSettingencapsulation series (targets the #2809 integration branch; #2795–#2808 built the accessor catalog): the raw stores become internal where the ecosystem allows.namespace_inheritableis now protected andnamespace_stackable_with_hashprivate — every inheritable key is reachable only through its dedicated accessor.namespace_stackabledeliberately stays public but deprecated: grape-swagger reads it directly (see below), so external reads warn throughGrape.deprecatorwith a pointer to the semantic accessors, while Grape itself reads the underlying ivar (peer access ininherit_from/copy_state_fromgoes through a protected raw reader) and never warns. The reader gets removed or narrowed in a future major once grape-swagger migrates; a spec pins the deprecation. Theroute/namespace/globalscratch stores (backingroute_setting/namespace_setting/global_setting) also stay public.Commits
path_settings— the last raw consumer,Endpoint#prepare_default_path_settings, merged full dumps of both stores per endpoint whileRouter::Pattern::Pathreads exactly six values (full mount-path stack, root prefix, format, raw content-types stack, version, version options).InheritableSetting#path_settingssnapshots precisely those into aGrape::Util::InheritableSetting::PathSettingsvalue object (Data.definewith nil defaults, following theRescueOptions/VersionOptionsprecedent — a mistyped member fails loudly instead of returning nil),to_routesuses it, the old method is deleted, andPathreads typed members with nil-tolerant guards replacing thekey?-presence checks (equivalent under always-present members — verified case by case). Two semantics deliberately preserved:mount_pathis the full stack (unlike the scalar#mount_pathaccessor, which is.firstfor the versioner), via.presenceso an unmounted API still contributes no path part; andcontent_typesstays the raw registration stack becauseArray(...).size == 1counts registrations, not distinct formats — a latent duplicate-registration quirk flagged for a separate fix rather than silently changed here.namespace_inheritablemoves toprotected(peer access ininherit_from/copy_state_fromkeeps working), the deep-merge helper toprivate. No spec reaches around the visibility: the storage-engine specs exercise the inheritable store's semantics (inheritance, nearest-wins, point-in-time copies, to_hash) through public accessors (root_prefix,format,version_options) instead of raw keys, and an unused captured-settings hash ininside_route_spec's endpoint dummy is removed.path_settingscloses the catalog as the one cross-cutting projection, and the class doc now describes what the class has become: the settings registry whose accessor naming encodes semantics (add_*= stacking,== nearest-wins scalar,!/?= flag).mount_paths+ docs — a public reader for the full mount-path stack (used bypath_settings, and the migration target for grape-swagger below), plus CHANGELOG/UPGRADING.grape-swagger (found by code search — the reason
namespace_stackablestays public)grape-swagger's current master reaches into
namespace_stackablein three files. Nothing breaks with this PR — the reads now emit a deprecation warning pointing at the accessors; the table below is the migration:swagger_documentation_adder.rbnamespace_stackable[:namespace]/[:mount_path]inheritable_setting.namespaces.last/inheritable_setting.mount_paths.join('/')token_owner_resolver.rbnamespace_stackable[:helpers]behindrespond_to?inheritable_setting.helpersrequest_param_parsers/route.rbStackableValues#inherited_valueschain manually for per-scope paramsInheritableSetting) — not a mechanical renameBooks
Metrics/ClassLength330 → 340 (path_settings+mount_pathsland the class at 331 lines).🤖 Generated with Claude Code