Spec check misses NewType arguments of a generic group
I maintainer di solito rispondono entro 1 giorno
@SimonHeybrock ci sta già lavorando.
Dal 28/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Summary
A spec may use a generic group parametrized with a NewType, such as essreduce's polarization markers. WorkflowSpec accepts it, but two such parameters serialize as one type, so a consumer of the serialized spec cannot tell them apart. It has the same root cause as scipp/sciline#250: pydantic names a generic model after its arguments, and gives every NewType the name NewType.
Reproducer
Polarizer = NewType('Polarizer', str) # as in ess.reduce.polarization.types
Analyzer = NewType('Analyzer', str)
E = TypeVar('E')
class He3Cell(BaseModel, Generic[E]):
pressure: float = Field(1.0, gt=0)
class Params(BaseModel):
polarizer: He3Cell[Polarizer]
analyzer: He3Cell[Analyzer]
spec = WorkflowSpec(..., params=Params, ...) # accepted
schema = spec.serialize().params_schema
list(schema['$defs']) # [..., 'He3Cell_NewType_', ...]: one entry for both
schema['properties']['polarizer'] # ... 'dataType': 'He3Cell[NewType]'
schema['properties']['analyzer'] # ... 'dataType': 'He3Cell[NewType]'
Impact
Inside one process nothing goes wrong. The backend fits a reference by class identity (field_types.fits), and a PipelineBinding uses the class objects as sciline keys. A consumer that only has the serialized spec, such as a remote UI, matches an output to a parameter by dataType. It would offer a polarizer cell's output for the analyzer, and the other way round. No such consumer exists yet.
Proposal
Refuse it when the spec is made, as the rule "no NewType or type alias, at any depth" already intends (essspec ADR 0001). The check misses this case because field_types.arguments uses typing.get_args, which does not see the arguments of a parametrized pydantic model. Those are in __pydantic_generic_metadata__['args']. With them included, the existing message applies: a spec names a role by a class.
The fix at the source is in essreduce: define the markers as classes (class Polarizer: ...). That also fixes scipp/sciline#250 for these keys. Until then, a spec over essreduce's He3 workflow defines its own marker classes, and its binding maps them to essreduce's keys.
- Lingua principale
- Python
- Stelle
- 0
- Fork
- 1
- Merge medio
- 15h 40m
- PR unite (30g)
- 59
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di scipp/essapps
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
A number that is not finite is stored as None at a field that accepts NoneForse già presa @jeevanabhi-r l’ha presa 2 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
scipp/essapps#140 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 40/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di scipp/essapps
Issue simili
-
docs size:S
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
strawberry-graphql/strawberry#4794 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dataforgoodfr/cetolog#21 ·
-
security_citations_test fails against ecc 2026.11.6: SECURITY.md quotes ecc v2026.11.2's linesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
btclib-org/btclib#2932 ·
I maintainer di solito rispondono entro 1 giorno