Two copies of the job-step lookup on OperationPlan
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia dal tipo OperationPlan e da JobPlan.validateContent in internal/onebox/job_plan.go per comprendere la garanzia di un singolo passaggio di job. Esamina poi i due chiamanti in cmd/ob/commands.go e internal/onebox/expiry_errors.go. Il lavoro è completato quando entrambi i chiamanti usano un unico accessor esportato di OperationPlan, senza modifiche al comportamento o allo schema.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The problem
Two functions walk an OperationPlan's steps to find its single job step:
jobStepOf(cmd/ob/commands.go:900-910) returns the step, for the approval
summary and the typed token.jobNameOfOperation(internal/onebox/expiry_errors.go:67-76) returns just
the name, for expiry messages.
Same loop, same guarantee behind it — JobPlan.validateContent
(internal/onebox/job_plan.go:97-104) ensures exactly one StepJob whose
Component matches Artifact.Job. Two copies means a future change to what
"the job step" is has two places to land, and the CLI copy exists only because
the onebox one is unexported and returns the wrong shape.
Proposed change
Export one accessor on OperationPlan — JobStep() (OperationStep, bool) —
next to the type it belongs to, and have both callers use it.
jobNameOfOperation becomes a thin wrapper or disappears.
Current workaround
None needed; both copies are correct today. This is about keeping them that
way.
Scope and safety
Pure refactor. No behaviour change, no schema change, no new command surface.
Found while auditing #171.
- Lingua principale
- Go
- Stelle
- 3
- Fork
- 0
- Merge medio
- 2h 40m
- PR unite (30g)
- 63
Guida per i contributori
Apri 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 labstack/onebox
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
-
bug
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Tutte le issue di labstack/onebox
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
bug group: validation priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
codecheckers/chekhov#51 ·
-
Creating worktree from an existing remote branch with a slash in it, has unexpected behaviour Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100