Registration panics on a component definition with no status
- Dominant language
- Go
- Stars
- 223
- Forks
- 225
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 1
Description
### Current Behavior
`RegistrationHelper.register` (`models/registration/register.go`) dereferences `comp.Status` unconditionally:
```go
for _, comp := range pkg.Components {
status := *comp.Status // panics if Status is nil
if status == component.Ignored {
continue
}
```
`ComponentDefinition.Status` is a `*ComponentDefinitionStatus`, and `getEntity` unmarshals component definitions without requiring it, so a definition that omits `status` unmarshals cleanly with `Status == nil` and panics here — on the first component of the loop, before the per-item error handling further down can skip just the bad item.
### Consequence
Reachable from the model-registration import paths (CSV/URL/file import) and at startup seeding. Because it runs in the request goroutine, `net/http`'s recover keeps the process up, but the panic aborts the **entire import batch** with a 500 instead of skipping the one malformed component — unlike every other error in this function, which records an entity reg error and continues.
### Desired Behavior
Skip a statusless component the same way other bad items are handled: record an `InsertEntityRegError` and `continue`.
I have the fix ready (GOOS=linux build + vet pass) and will open a PR referencing this issue.
Contributor guide
Research direction
Start in models/registration/register.go and trace the CSV, URL, or file import path into RegistrationHelper.register. Exercise an import containing a component without status; done means it records an InsertEntityRegError, continues processing the remaining components, and does not return a panic or 500 for the whole batch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100