Skip to content

test: compile the controller protos for the core test session - #134

Draft
userAugustos wants to merge 22 commits into
test/move-tests-into-packagesfrom
test/core-proto-stubs
Draft

userAugustos wants to merge 22 commits into
test/move-tests-into-packagesfrom
test/core-proto-stubs

Conversation

@userAugustos

@userAugustos userAugustos commented Sep 17, 2026

Copy link
Copy Markdown

Closes #127. Stacked on #133: the base of this PR is the #133 branch, so the diff shows only this change.

Summary

  • The core runtime bare-imports the generated gRPC stubs, and only the container images provide them. A conftest.py in packages/core/tests now compiles every proto under canyonos_core/controller/proto into packages/core/build/pb at session start and puts that directory on sys.path. The directory is ignored by the root build/ rule.
  • There was one root cause, not two. The gpu_metrics errors came from the except ImportError branch in local_controller.py, which runs when the frontend import fails on the missing stubs. With the stubs present, that branch never runs.
  • The exporter test drops its fake stub modules and the now unused types import. The real stubs make them redundant.
  • No runtime change. No new dependency: grpcio-tools is already a runtime dependency of canyonos-core.

Test

  • bun run test: canyonos-core 226 passed, canyonos 65 passed, canyonos-python 10 passed. Second run hits the cache for all three.
  • pytest from packages/core without turbo also passes.
  • bun run check passes.

Review Focus

  • packages/core/tests/conftest.py: the protoc invocation mirrors cli.py and the Dockerfile (python -m grpc_tools.protoc, all protos in the directory).
  • The stubs are regenerated every session (about 50 ms) instead of cached, so there is no staleness check to get wrong.

Known and accepted

The core runtime bare-imports the generated gRPC stubs, which only the
container images provide. A conftest now compiles the protos into a
gitignored build dir at session start, so the core suite collects and
runs from a checkout. The fake stub modules in the exporter test are no
longer needed.
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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