Repository navigation
refactor: collapse duplicated helpers across checker, cli, workspace, config - #159
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 new issues found.
Reviewed changes — every dedupe in this PR hand-verified as behavior-preserving against the code it replaced; the local gates agree.
bare_name/join_all/find_arg/conservative_element_type— each extracted helper is byte-equivalent to every inline copy it replaces; the remainingrsplit_once("::")sites all consume the package side too, so the dedupe boundary is drawn correctly.emit_not_callable+infer_args_for_diagnostics— 3× RY070 emit and 7 byte-identical arg-infer loops collapsed; the distinct "cannot call a value of mode" RY070 is correctly left inline.Scope::insert_parameter_default— the trickiest seam. Delegating toinsertalone would clearlexical_functions/list_origin_bindingsmarkers the old code preserved; the save/restore wrapper restores exactly the old marker semantics, and the newparameter_default_preserves_lexical_and_list_origin_markerstest is a genuine pin (it fails against the un-restored delegation).run_passesprologue — parse-error emission moved after collect+fixpoint incheck_with_scope; both passes run in discarding mode so they emit nothing, leaving RY000 ordering unchanged.serialized_cacheremoval (ry-workspace) — sound:serialized_inventorycarries its own global mtime-stamped cache, so the per-resolution map was redundant (anddataset_cache, which aggregates wholedata/dirs, is rightly kept).seed_caller_visible_signature—*current = previous.clone()additionally copiesname, but the pre-existing guard bails on any name mismatch, so a stale param name can never be installed.- CLI watch/config —
rescan(…, report=false)preserves the old silent poll behavior;IndexConfig's container-level#[serde(default)]+Defaultimpl (same constants) cover the removed per-field serde defaults;config::DEFAULT_OUTPUT_FORMATis"full", identical to the deleted CLI constant. - Gates —
cargo test --workspace: 967 passed / 0 failed across 43 targets;cargo clippy --workspace --all-targets -- -D warnings: clean.
openai-compatible/glm-5.3 | 𝕏

Cleanup sprint, PR 4 of 7 (stacks on #157). Net −105 lines (24 files, +454/−559). ~34 dedupes, each independently verified behavior-preserving — zero snapshot changes across the corpus, oracle, and vendor suites (the strongest local signal for a no-behavior claim in this repo).
The dedupes (highlights)
find_arg(named-arg-wins-else-positional) replaces twin closures ininfer_rep/infer_seq;conservative_element_typereplaces a 3× fallback;emit_not_callablereplaces a 3× RY070 emit;infer_args_for_diagnosticsfolds the 7 byte-identical arg-infer loops (the ~12 genuinely-different loops were left alone).join_allreplaces 5 seed-from-first folds — the naivefold(unknown(), join)would have been wrong (RType::joinis opaque-absorbing); caught during implementation.check/check_with_scopeshare arun_passesprologue;CallerVisibleParameter(a field-for-field mirror ofUserParam, bothpub(crate)) is deleted;resolves_to_base_lenient=resolves_to_base_impl(..., false);BinOpKind::is_arithmetic/OutputFormat::is_human/semantic_lists::bare_namereplace 2/4/9 inline copies respectively.rescan/sync_stamps; error/warning counting computed once;DEFAULT_CHECK_OUTPUT_FORMATreusesry_config's constant;IndexConfig's triple-stated defaults reduced to theDefaultimpl.Deliberately NOT done (verification said no)
dataset_cachein ry-workspace was kept: the claim "the global cache makes it redundant" is false — it aggregates wholedata/directories, which the per-file global cache cannot key. Deleting it would be a real perf regression.Narrowing::None => {}arm is unreachable but removing it would need a_arm — no net win.SERIALIZED_BINDINGS_UNENUMERABLEdefensive branch stays: the marker IS still produced (unstubbed attached packages), pinned by a test.Caught in review, fixed before push
The first version delegated
insert_parameter_defaulttoScope::insert, which additionally clearslexical_functions/list_origin_bindingsmarkers — a real behavior delta reachable viabuild_function_signature's captured-scope walk. Fixed by preserving both markers (mirroringinsert_narrowed's style), with a Scope-level regression test proven to fail against the broken version. The other 14 equivalence claims were independently verified.Gates
cargo test --workspace(967 pass), clippy-D warnings, fmt — green; snapshots byte-identical.