posit-dev / posit-dev/images-shared

Replace runtime model mutation with an explicit plugin registry

Open
#595 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cvp:0 docker tdp:2
Dominant language
Python
Stars
2
Forks
0
Avg merge
4d 13h
Merged PRs (30d)
22

Description

After plugin discovery, `rebuild_tool_models()` performs deferred imports of `Image`, `ImageVariant`, `ImageVersion`, and `BakeryConfigDocument` to reconstruct Pydantic discriminated unions with plugin-contributed tool options. This is a circular-import workaround. If config loads before plugins are discovered, tool options fail silently — no error, no warning. Adding a new model that uses `ToolField` requires manually updating the rebuild function with no static guarantee of completeness. Plugins also import from `cli.common`, coupling the plugin system to the CLI layer.

Replace with a plugin registry that config models query at validation time rather than mutating model annotations at import time. This makes initialization order explicit, turns silent failures into loud ones, and makes plugins independently testable.

Files: `config/tools/init.py`, `plugins/`, `config/image/variant.py`, `config/image/version.py`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in config/tools/init.py by reading rebuild_tool_models(), then trace plugin imports under plugins/ and ToolField usage in config/image/variant.py and config/image/version.py. Done means model validation queries an explicit plugin registry, initialization order no longer causes silent failures, and plugins are independently testable without coupling to the CLI layer.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.