feat: validate ops.main() call for operator framework charms
Metadata
Current evaluation
Merged as b6fbbe93, adding an analyse linter that verifies Operator Framework charm entrypoints call ops.main() across supported import styles; shipped in 3.3.0.
Resolution: closed resolved
Reason: PR #1883 was merged as commit b6fbbe93. Its ops-main-call linter validates that Operator Framework entrypoints initialize charms through ops.main().
Evaluated by: mr-cal-bot
No scores available.
Issue body
Jira: https://warthogs.atlassian.net/browse/CHARMTECH-223
Parent: https://warthogs.atlassian.net/browse/CHARMTECH-219
The idea is to validate that the charm initialises the operator framework correctly:
- charmcraft analyse would validate the presence of the `ops.main(...)` call with this PR
- any conceivable import style is supported
- ops library type hints are improved https://github.com/canonical/operator/pull/1345
- charmers will no longer need to slap `# type: ignore` on the call
- we'll be relying on charmers' static type analysis to ensure correct arguments to `ops.main`
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged as b6fbbe93, adding an analyse linter that verifies Operator Framework charm entrypoints call ops.main() across supported import styles; shipped in 3.3.0. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged in charmcraft#1883 as b6fbbe93, adding charmcraft analyse validation for Operator Framework ops.main() initialization across import styles. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged. Adds validation for ops.main() calls in charmcraft analyse, supporting any import style and improving type hints for static analysis. Approved by reviewers, rebased, squashed, and successfully merged. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Adds validation for ops.main() calls in operator framework charms to charmcraft analyse, supporting any import style and leveraging improved type hints for static analysis. Changes were rebased, squashed, and merged. |
Update history
No update history recorded yet.
Related work
-
Related To:
operator#1345
(confidence 98%)
Companion PR adding ops.main() type hints so static analysis can validate call arguments.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1820 feat: [wip] detect charm classes and ops.main() calls | charmcraft | closed | Closed unmerged as WIP; its ops.main analysis was superseded by charmcraft#1883, merged as b6fbbe93 to add charmcraft analyse validation for Operator Framework charms. |