Skip to content

Build each leaf-assets publication on the branch's pin - #1857

Merged
max-sixty merged 4 commits into
mainfrom
asset-publish-on-pin
Oct 6, 2026
Merged

max-sixty merged 4 commits into
mainfrom
asset-publish-on-pin

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

A publication to max-sixty/leaf-assets cloned the repository's head and set a directory to exactly the files that run produced. If another branch had published a file into that directory since this branch's pin, the file was on the head but missing from this run, so the publication deleted it. While #1793 was in review, another session's thread-image publication removed its new inline-dark images this way.

  • clone now checks out the revision leaf-assets.json pins. A stage's additions, replacements and removals are therefore measured against the set this branch reads.
  • publish commits that change, records it at refs/leaf-assets/change in the checkout, and replays its file list onto the current head:
    • each file the change added or altered takes the change's copy;
    • each file it removed is removed, whatever the head did to that file meanwhile;
    • files other branches published since the pin survive.
  • Retries. A refused push replays onto the new head and tries again, up to three times. A later publish call on the same checkout replays the kept change onto the head as it then stands.
  • Catalog links derive from the commit each attempt pushes. An unchanged checkout keeps its pin rather than moving to the head.
  • Thread-snapshot acceptance (thread_snapshots_revision, from Add optional Playwright trace review and comments #1850) still installs its whole expectation tree exactly as staged. clone and stage return a Checkout (its path, the pin key it was cloned from, and with replace_tree=True the directory it owns), and publish takes that value. replay installs an owned tree whole from the change, so head files outside the tree survive. The pin a checkout publishes is the one it was cloned from: stage/clone take revision_key, and publish no longer does.
  • AGENTS.md:
    • a conflict on the media revision takes the later pin, which now holds both branches' files;
    • a file both branches published is published again from the merged tree;
    • a conflict on thread_snapshots_revision is accepted again from the merged tree.

Validation

test_a_publication_keeps_what_others_published_since_its_pin is new.

  • Two branches share one pin. Between them they add, rewrite and remove files, and touch the same files in each direction:
    • both rewrite one file;
    • the first removes a file the second rewrites;
    • the first rewrites a file the second removes.
  • Result. The head holds the first's addition, the second's addition, and the second's choice on every shared file.
  • Retry. A third publication is refused by the remote. Another publisher then lands, and the third's retry lands on top with both changes.
  • Against older code.
    • Pre-PR code: the test fails on the first branch's dropped file.
    • This PR's earlier cherry-pick version: it fails on both modify/delete conflicts.

The existing publication test passes in both variants, including the refused push and its retry.

This was written by Claude Code on behalf of max-sixty

A publication used to clone the asset repository's head and make a
directory's files exactly the ones this run produced. A file another
branch had published into that directory since this branch's pin was
on the head, absent from this run, and so deleted: while #1793 was in
review, another session's thread-image publication removed its new
inline-dark images.

The clone now checks out the pinned revision, so a stage adds, replaces
and removes against what this branch reads. Publish commits that change
and cherry-picks it onto the current head before pushing, keeping what
others published since. Where both changed one file, the publishing
change's copy stands, as it would have on its own pin. The head stays a
line, so of two pins that meet in a merge the later holds both
branches' files. An unchanged checkout now keeps its pin rather than
moving it to the head.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two overlapping publication cases still prevent a completed publish; details inline.

Comment thread dev/leaf_dev/leaf_assets.py Resolved
Comment thread dev/leaf_dev/leaf_assets.py Resolved
… push

Review of the cherry-pick found two ways a publication could stop
short. Where one side removed a file the other changed, `-X theirs`
leaves a modify/delete conflict rather than applying the rule that the
publishing change's choice stands. And a push refused because another
publisher moved the head left a clean checkout whose retry pushed the
same stale commit again.

The change now lives at `refs/leaf-assets/change` in the checkout, and
`replay` applies its file list to the current head: each file it added
or altered takes its copy, each it removed is removed, whatever the
head did to that file. `publish` replays and pushes up to three times,
and a later call replays the kept change onto the head as it then
stands. The catalog links derive from the commit each attempt pushes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 6, 2026
# Conflicts:
#	dev/leaf_dev/leaf_assets.py
#	tests/test_leaf_assets.py
leaf-agent
leaf-agent previously approved these changes Oct 6, 2026
`clone` and `stage` wrote which pin the clone came from and which tree
the writer owned into the clone's git config, for `publish` to read
back. The facts travelled hidden between two calls. They now return a
`Checkout` carrying the clone's path, its pin key and the owned tree,
and `publish` takes it; callers that read files use `checkout.path`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 58aaf44 into main Oct 6, 2026
5 of 6 checks passed
@max-sixty
max-sixty deleted the asset-publish-on-pin branch October 6, 2026 06:39
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