Skip to content

Conversation

@kevinmingtarja
Copy link
Collaborator

@kevinmingtarja kevinmingtarja commented Nov 16, 2025

Just exploring a random idea. In general, it seems like in our codebase, we have quite a few "rules" we define (mostly in CONTRIBUTING.md and as code comments), but have no way to enforce them automatically. It relies on either the PR author or reviewer remembering to follow it, and thus could be prone to human errors.

These are things like:

  • Bump the API_VERSION if you make an API change
  • Bump SKYLET_VERSION if you make a change that requires restarting the skylet
  • etc

We've also faced issues where the gRPC and non-gRPC code path for jobs had a minor divergence, where some fields were missing from the gRPC code path, etc.

This PR is an experiment to see if it's feasible and scalable to do such automated checks for these rules. This example uses LibCST from the instagram python team.

LibCST parses Python 3.0 -> 3.14 source code as a CST tree that keeps all formatting details (comments, whitespaces, parentheses, etc). It's useful for building automated refactoring (codemod) applications and linters.

I guess another way of thinking about this is, if such rules are able to be enforced programmatically, then should we just have those parts of the code be fully codegen'ed and not manually touched?

Preview:
Screenshot 2025-11-15 at 6 02 42 PM

Tested (run the relevant ones):

  • Code formatting: install pre-commit (auto-check on commit) or bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: /smoke-test (CI) or pytest tests/test_smoke.py (local)
  • Relevant individual tests: /smoke-test -k test_name (CI) or pytest tests/test_smoke.py::test_name (local)
  • Backward compatibility: /quicktest-core (CI) or pytest tests/smoke_tests/test_backward_compat.py (local)

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.

2 participants