Skip to content

fix(driver): flatten build artifact paths (#1894) - #1895

Draft
ghaith wants to merge 3 commits into
release/1.0.xfrom
backport/1.0.x/flat-artifact-paths
Draft

fix(driver): flatten build artifact paths (#1894)#1895
ghaith wants to merge 3 commits into
release/1.0.xfrom
backport/1.0.x/flat-artifact-paths

Conversation

@ghaith

@ghaith ghaith commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Attribution: this branch, its tests and this description were produced by Claude
(Claude Code) working in my repository, not written directly by me. I have reviewed the
change, but please review it as machine-authored work. The commits carry a
Co-Authored-By: Claude trailer.

Draft on purpose. We are in feature freeze, so this needs a team decision before it goes
anywhere. Opening it now so the assessment below is on the record.

Backport of #1894 to release/1.0.x. Fixes PRG-4448 on the v1 line.

What it does

Intermediate artifacts get a flat name, <file name>-<digest>.<extension>, all directly in
<build>/<target>/, instead of being named after the source path and nested under it. The
target directory is also no longer added twice. See #1894 for the full rationale.

Why it is wanted on v1

PRG-4448 is reported against a shipped workspace. With the standard library delivered outside
the workspace at a realistic path, the longest artifact path measured 445 characters, and an
xcopy of the build output copied 3 of 31 files while returning exit code 0. The user-visible
symptom is a File Explorer copy of the workspace that silently loses files.

Port risk

Low. The port is mechanical:

  • Every source file auto-merged: pipelines.rs, participant.rs, codegen.rs, and both test
    harnesses. src/codegen.rs is byte-identical between master and release/1.0.x.
  • One conflict, in compiler/plc_driver/Cargo.toml, over the plc_util version string only.
    Resolved by keeping 1.0.4.
  • No new third-party code. siphasher is already a workspace dependency on this branch; the
    manifest change only moves it to [workspace.dependencies] so plc_driver can use it.

Verified on this branch on Windows: clean build, 2742 lib tests, 83 integration, 352
correctness, all green, including debug_paths and the 31 new tests.

A release build of this branch, run against the Eclipse tool's real compile command, produces
output byte-identical to #1894 — same 233-character longest path and the same digests. So
a v1 and a v1.1 toolchain name artifacts identically, and switching between them against a
shared build directory causes no churn.

What reviewers should weigh

  • Artifact file names change. Anything outside this repo that hardcodes an intermediate .o
    path would break. The Eclipse builder resolves only <compile>/<target>/<output>.so and
    usr/lib/..., both unchanged and confirmed unchanged in a real build, but packaging or
    debug tooling elsewhere is worth a second look.
  • Existing build directories keep their old mirrored trees until one clean build.

🤖 Generated with Claude Code

ghaith and others added 3 commits August 27, 2026 15:39
Problem: Every object, bitcode and IR artifact was named after the path of
its source and created under that path inside the build directory, so a
source outside of the project mirrored its whole absolute path. The
directory of the target was added twice on top of that. The resulting paths
go past the 260 character limit of the Windows file system, which breaks
file operations on the workspace.

Solution: Name artifacts `<file name>-<digest of the unit>.<extension>` and
keep all of them directly in the directory of the target. The digest keeps
two units with the same file name apart now that they share a directory.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The naming of the build artifacts was implemented and tested on Linux, while
the file system it targets is Windows. Reverting the fix and running the suite
on Windows reproduces the broken state there: the directory of the target
appears twice, the absolute path of an external source is mirrored below it,
and the scenario of the path limit reaches 374 characters.

Closes the open points of the validation note:

- The relative form of a key is reached on Windows. `canonicalize` returns a
  verbatim path for a unit, so a project root that is not canonicalized never
  prefixes it; the new end-to-end test through the `build` subcommand, where
  the root comes from the `plc.json`, names its artifacts after the path
  relative to the project.
- Casing is normalized by the canonicalization of the key, not by the digest.
  A source referenced with another casing keeps its one artifact.
- A UNC path, a mapped drive, a reserved device name and a source name outside
  of ASCII all keep the readable part of the name and build.
- A build directory that is already past 260 characters needs no diagnostic:
  the standard library hands absolute paths to the file system in their
  verbatim form, so the compiler builds through it. What fails on such a path
  are the tools around the compiler, which is what the fix is for.

Left open, as before: nothing removes the mirrored tree that an older `plc`
wrote into a build directory.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A library is pulled in with one glob per extension, `include/*.st` and
`include/*.pli` for the standard library, so two units can share a stem and
differ only in their extension. Once the stem reaches the limit of the readable
part, the cut falls on the dot of the source extension and both names lose it,
which leaves the digest as the only thing telling the two artifacts apart.

The existing tests covered the two halves of this separately, a cut stem and an
extension that differs, but not the combination the standard library can
actually produce.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Build Artifacts

🐧 Linux

Artifact Link Size
deb-x86_64 Download 10.9 MB
schema Download 0.0 MB
stdlib Download 33.5 MB
plc-x86_64 Download 43.5 MB
deb-aarch64 Download 5.4 MB
plc-aarch64 Download 43.3 MB

From workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant