Skip to content

fix(cli): detect the isolated core from installation metadata instead of an optional CLI probe - #8811

Closed
CharleoYang wants to merge 1 commit into
loopx-project:mainfrom
CharleoYang:codex/help-route-repair-20261115
Closed

CharleoYang wants to merge 1 commit into
loopx-project:mainfrom
CharleoYang:codex/help-route-repair-20261115

Conversation

@CharleoYang

Copy link
Copy Markdown

Problem

Lightweight help for a selected command fails on hosts that do not provide the optional full CLI. tests/capabilities/test_performance_diagnosis_cli.py::test_help_needs_no_runtime_or_optional_stack refuses optional imports, subprocess and sockets; loopx/cli_runtime.py:329 -> _standalone_core() probed find_spec("loopx.cli"), so --help failed before the parser ran.

Root cause

_standalone_core used an import probe as its source-provenance signal. On a source checkout the probe both imports an optional facade and misses when a foreign installation shadows it.

Change

  • loopx/cli_runtime.py: standalone detection now uses the existing installation-metadata owner and requires the imported runtime file to be owned by that distribution's RECORD, so a wheel shadowed by source is not treated as the isolated core. Parsing, explicit routes and the missing-facade vs broken-dependency distinction are unchanged.
  • tests/capabilities/test_performance_diagnosis_cli.py: kept the three RED cases; added --cli-bin help/error ordering, metadata-ownership counterexamples, default/explicit routing and broken-inner-dependency controls.
  • packages/loopx-core/README.md: documents the provenance rule.

Evidence

  • uv run --extra test python -m pytest -q tests/capabilities/test_performance_diagnosis_cli.py tests/control_plane/test_cli_program_route.py -> 120 passed, 1 failed; the failure was a new test's own expectation (--cli-bin --help predicted exit 2) and help_surface.py + concise-help dispatch establish exit 0; that case then passed alone.
  • Freshly built patched core wheel, LOOPX_CORE_TEST_PYTHON=... pytest -q tests/test_core_distribution.py -k 'identity_help_and_unavailable_workspace or generated_commands_keep_their_distribution' -> 3 passed, 0 skipped.

Not covered

No single 121-case run and no full cumulative suite in this PR; independent review on this exact head is pending.

Signed-off-by: Qi Yang <yangqi45@meituan.com>
@CharleoYang

Copy link
Copy Markdown
Author

Closing without merge: the owner directed that this work be published on the internal Sankuai remote (origin = ssh://git@git.sankuai.com/~yangqi45/loopx.git) and not on GitHub. The branch is pushed there; no GitHub PR is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant