Repository navigation
fix(monorepo): find sibling-package tests and self-imports; stop crediting same-named modules (#4552, #4553, #4554, #4566, #4769) - #4611
Conversation
…ed modules - check: without --root, a package directory of a pnpm/npm/yarn/bun or uv workspace now roots at the workspace (after the Cargo walk finds none), bounded by the git work tree; stderr names the manifest (#4553). - typescript: an owner-call relation anchored to the owner's own file by import is admitted across package roots; the package filter stays on name/path proximity, and typescript_target_unresolved skips admitted tests (#4552). - python: a src-layout short module name two workspace files share identifies the owner only for a test under the owner's project root, so package b's test no longer makes package a's change read exposed (#4566). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqbiiuYkC94scgE9rZ5K8W
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedNext included review available in 1 minute. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (18)
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 |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a345faeae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- typescript: a bare import of an in-workspace package (`@vitest/utils/helpers`) resolves through that package's package.json `exports` (conditions, single-`*` patterns) or `source`/`module`/`main` fields to an indexed workspace source, exactly one or none. Duplicate package names, build-output-only targets, `.d.ts` and escaping paths fail closed. Works with or without tsconfig paths (#4554). - typescript (review): the constructor arm's bare class-name match stays inside the owner's package; a sibling-package test must construct the class through a same-file or resolved import binding. - python (review): the #4566 ambiguity check now also gates package re-exports (`from shared import f` where two projects ship `shared`), `import shared.calc as calc`, class imports for method owners, and the class-alias token, with an end-to-end control per import shape. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqbiiuYkC94scgE9rZ5K8W
…-4ws691 # Conflicts: # CHANGELOG.md
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqbiiuYkC94scgE9rZ5K8W
- typescript: a specifier a tsconfig `paths` key owns never falls back to the workspace package entry; the compiler uses `paths`, so an unresolvable multi-entry key stays unresolved. - typescript: an extensionless package target that two files satisfy (`foo.tsx` and `foo/index.ts`) fails closed instead of taking the first probe. - python: `from shared import calc` checks `shared.calc` as well as `shared` against the #4566 ambiguity, and method-owner identity fails when every strong test imports a rival project's module (class via submodule, `calc.Calculator()`), not only the class name. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqbiiuYkC94scgE9rZ5K8W
|
Exact-head review record for 748a21d → 5e99727. Codex and Devin only reviewed 7a345fa, so an independent read-only pass covered the new resolver and the #4566 gates. Fixed in 5e99727:
Kept as designed: when a manifest maps a subpath to both Review status by provider:
Generated by Claude Code |
…-4ws691 # Conflicts: # CHANGELOG.md # crates/ripr/src/cli/commands/check.rs
…e self-imports (#4554, #4769) A package that exports only published build output (zustand: "./*" -> "./*.js", "./esm/*.mjs") now resolves through the src/ counterpart of those targets when no target is an indexed source, so its own tests that import it by name relate to the changed source. The mirror must name exactly one indexed source file, or the import stays unresolved. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqbiiuYkC94scgE9rZ5K8W
…s unresolved (#4769) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqbiiuYkC94scgE9rZ5K8W
…esolved_import Main renamed the alias-limitation producer; the merge ref failed to compile. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqbiiuYkC94scgE9rZ5K8W
Conflict in typescript/related_tests.rs: main's OwnerPackageScope (#4607) filtered owner-call candidates by package; #4552 exempts import-anchored owner-call arms, so that filter stays off them. The constructor arm's cross-package check now uses OwnerPackageScope since same_package_root is test-only on main. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqbiiuYkC94scgE9rZ5K8W
Resolve conflicts with the monorepo project-identity change (#4611): dotted-path submodule receivers (#4560) now require the import's module to be the owner's project module, with a package-dotted-path row in the rival-project test. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsNnp3aRU6BbCfas4WcqfS
Requested by Steven · project thread
Summary
Monorepo defects found walking real OSS workspaces (tokio-rs/tracing, vitest-dev/vitest, microsoft/autogen, pmndrs/zustand) on swarm main 02e1abf.
ripr checkfrom a package directory of a pnpm/npm/yarn/bun or uv workspace rooted the analysis at that package, so tests in sibling packages were outside it. In autogen,cd python/packages/autogen-coreturned anexposedchange intono_static_path, and the run still reported the analysis complete. Merged with check from a crate subdirectory reports a complete, clean analysis while dropping the findings #4610's project-root walk from main: after a Cargo[workspace], the nearest ofCargo.toml,pnpm-workspace.yaml,package.jsonwithworkspaces,pyproject.tomlwith[tool.uv.workspace], or the git top level is the root, and stderr names the manifest that chose it. check from a crate subdirectory reports a complete, clean analysis while dropping the findings #4610 alone would root a JS/Python package at the git top level; this roots it at the workspace that declares it.same_package_rootdropped a test in another workspace package that imports the changed file before any relation was tried. In vitest, atoArraychange readno_static_patheven thoughtest/unitimports it and asserts on it. Eachowner_call_relationarm is anchored to the owner's own file, so those arms now run across package roots. The name and path heuristic still applies the package filter. The constructor arm's bare class-name match (review) also stays inside the owner's package; across packages it needs a resolved import.typescript_target_unresolvedskips tests that the relation layer admitted.@scope/pkg/sub) never relate to the package's source (false no_static_path) #4554 (TypeScript): an import by package name (import { toArray } from '@vitest/utils/helpers') was never resolved. It now resolves through that package'spackage.jsonto exactly one indexed workspace source. Resolution triesexportsfirst (every condition, including single-*subpath patterns), thensource/module/main/types, then the subpath. It fails closed for duplicate package names,.d.tsfiles, escaping paths, and build-output targets with no singlesrc/counterpart (see typescript: tests importing the package by its own name (vitest resolve.alias) are silent no_static_path #4769). It needs noresolve_tsconfig_paths, and tsconfigpathsstill win when that setting is on. In vitest, that test now readsexposedinstead ofno_static_path.import { combine } from 'zustand/middleware', mapped by vitestresolve.alias) were a silentno_static_path. When every export target is published build output ("./*": {"import": "./esm/*.mjs", "default": "./*.js"}), the target is mirrored intosrc/(build dir and JS extension dropped) and used only when that names exactly one source file. An import of a workspace package that still cannot be resolved names the package'spackage.jsonin its limitation instead of the tsconfig path-alias flag. zustand,combine.tschange:no_static_path→weakly_exposedwithtests/middlewareTypes.test.tsxrelated.a/src/shared/calc.pyandb/src/shared/calc.pyboth import asshared.calc. A test inbthat exercisedb's function made a change toa's function readexposed. A src-layout name that two workspace projects share, whether a module name or a re-exporting package name, now identifies the owner only for a test inside the owner's project root (and not inside a deeper rival root). The check covers every import shape that carries identity:from M import f,import M as m, a package re-export, and, for method owners, the class import, the class alias token and method identity. Full dotted paths and unique short names are unchanged, so sibling-package tests (autogen-agentchat → autogen_core) still relate.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Governing issue or accepted claim: #4552, #4553, #4554, #4566, #4769
Acceptance delta (one sentence): In a Cargo-less monorepo, sibling-package tests that import the changed code (by path, alias or package name) are found from any package directory, and a same-named module in another package no longer supplies a discriminator.
Candidate Relationships
Candidate branch:
claude/project-thread-4ws691. I searched open PRs forsame_package_root, the workspace root walk, Python src-layout identity and workspace package resolution, and found no equivalent. #4502 (barrel re-exports) edits a different function intypescript/related_tests.rs.Scope
cli/commands/check.rs: JS/Python workspace markers in the project-root walk.analysis/language/typescript/{related_tests,static_limit,classifier}.rs: admit import-anchored cross-package relations, and anchor the constructor arm across packages.analysis/language/typescript/{workspace_packages,tsconfig,mod}.rs: new workspace package resolver, consulted after tsconfigpaths.analysis/language/python/{related_tests,sink_alignment,python}.rsand call sites: src-layout module identity that depends on where the test lives, filled in by the diff-mode workspace pass.Non-goals:
Type::assoc()is refused when any crate on its path defines anotherfn assoc(tracingLevelFilter::current) #4558).Support-tier Impact
docs/CONFIGURATION.md--rootandresolve_tsconfig_pathsrows, thedocs/OUTPUT_SCHEMA.mdtypescript_target_unresolvedproducer note, and CHANGELOG.Policy Impact
Proof
New tests:
project_root_walk_reaches_a_js_or_python_workspace_from_a_package,project_root_walk_ignores_markers_above_the_git_top_level(beside check from a crate subdirectory reports a complete, clean analysis while dropping the findings #4610's own root-walk tests)package_local_filter_admits_cross_package_test_importing_owner_file,cross_package_constructor_requires_owner_class_import,unresolved_ownership_import_branch_with_relative_pathsworkspace_packagesunit tests: exports with a source condition, build-output mirror into src (and fail-closed when the mirror is missing), zustand self-import, main/pattern/deep paths, duplicate/divergent/escaping, two-candidate extensionless target,pathskey blocks package fallbackunresolved_workspace_package_import_names_the_manifestshared_src_layout_module_name_identifies_owner_only_from_its_project,nested_src_layout_rival_claims_tests_under_its_own_rootsame_named_src_package_in_another_project_lends_no_exposure, six import shapes, test inavsbNegative experiments:
from-modulerow fail.class-methodrow fail.package-reexportrow fail.Re-walk on the fixed release binary:
test/unittest importing../../../packages/utils/src/helpersno_static_pathexposed,direct_owner_calltest/unittest importing@vitest/utils/helpersno_static_pathexposed, 4 related testspython/packages/autogen-core.,no_static_pathpython/([tool.uv.workspace]),exposedshared.calcpackagesexposedviab/testsweakly_exposedtracing-corecombine.tschange, tests importzustand/middlewareno_static_pathweakly_exposed,tests/middlewareTypes.test.tsxClaim Boundary
May claim:
Must not claim:
Type::assoc()is refused when any crate on its path defines anotherfn assoc(tracingLevelFilter::current) #4558);src/counterpart.Rollback
Revert the squash commit. There is no schema or config change.
Static Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.Gates
cargo fmt --checkcargo xtask precommit🤖 Generated with Claude Code
https://claude.ai/code/session_01EqbiiuYkC94scgE9rZ5K8W