Skip to content

Add optional OCI output artifacts - #2790

Draft
plajjan wants to merge 3 commits into
mainfrom
pkg-output-artifacts
Draft

Add optional OCI output artifacts#2790
plajjan wants to merge 3 commits into
mainfrom
pkg-output-artifacts

Conversation

@plajjan

@plajjan plajjan commented May 18, 2026

Copy link
Copy Markdown
Contributor

Support optional Acton output artifacts fetched from OCI repositories during dependency resolution. Artifacts are keyed by source content hash, interface version, and target tuple.

Use valid local cache entries before registry lookups and fall back to source when no matching artifact is available.

Add artifact pack, push, and hash commands, local OCI layout support, tests, and guide documentation.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bee2e09576

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread compiler/lib/src/Acton/Artifact.hs
@plajjan
plajjan force-pushed the pkg-output-artifacts branch 2 times, most recently from a9e3ac3 to 65362c6 Compare May 27, 2026 21:36
@plajjan
plajjan marked this pull request as draft May 27, 2026 22:00
@mzagozen
mzagozen force-pushed the pkg-output-artifacts branch 3 times, most recently from daf969e to 71ddce7 Compare July 14, 2026 09:14
Kristian Larsson and others added 3 commits July 14, 2026 12:49
Support optional Acton output artifacts fetched from OCI repositories during
dependency resolution. Artifacts are keyed by source content hash, interface
version, and target tuple.

Use valid local cache entries before registry lookups and fall back to source
when no matching artifact is available.

Add artifact pack, push, and hash commands, local OCI layout support, tests,
and guide documentation.
An artifact ships the compiled type interfaces (.tydb) only, without
source or generated C. Producing one (acton artifact pack/push) now
runs just the front passes: a new skip_backpass compile option creates
no back jobs at all, eager or deferred, and keeps codegen staleness
from forcing any work. The option is also exposed as acton build
--skip-backpass for interface-only builds.

Code generation is deferred to the consuming build, which regenerates
C from the shipped .tydb. With no source available the generated code
carries no #line directives, because the source is needed to map byte
offsets to newlines. A later full build in the producer checkout
likewise finds the generated code missing via the impl hash tags in
.c/.h and runs the back passes then.
Producing an artifact (acton artifact hash/push) seeds the shared Zig
cache with the producer's own source, so on that host -- and in CI
where produce and consume share a runner -- dependency resolution
always found cached source and re-type-checked the dependency from
scratch, never consuming the artifact it had just published.

Passing --artifact-repo now expresses artifact consumption: a valid
output artifact is preferred over already-cached source, both when the
deps cache holds a source checkout (which is replaced in place) and
when only the Zig cache is seeded. On a miss resolution falls back to
the cached source as before. Without the flag cached source still wins,
so ordinary builds never retry artifact pulls for deps they have.

Also gate the fresh-fetch path on cacheEntryExists so dir and archive
cache forms behave the same; hashing a local path seeds the archive
form.
@mzagozen
mzagozen force-pushed the pkg-output-artifacts branch from 71ddce7 to 15cbaee Compare July 14, 2026 10:56
Comment on lines +77 to +83
Passing `--artifact-repo` opts the build into artifact consumption: a valid
artifact is preferred even when a cached source entry already exists, and the
cached source is used only when no artifact can be found. This matters on a
machine that has published the artifact itself, since producing seeds the
caches with the package source, which would otherwise always win over the
artifact. Without `--artifact-repo`, a cached source entry is used as is,
without probing remote artifact repositories.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that the only use of this option is to test the artifacts. The design is that the cached artifact output is 100% deterministic, so there is no such case as "invalid cache / artifact", so why would anyone need this?

If you want to clear the cache for testing, I think it is better you run rm -rf ~/.cache/acton/...

Artifact.writeManifest tmp (Artifact.expectedManifest sourceHash)
runProcessChecked Nothing "tar"
[ "-czf", output0
, "--exclude=*.c", "--exclude=*.h"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want options for this. I am fine to remove the .c and .h file entirely from the artifact since it is only the TYDB that can truly be cached. I should probably have made it only TYDB from the beginning...

optimize :: OptimizeMode,
only_build :: Bool,
skip_build :: Bool,
skip_backpass :: Bool,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be an option. New selective back loader will see 0 roots for typical device model project, so no output .c files will be produced at all.

@mzagozen

Copy link
Copy Markdown
Collaborator

@plajjan I rebased this branch many times over. It predated DBP, and at one point was also based on dce. I was only focused on testing the small-includes-big pattern. So don't read too much into the options, feel free to remove what doesn't fit :)

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.

2 participants