Task without spec crashes the controller with a nil-pointer panic

Aperta Adatta ai principianti
#349 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go
Ambito
api, backend

Direzione di ricerca

Inizia da internal/controller/worker.go:131 e confronta il percorso della specifica mancante con ValidateTask e Server.UpdateTask. Esegui TestReviewMissingSpecDoesNotCrashWorker da internal/controller/review_regression_test.go; il lavoro è completato quando un Task accettato contenente solo metadati non va più in panic durante l’elaborazione, usando il comportamento di validazione o inizializzazione scelto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

The API accepts a Task with no spec, but the controller dereferences task.Spec.Gateway before initializing the spec. Processing that task panics and terminates the controller process.

Reproduction

Apply a metadata-only Task:

apiVersion: ax.io/v1alpha1
kind: Task
metadata:
  name: no-spec

ValidateTask accepts the missing spec. When the worker processes the resulting event, it panics at internal/controller/worker.go:131.

Expected behavior

Either reject the task at the API boundary with a validation error or initialize an empty spec before accessing its fields. An accepted task must not crash the controller.

Observed behavior

A local regression test submits the task through Server.UpdateTask, then processes it through Worker.Run:

API accepted metadata-only Task, then Worker.Run panicked:
runtime error: invalid memory address or nil pointer dereference

Test: TestReviewMissingSpecDoesNotCrashWorker

The test uses the production API and worker with an in-memory store and an in-process Substrate fake. The panic occurs before any Substrate RPC. The test source and its supporting fixture are published in the fork linked below.

Impact

One accepted metadata-only task can terminate a controller worker, interrupting reconciliation of other tasks.

Published regression test

TestReviewMissingSpecDoesNotCrashWorker. Supporting fixtures are in the same file and the repository's existing controller tests.

git clone --branch test/review-regressions https://github.com/fkautz/ax.git ax-review
cd ax-review
git checkout 1dc2613d29e12f306154a7e1183c1825a55d24ed
go test ./internal/controller -run '^TestReviewMissingSpecDoesNotCrashWorker$' -count=1 -v

Requires the Go toolchain specified in go.mod. No cluster or Redis instance is required. The test asserts no panic and fails on this revision. Panic recovery exists only in the test harness. Production code is unchanged.

Lingua principale
Go
Stelle
2.1k
Fork
121
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di google/ax

Tutte le issue di google/ax

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.