Skip to content

Backend: required metadata is never enforced when creating a mission #2474

Open

Description

@wp99cp

Problem

POST /missions should reject a mission that is missing one of its project's required metadata types (unless ignoreTags / ignoreMissingMetadata is set). The check can never fire, because it joins its three conditions with &&:

https://github.com/leggedrobotics/kleinkram/blob/1c844da6/backend/src/services/mission.service.ts#L120-L138

const missingTags = project.requiredTags.filter(
    (tagType: TagTypeEntity) =>
        createMission.tags[tagType.uuid] === undefined &&
        createMission.tags[tagType.uuid] === '' &&
        createMission.tags[tagType.uuid] === null,
);

A value can't be undefined, '' and null at once, so missingTags is always empty and the ConflictException ("All required tags must be provided …") is dead code. The eslint-disable-next-line @typescript-eslint/no-unnecessary-condition comments hide the lint warning that points at this.

The web UI and the CLI check required metadata on the client side. A request made straight to the API (or by any other client) can create a mission without its required metadata.

Fix

Use ||, and probably treat whitespace-only strings as missing too. Add an API test that creates a mission without a required metadata type and expects 409, plus one that sets ignoreMissingMetadata and expects success.

This changes behaviour: clients that currently get away with missing required metadata will start getting 409. Worth a line in the release notes.

After #2473 the code is in the same place, using the new names (requiredMetadataTypes, metadata ?? tags, ignoreMissingMetadata ?? ignoreTags).

Activity

  1. VARUN3WARE commented on Oct 4, 2026

    @VARUN3WARE

    Hi! I'd like to work on this. I have a fix ready: the required-metadata check now uses || (and treats blank strings as missing), with API tests for the 409 case and for ignoreMissingMetadata / ignoreTags. I'll open a PR against dev shortly.

  2. added a commit that references this issue on Nov 13, 2026
    8d2d301
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendanything related to the backend

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions