code-collision is annotated on the enum declaration, not on the colliding variant
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- github-actions, javascript
Direzione di ricerca
Read VENDORING.md and the code-collision branch in src/analyze.js, then locate the corresponding code and tests in the upstream codepact-core repository. Trace how spans stores enum values and find the collision test; done means shared codes each produce an annotation on the colliding variant’s line, the example annotates line 8, and the self-test passes. The issue requires an upstream change followed by a separate port here.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
When two contracts define the same error code, the annotation lands on the line of the #[contracterror] attribute rather than on the variant that actually collides.
Given examples/broken/factory_error.rs, the annotation appears on line 4 (the attribute) even though the collision is NotInitialized = 300 on line 8.
Why it matters
The entire point of the action is that a reviewer sees the problem on the diff. If someone adds a single colliding variant, GitHub shows the annotation several lines above their change, and if the enum declaration is outside the diff hunk, the annotation is collapsed out of view entirely. The finding is correct and invisible, which is close to useless.
Where
src/analyze.js, the code-collision branch. It reports line: b.declaration.line, because the collision is computed from a set intersection after per-enum information has been flattened away:
const shared = Array.from(a.values).filter((value) => b.values.has(value))
The spans structure keeps values as a Set of numbers, so the variant that owns each value is lost by the time the finding is created.
Suggested fix
Keep a Map from value to variant when building spans, then emit one finding per shared code, located on that variant's line. That also improves the message, which can name the specific variant on each side rather than just the two enums.
A collision involving several shared codes should produce several annotations, one per code, rather than one annotation listing them all.
Note on where to fix it
src/analyze.js is vendored from codepact-core — see VENDORING.md. Fix it in codepact-core first, then port the change here in a second pull request that names the upstream commit.
Acceptance
- A test in
codepact-coreasserting the reported line is the variant's line. - Running the action against
examples/brokenannotates line 8 offactory_error.rs. - The existing self-test job still passes.
- Lingua principale
- JavaScript
- Stelle
- 0
- Fork
- 0
- Merge medio
- 7h 28m
- PR unite (30g)
- 10
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 codepacct/codepact-action
-
documentation good first issue wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
codepacct/codepact-action#68 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
codepacct/codepact-action#67 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue tests wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
codepacct/codepact-action#66 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue tests wave
Difficoltà 1/5 1-3 ore Idoneità per principianti 79/100
codepacct/codepact-action#65 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue tests wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
codepacct/codepact-action#64 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di codepacct/codepact-action
Issue simili
-
bug security
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
IbrahimHafez1/loadwise#251 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
erkamyaman/unslop-anything#421 ·
I maintainer di solito rispondono entro 1 giorno