fix(codegen): preserve authored uv sources through native composition

MA
4h ago
+146-0

Native failure established — 2026-12-06

Standard CI 47662594035, job 146123281023 tested f25d01c6 through merge c27880c8ed into c33f9b697c11899cb213fa6ae5e6e24b59994fce.

Setup passed. Lint passed in 1.070 seconds and Pyrefly passed in 12.275 seconds. Both new cases executed and failed on the intended behavior, with 779 passed, 2 failed in 42.80 seconds, 0 captured runtime warnings and no test near either time limit.

  • Preservation: the emitted sources contained only the governed member. The actual output omitted vendor-client, although its complete requirement remained.
  • Conflict: a current member's divergent authored binding produced a successful generated document instead of the required causal refusal.

These are real public composition failures, not fixture, type-checking or timeout failures. Fail-fast stopped the remaining suite; no full-suite success is claimed. The four source comments and second-pass assertions have not yet been reached successfully.

The investigation also confirmed that the existing generic synchronization logic belongs to the CLI TOML owner. Its current table-reading helper intentionally consolidates out-of-order tables into a detached copy. The repair must use the native mutable TOML structure through the proper owner, preserve comments and avoid duplicating a parser or synchronization algorithm in Infra.

Production repair remains in progress. The regressions, time limits and original projection boundaries remain unchanged.

Receipt version: 1.1
Date: 2026-12-06
Author: Marlon Costa marlon.costa@datacosmos.com.br — Datacosmos

Problem

The public pyproject composition path treats all of tool.uv as generated state. It discards authored native source bindings, private indexes and resolver policy before merging. Workspace conformance also deletes any non-member source with editable = true, although that value does not prove generator ownership. Two mapping round-trips discard authored comments.

This is the additional declaration-loss finding recorded in #333. It does not resolve or change the separate external-gitlink materialization policy.

First candidate: real public regression

HEAD: f25d01c6d733e18aa3b988245334a5da27fe0a41.
Tree: cc7da4988a8b818715a83384a78ada021bc10c7c.
Parent: c33f9b697c11899cb213fa6ae5e6e24b59994fce.

Only the authored tests/unit/codegen/test_codegen_pyproject_conform.py changes. Production remains unchanged so standard CI can establish the actual failure.

Two cases call FlextInfraCodegenConform.Generate.compose_project_artifact with a physical pyproject, the real Git fixture and tracked Mise seeds:

  • Preserve a complete external requirement with extras, bounds and marker; its editable binding; an ambiguous editable binding; comments; the declared private index and index strategy. Update the generated policy from the typed owner, migrate the exact legacy workspace source, write the first output and require an identical second pass using the same original render.
  • Refuse a current member's conflicting native source. Composition must leave the live file unchanged.

The fixture's root identity resolves to the workspace Make profile. Both cases use public contracts and the ordinary time budget. No fake runtime, private product call, timeout change or slow marker is introduced.

Independent source review checked the contracts, genuine side effects, scope and expected failure. No new runtime result is claimed yet.

Repair in progress

The correction belongs to the existing ownership catalog, managed conflict recovery, TOML overlay/conformance and publication owners. It must preserve the native TOML structure and comments, retire only proven generated state, continue recovering managed leaf conflicts, and refuse conflicting authored sources. Unknown provenance never authorizes deleting an editable binding.

No generated file or lock is edited by hand. Native projection and current-head CI remain required before merge. This PR is not ready for integration.

Traceability

Version: 1.0
Date: 2026-12-06
Author: Marlon Costa marlon.costa@datacosmos.com.br — Datacosmos


Summary by cubic

Adds a test exposing that native pyproject composition discards authored tool.uv declarations: external sources, editable bindings, private indexes, resolver policy, and comments. Expected to fail on the current owner, where the whole tool.uv section is replaced before conformance, so external sources vanish and a conflicting member binding can be silently overwritten.

  • Preserves a complete external requirement, editable bindings without generated provenance, comments, and the private index policy across two publications.
  • Requires a conflicting current-member binding to fail before publication.
  • Test-only; production is unchanged, and no generated artifacts, locks, or refs are edited.