Repository navigation
refactor(checker): consolidate hardcoded name lists into the semantic registry - #160
Conversation
… config
Behavior-preserving deduplication, net -155 lines.
Checker inference: one find_arg behind infer_rep/infer_seq; one
conservative_element_type for the three $/[[ fallbacks; one
emit_not_callable and one infer_args_for_diagnostics for the repeated
RY070 emit/args-walk tails; a total join_all shared by the five
return-collection folds (seeds from the first element: join is
opaque-absorbing); json_rtype_scalar made pub(crate) with the
json_rtype_to_rtype_shallow wrapper deleted; json_length_to_length for
the JsonLength->Length mapping; insert_loop_carried_bindings returns ();
the always-true post-saturating_add length guard unwrapped; the seq
variant of the arg finder rebuilt on find_arg; the caller-side
debug_assert moved into build_data_frame_schema; HigherOrderCall
destructured away.
Checker top level: run_passes shared by check/check_with_scope;
CallerVisibleSignature wraps Vec<UserParam> instead of mirroring it;
insert_parameter_default delegates to insert and re-applies its marker
sets; EnvironmentProfile machinery inlined into top_level_scope;
resolves_to_base_lenient/resolves_to_base share one impl behind a
guard flag; BASE_DATABASE_PACKAGES names the standard-package list
once; equality-aware Project setters share set_if_changed; the concise
and full writers share write_concise_header and OutputFormat::is_human.
Every hand-rolled rsplit_once("::") bare-name expression now goes
through semantic_lists::bare_name, and the Arith operator arm lists use
BinOpKind::is_arithmetic.
CLI/workspace/config: watch mode shares rescan/sync_stamps; CheckResult
shares counts(); the clap default reuses ry-config's
DEFAULT_OUTPUT_FORMAT; workspace_context inlined at its two callers;
the local serialized_cache layer deleted in favor of the process-wide
stamped cache in serialized_inventory; load_base_cached's race dance
reduced to get/set/get; IndexConfig drops its redundant per-field serde
default functions.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline, one informational note below.
Reviewed changes
Reviewed all 8 files of the diff at 0a7fac7 — five hardcoded name lists consolidated into the semantic_lists registry, plus registry entries, claim docs, and coherence tests.
- Registry migration of five lists:
S3_MATH_GENERICS(27),S3_SUMMARY_GENERICS(7),GROUP_GENERICS,S7_OBJECT_CONSTRUCTORS, andQUOTING_FORMSmove intocrates/ry-checker/src/semantic_lists.rswith per-list claim docs and registry entries; call sites incollect.rs,higher_order.rs,infer/call.rs,infer/index.rs, andinfer/mod.rsnow read the constants viais_group_generic/is_quoting_form/directcontains. - Coherence-test widening:
base_typeshed_names/rlang_typeshed_namesalso consultglobals.ambient_functionsandglobals.s3_generics, plus two new R-oracle tests (S7 constructors, quoting forms) that genuinely fail when R rejects the probed names. - Doc corrections: the stale promise-capture doc on
is_callable_object_constructoris rewritten to match its S7 behavior, andgeneric_argument_may_dispatchnow documents whymeanstays a special case.
Verification done in this run: all five lists checked byte- and order-identical against the removed literals; vendor base.json membership claims confirmed (24 Math members in functions plus acosh/asinh/atanh ambient-only, all 7 Summary in functions, all 4 group names in globals.s3_generics, mean absent from s3_generics); worktree-wide grep finds zero leftover inline copies; cargo test -p ry-checker --test semantic_lists 19/19 locally; cargo clippy -p ry-checker --all-targets -- -D warnings clean.
ℹ️ The registry's no-escape guarantee misses pub(crate) const lists — NSE_SYMBOL_FNS is unregistered and unaccounted
The PR's migrated and deliberately-not-migrated accounting omits NSE_SYMBOL_FNS (crates/ry-checker/src/infer/index.rs:604), a 25-member hardcoded semantic name list that drives is_nse_symbol_fn. It is neither registered nor visible to no_unregistered_hardcoded_lists, because scan_file only matches lines whose trimmed text starts with const — pub(crate) const NSE_SYMBOL_FNS: &[&str] slips through. If that prefix were fixed, the test would immediately fail until this list is registered or given a documented exclusion, so the registry's "every hardcoded list" claim currently overstates what the guard enforces. Mergeable as-is if this list is planned for a later PR in the sprint — worth one accounting line either way.
Technical details
# NSE_SYMBOL_FNS escapes the semantic-lists registry
## Affected sites
- crates/ry-checker/src/infer/index.rs:604 — `pub(crate) const NSE_SYMBOL_FNS: &[&str]` (25 members: ggplot2/rlang/tidyselect/base/data.table NSE names), consulted by `is_nse_symbol_fn`; not in `semantic_lists::registry()` and not in `known_non_semantic`.
- crates/ry-checker/tests/semantic_lists.rs:334 — `scan_file` uses `trimmed.strip_prefix("const ")`, so any `pub const` / `pub(crate) const` slice outside `semantic_lists.rs` is invisible to `no_unregistered_hardcoded_lists`. A worktree grep confirms `NSE_SYMBOL_FNS` is the only such escape today (`BASE_DATABASE_PACKAGES` is private `const` and allow-listed).
## Required outcome
- The PR body's migrated/not-migrated accounting mentions `NSE_SYMBOL_FNS` (register it, exclude it with a justification, or name the sprint PR that will), and/or the scan strips an optional `pub(crate)`/`pub` prefix so the guard matches the module doc's "every hardcoded list" claim. Note: fixing the scan alone turns the test red until the list is registered or excluded.
## Open questions for the human
- Is `NSE_SYMBOL_FNS` scheduled for PR 6/7 of this sprint? If yes, a one-line note in the PR description is sufficient for this PR.openai-compatible/glm-5.3 | 𝕏
|
Addressed the S7 export-list finding in 6272a44: the coherence probe now checks |
There was a problem hiding this comment.
✅ No new issues found — the follow-up cleanly addresses the prior review's oracle feedback.
Reviewed changes
Reviewed the delta since the prior pullfrog review at 0a7fac7 — one commit tightening the S7 coherence oracle in crates/ry-checker/tests/semantic_lists.rs.
- Tightened the S7 oracle to pin the export claim:
s7_object_constructors_match_r_oraclenow checks membership ingetNamespaceExports("S7")instead of namespace-levelexists(..., where = asNamespace("S7")), so the assertion matches the claim doc ("exported by the S7 package") and theS7::<name>call syntax the production matcher actually keys on. The prior suggestion was applied verbatim, plus a comment explaining the export-list rationale.
Verification done in this run: full-diff TOC coverage across all 8 files; cargo test -p ry-checker --test semantic_lists 19/19 pass locally including the updated S7 oracle; the prior inline thread is resolved as addressed.
openai-compatible/glm-5.3 | 𝕏

Cleanup sprint, PR 5 of 7 (stacks on #159). Addresses the in-repo half of #49/#41. Net +174 lines (+208/−34) — the one PR in this sprint that grows the tree, deliberately: the
semantic_listsregistry pattern mandates per-list claim docs, registry entries, and coherence tests (~15-20 lines per list × 5), and that guard rail is the point. The call-site literals it deletes were only ~15 lines. If you'd rather keep the tree shrinking and drop the registry overhead, rejecting this PR alone is coherent — the analysis it produced for #49/#41 survives in the issue comments either way.What
Five hardcoded name lists move into the registry, each with a coherence test:
S3_MATH_GENERICS(27) /S3_SUMMARY_GENERICS(7) — replace the match arm ins3_group_generic; name sets verified programmatically identical (34/34, order-preserving).meanstays a documented special case: it is a plain S3 generic (mean.barcatchesmean(z);Summary.bardoes not), so it cannot join the Summary list.GROUP_GENERICS(Ops/Math/Summary/matrixOps) — replaces the predicate duplicated in collect.rs and infer/index.rs.S7_OBJECT_CONSTRUCTORS— replaces the lib.rs match; also fixes its doc, which described a deleted promise-capture helper (match.call/sys.call) instead of S7 constructors.QUOTING_FORMS(~/expression/vars) — replaces the duplicated list ininfer_callandis_aliasable_function.Coherence details worth review:
acosh/asinh/atanhexist in the vendored base stub only as ambient functions, so the agreement-test helper now also consultsglobals.ambient_functions/globals.s3_generics(no current entry's outcome changes; module doc updated to match). The R oracle for quoting forms runs live (~/expressionverified;varswhen ggplot2 is installed); the S7 oracle mirrors the shiny skip pattern.What was deliberately NOT migrated (the real #49 finding)
expression_has_list_origin(3 names) andis_numeric_truthiness_idiom(5 names) are not blocked on typeshed plumbing — both are alreadyCheckermethods. They're blocked on semantics: the stubs cover 60 functions returninglistand 7 returning integer-1 (the hardcoded five plusPositionandnobs). Consulting stub return modes would change real behavior —if (nobs(fit))would stop firing RY003;strsplit()results would gain list-origin marking feedinghas_list_originconsumers. Each list needs a deliberate widen-or-stay decision with fixture coverage, not a mechanical swap. Full analysis posted to #49/#41.No vendored stub data was touched. Refs #49, refs #41 (does not close either — the remainder needs r-typeshed data and/or semantic decisions).
Gates
cargo test --workspace(969 pass, 19/19 semantic-list coherence), clippy-D warnings, fmt; snapshots byte-identical. Independently reviewed: set/order fidelity,meanbyte-identical, ambient-widening impact, doc accuracy all verified programmatically.