Skip to content

all_packages=True skips Dagger codegen for workspace members #100

Open

Description

@Kewe63

Summary

At b0e9d0ca81328d3c91a08ab8c7a0e8963c2fa7ae, UvSyncPlan.create(all_packages=True, dagger_codegen=True) runs codegen only at . instead of for each local workspace member.

Expected behavior

all_packages is documented to install every workspace member. Dagger codegen is documented to run for the package being built before uv sync, so every selected local Dagger member needs its generated SDK materialized.

Actual behavior

Codegen paths are derived only from the explicit package list. The normal empty list used with all_packages=True falls back to ['.'] before local members are discovered.

Reproduction

PYTHONPATH=repositories/daggerverse/github/src:repositories/daggerverse/ruff/src:repositories/daggerverse/uv/src \
  evidence/daggerverse/venv314/bin/pytest -q \
  evidence/daggerverse/repros/test_candidates.py::test_all_packages_codegen_visits_each_local_member

Observed: expected ['packages/app-one', 'packages/app-two']; actual codegen visits ['.'].

The explicit package=['app-one', 'app-two'] control visits both member paths and passes.

Impact

A pure workspace root can omit gitignored generated SDK sources before frozen sync, so an all-packages build can fail even though explicit selection of the same members works. A full Dagger container build was not run in this audit.

Root cause

uv/src/uv/workspace/plan.py:204-210 computes codegen paths from explicit packages only, before _discover_local_packages handles all_packages.

Suggested fix and regression test

When all_packages is true, derive and deduplicate codegen paths for all reachable local members. Preserve current explicit-package and bare-root behavior. Add a two-member pure-workspace regression plus explicit/default controls.

Duplicate check

The full all-state tracker and actual open patches were inspected. Fresh searches covered all_packages, dagger_codegen, UvSyncPlan.create, workspace member paths, generated SDKs, and skip/selection synonyms. PRs #2/#3 establish codegen necessity and PR #81 changes eligibility, but none addresses all-packages selection.

Activity

  1. aoright commented on Sep 24, 2026

    @aoright

    I implemented and verified a fix for this workspace member codegen issue on fork branch fix/all-packages-codegen (commit e75403b).

    Compare: main...aoright:daggerverse:fix/all-packages-codegen

    1. Root Cause Breakdown

    • In uv/src/uv/workspace/plan.py, line 208 derived codegen paths strictly from explicit package selections:
      codegen_paths = list(dict.fromkeys(raw_local[p] for p in packages if p in raw_local)) or ["."]
    • When all_packages=True is set, callers supply an empty packages list ([]). Consequently, [raw_local[p] for p in packages if p in raw_local] evaluates to [], triggering the fallback to ["."].
    • In a pure workspace root with members (e.g. packages/app-one, packages/app-two), Dagger codegen runs solely at . and never executes inside the actual member directories.

    2. Implementation in uv/src/uv/workspace/plan.py

    When all_packages is True, gather and deduplicate the member directory paths from raw_local.values():

            if dagger_codegen:
                raw_local = parse_local_packages(lock_data)
                # Overlay each target package's SDK (deduped); fall back to the
                # workspace root when no target is a local package.
                if all_packages:
                    codegen_paths = list(dict.fromkeys(raw_local.values())) or ["."]
                else:
                    codegen_paths = list(dict.fromkeys(raw_local[p] for p in packages if p in raw_local)) or ["."]
                for codegen_path in codegen_paths:
                    ws_dir = await _run_codegen(ws_dir, codegen_path)
                if workspace_path == ".":
                    source_dir = ws_dir
                else:
                    source_dir = source_dir.with_directory(workspace_path, ws_dir)

    3. Verification & Regressions

    Added unit test test_codegen_paths_all_packages_visits_all_members in uv/tests/test_workspace_resolution.py:

    • Confirms all_packages=True yields all member paths (['packages/app-one', 'packages/app-two']).
    • Confirms explicit package lists (['app-one']) visit only the targeted member.
    • Confirms empty/unmatched packages fall back to root (['.']).

    All 130 tests in uv/tests pass. Zero ruff lint/format findings.

  2. aoright commented on Sep 24, 2026

    @aoright

    Opened PR #105 with the zero-regression fix and test coverage.

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