Skip to content

No gate refuses a new unchecked static_cast<...LoadedModel&> in a registry entry point #896

Description

@localai-bot

Follow-up decided by the #847 sweep, spec registry-downcast-sweep.md §6.

#847 asked whether a checker should refuse a new static_cast<...LoadedModel&> under src/vllm/model_executor/models/. The sweep's answer is yes, and it deliberately did not add one in the same change.

Why yes

The class is exactly grep-able. One regular expression enumerates it with no false positives, and after the sweep the residue is zero:

grep -rn 'static_cast<[A-Za-z0-9_:]*LoadedModel\s*&>' src/ include/   # no output

That is what makes a checker cheap and exact here, and it is precisely what is not true of the unaligned-read class in #627. Without a gate the class regrows the next time a model is ported, because the unchecked cast is what every existing entry point looked like for 35 registrations and a new port copies its neighbour.

Why not in the sweep

A repository-wide refusal gate changes what every future pull request must satisfy. AGENTS.md requires a spec, a red-before test and green-after evidence for a change to a checker's semantics; introducing one is at least that. Bundling it into a 30-file mechanical sweep gives a reviewer two unrelated things to judge at once.

Shape

Refuse the pattern under src/vllm/model_executor/models/, pointing at vllm::ModelAs<Model>(model, "<Architecture>") and naming the architecture-string rule the sweep settled (the family primary — the architecture whose load_weights produces the type the entry point opens). Needs a red-before test in tests/scripts/ that fails on a reintroduced cast, and wiring into scripts/agent-preflight.sh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions