Skip to content

Dockerfile.test.ts splitIntoStages mis-parses FROM lines with --platform flag #1178

Description

@itsmiso-ai

Ask: Fix the splitIntoStages helper in Dockerfile.test.ts so a FROM --platform=... base AS name line is parsed into stage name mapping to the correct base image.

Found while reviewing PR #1175 (pre-existing, not introduced there; that PR's new MCP-wiring tests depend on this helper).

The regex used by splitIntoStages in Dockerfile.test.ts captures the first token after FROM as the base image, so a line like FROM --platform=$BUILDPLATFORM base AS builder would capture --platform=$BUILDPLATFORM / mis-associate the stage name. The current Dockerfile happens to have no --platform usage, so the bug is latent, but any future multi-platform stage would silently produce a wrong stage map and give false pass/fail results across every stage-scoped assertion in the file.

Suggested fix: strip leading --platform=... (and any other -- flags) before capturing the image and optional AS name, and add a unit test covering the FROM --platform=linux/amd64 node:24 AS foo shape.

Expected file to touch: Dockerfile.test.ts.

Activity

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

    priority/p3Low priority.status/readyReady for Dispatch worker pickup.type/choreRoutine tasks and maintenance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions