descriptors.ts selectors ignore their `env` arg — silent wrong-descriptor risk if a second env is wired
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- typescript
- Ambito
- cli
Direzione di ricerca
Inizia in src/utils/descriptors.ts leggendo i tre selettori e i relativi import dei descrittori paseo, quindi segui la env passata da src/utils/connection.ts. Assicurati che gli ambienti imprevisti falliscano in modo esplicito, mentre l’ambiente paseo cablato rimanga valido, ed esegui tsc insieme al controllo di divergenza di config.test.ts per verificare la modifica.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Since #465, the three descriptor selectors in src/utils/descriptors.ts
(getAssetHubDescriptor / getBulletinDescriptor / getIndividualityDescriptor)
ignore their env parameter and unconditionally return the paseo-* descriptor.
This is safe today, but it is a latent footgun: the correctness of the selectors
depends on an implicit invariant enforced in a different file.
Background
@parity/[email protected] dropped the summit-* descriptor
subpaths (and summit was retired), so the selectors no longer branch per env —
they return the fixed paseo constants and discard the env arg:
export function getAssetHubDescriptor(_env: Env | undefined): AssetHubDescriptor {
return paseo_asset_hub;
}
export function getBulletinDescriptor(_env: Env | undefined): BulletinDescriptor { … }
export function getIndividualityDescriptor(_env: Env | undefined): IndividualityDescriptor { … }
The risk
getConnection() (src/utils/connection.ts) builds the direct PAPI clients from
getAssetHubDescriptor(getChainConfig().env) (and the bulletin/individuality
equivalents). Because the env arg is discarded, "always return paseo" is only
correct while paseo-next-v2 is the sole env wired in CONFIGS.
If someone later wires a second env into CONFIGS (e.g. polkadot, which is
already present in ENV_IDS) without also editing descriptors.ts, direct
reads would decode that chain's state with the paseo descriptor — silently
wrong metadata, with no error raised. The only thing preventing this today is
getChainConfig() throwing for any env not in CONFIGS — an implicit safety net
one file away from the code that relies on it.
Proposed fix
Make the selectors fail loud instead of silently returning paseo for an
unexpected env: assert the requested env resolves to a paseo-family descriptor
(or that it is the wired default) and throw otherwise. ~3 lines; converts the
latent footgun into an immediate, obvious error the moment a second env is wired.
Restore real per-env selection here if/when another env ships dedicated
descriptors upstream.
Context
Surfaced by the #465 code review (altitude / latent-correctness finding).
Not a live bug — only paseo-next-v2 is wired today, and tsc + the
config.test.ts divergence guard both hold. Filed as hardening / tech-debt.
- Lingua principale
- TypeScript
- Stelle
- 5
- Fork
- 12
- Merge medio
- 7g 6h
- PR unite (30g)
- 3
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 paritytech/playground-cli
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
paritytech/playground-cli#518 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
paritytech/playground-cli#489 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
paritytech/playground-cli#555 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
paritytech/playground-cli#554 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
paritytech/playground-cli#553 ·
Tutte le issue di paritytech/playground-cli
Issue simili
-
refactor
Difficoltà 2/5 Mezza giornata Idoneità per principianti 84/100
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OHDSI/Data2Evidence#3450 ·
I maintainer di solito rispondono entro 2 giorni
-
e2e-failure ready-to-code
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
redhat-developer/rhdh-plugin-export-overlays#4011 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
automation missing-model model-sync provider:ofox
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
anomalyco/models.dev#8421 ·
I maintainer di solito rispondono entro 1 giorno
-
SlackAdapter and TelegramAdapter are not assignable to Adapter under exactOptionalPropertyTypesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno