Skip to content

Isolate and improve artifact flattening #15125

Open

Description

@shykes

Context

The Dagger API exposes your workspace as a graph of typed values. You can also view its artifacts as rows in a table. Each column is a dimension. An artifact's value in a dimension is a coordinate. This mapping is called artifact flattening. You use it to filter, group, and address artifacts, for example with dagger check --go-module=..

Problem

1. The result is too complex

Tables have too many columns. Names show internal details. Edge cases give unexpected results. For example, a Docker Compose service gets these coordinates:

Dimension Coordinate
module docker
/docker/compose/projects e2e
/docker/compose/projects/services web
type:Service docker/compose/projects/services/up

2. The rules are not rigorous

The model was designed, but some rules were not specified. They were added case by case across discovery, the engine, and the CLI. Some of the result is AI slop. There is no standalone specification or implementation, so the rules are difficult to test or improve.

Some rules are incorrect. If a collection's items are also collections, both levels get the same dimension. One column then holds two keys.

Solution

Implemented in #15177.

  1. Move the rules into a standalone Go package, core/artifact/flattening. It maps the complete schema to dimensions, and each artifact to coordinates. It runs without an engine.
  2. Specify the rules. Dimensions depend only on the schema, not on filters or collection contents.
  3. Replace path-based dimensions with three types of dimension:
Dimension Coordinate Example
module Module name module=docker
One for each collection type. The identifier is the type name. The label is the item type in kebab-case. Key of the item docker-compose-service=web
name Field path from the nearest collection item, or from the module root name=up, name=python310.unit

The Docker Compose service from the example above gets these coordinates:

Dimension Coordinate
module docker
docker-compose-project e2e
docker-compose-service web
name up

Answers to the open questions

  • Two checks on the same parent have different name coordinates, for example python310.unit and python310.slow.
  • Nested collections get one dimension for each collection type. A path that repeats the same collection type is rejected.
  • One collection type on two or more field routes in the same scope. A scope is a module root or a collection item. The keys of that type get the route as a prefix. For before: Tests and after: Tests with key unit, the coordinates are test=before.unit and test=after.unit. In all other cases the key is the author's key.

Activity

  1. changed the title [-]Define artifact flattening[/-] [+]Isolate and improve artifact flattening[/+] on Nov 10, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions