Registration panics on a component definition with no status

Open Beginner friendly
#1,077 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go
Domain
backend

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.

Description

Current Behavior

RegistrationHelper.register (models/registration/register.go) dereferences comp.Status unconditionally:

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.

Dominant language
Go
Stars
223
Forks
225
Avg merge
2d 8h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from meshery/meshkit

All issues in meshery/meshkit

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.