Skip to content

fix(build): user-scope the image build lock on the full ref (cross-project race) - #14

Merged
atrawog merged 2 commits into
mainfrom
feat/image-build-lock-userscope
Jul 8, 2026
Merged

atrawog merged 2 commits into
mainfrom
feat/image-build-lock-userscope

Conversation

@atrawog

@atrawog atrawog commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

acquireImageBuildLock keyed the per-image build lock per .build dir (<buildDir>/.locks/<short-name>.lock), so two projects producing the SAME image ref took distinct locks: box/arch's arch-builder and box/cachyos's namespaced arch.arch-builder both resolve to ghcr.io/opencharly/arch-builder, yet their per-dir locks let them cold-build that one ref concurrently into the one shared podman graphroot — a store-write race (a latent sibling of the retention-untag race P1 already fixed; rca-tag-race flagged it for its own cutover). Re-keyed to the user cache on the tag-stripped full ref (~/.cache/charly/locks/image-<sha8>.lock, the acquireLocalPkgBuildLock pattern — R3): every tag of an image, across every project, shares one lock and serializes; distinct refs (the leaf fan-out) keep distinct locks and build in parallel.

Change class + gate (R10, code)

  • go test ./... green — new TestImageBuildLockPath pins the key (same ref/diff tags → one lock; registry:port not tag-stripped; distinct refs → distinct locks; user-scoped, not .build). golangci-lint 0 issues; gofmt clean; task build:charly R9 (charly version 2026.189.0423).
  • Live (the changed lock code executed): charly box build arch-builder → Successfully tagged … EXIT 0, and the user-scope lock file was created:
/home/atrawog/.cache/charly/locks/image-1c48684588f9e0d0.lock

Single-repo (no submodule change). The separable keep_images-across-box/* policy alignment is queued as its own follow-up (safe now that P1's retention floor prevents in-flight untagging).

Tier: fully tested and validated — the changed lock keying ran live in a real image build (acquired the user-scope lock, EXIT 0), and the cross-project serialization key is unit-proven.

Assisted-by: Claude (fully tested and validated)

…oject race)

The per-image build lock was keyed per-.build-dir on the short name, so two
projects producing the same ref (box/arch `arch-builder` + box/cachyos
`arch.arch-builder`, both → ghcr.io/opencharly/arch-builder) took distinct locks
and cold-built the same ref concurrently into the one shared podman graphroot —
a store-write race (latent sibling of the P1 retention race). Re-key to the user
cache on the tag-stripped full ref (acquireLocalPkgBuildLock pattern, R3): every
tag/project of an image shares one lock; distinct refs stay parallel. Unit test
pins the key; live arch-builder build acquires the user-scope lock, EXIT 0.

Assisted-by: Claude (fully tested and validated)
@atrawog

atrawog commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: code (charly Go — image build lock re-key)

Independent re-validation by a FRESH evaluator (new context, not the author). Every check re-run, not taken on trust:

Check Verdict
Security & anti-tampering (T1–T4) PASS — no secrets/exfiltration/network; no guardrail/hook/branch-protection/CLAUDE.md/validator-spec change; no supply-chain edit; diff == description (lock re-key + test + CHANGELOG); no manipulation directed at the validator
Description complete PASS — Summary + change-class/R10 gate + pasted evidence + tier + trailer
Change-class gate matches evidence (R10, code) PASS — re-ran live myself (below)
Attribution tier justified PASS — fully tested and validated; the changed lock path executed live in a real build
R5 grep self-test PASS — old 2-arg acquireImageBuildLock gone; all call sites 1-arg; no stale .build/.locks image-keying reference (generate.go:253 .locks is the generic dot-prefix skip; check_bed_run.go .locks is the unrelated VM-domain lock)
R1–R4 / clean architecture PASS — imageBuildLockPath mirrors acquireLocalPkgBuildLock (R3); test reuses registry.go contains (no dup); no sleep/retry/magic-number; no dual-mode path
CHANGELOG present PASS — placeholder staged; finalized to the merge-time CalVer here
Skills honored PASS — go / go-quality / strict-policy / git-workflow

Independently reproduced:

  • No submodule pointer change (git diff origin/main...HEAD --submodule=short — code-only).
  • gofmt -l . empty; go build ./... exit 0; go test ./... ok (charly 51s + pluginsgen); go test -run TestImageBuildLockPath -v PASS; golangci-lint run ./... 0 issues.
  • task build:charly → charly version 2026.189.0430 (R9); PKGBUILD restored.
  • Live: charly box build arch-builder → Successfully tagged … EXIT 0. The changed keying ran: the user-scope lock ~/.cache/charly/locks/image-1c48684588f9e0d0.lock (mtime during the build) is EXACTLY sha256("ghcr.io/opencharly/arch-builder")[:8] — the tag-stripped full-ref derivation, not a .build-dir lock.

Tag-strip correctness verified — LastIndex(":") > LastIndex("/") preserves a registry:port colon (unit test covers localhost:5000/...), strips only a real :tag.

Note (non-blocking, no action required): the generate.go:253 comment still lists .locks among .build staging dirs — it stays defensively accurate for upgraded checkouts carrying a stale .build/.locks/, references no deleted identifier, and does not affect the generic HasPrefix(".") skip.

Decision: APPROVED. The cross-project cold-build store-write race is closed by keying the lock on the user-cache tag-stripped full ref; distinct refs keep the leaf fan-out parallel. Cross-project 2-project simultaneous serialization is unit-proven (key mapping), the changed code executed live. Finalizing merge-time CalVer, rebase-merging, tagging.

Assisted-by: Claude (fully tested and validated)

…e image build lock)

Merge-time version stamp for PR #14 (fix(build): user-scope the image build
lock on the full ref). Placeholder CHANGELOG/2026.189.0425.md renamed to the
CalVer generated at merge; no schema change (Go code only, wire keys unchanged).

Assisted-by: Claude (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01LjLm6DGQasmXaXw2ZorwhE
@atrawog
atrawog merged commit f22168b into main Jul 8, 2026
@atrawog
atrawog deleted the feat/image-build-lock-userscope branch July 8, 2026 04:39
atrawog added a commit that referenced this pull request Jul 24, 2026
…lugin-side, core arm deleted

Wires candy/plugin-check's Mode:"live" dispatch to a new plugin-resident
pluginCheckRunLive (live_gather.go), the port of charly/check_cmd.go's
checkLiveGather + checkLivePod/VM/Local/Group — the full four-kind live
check-run gather, using the already-portable venue/members/cmd_helpers
library (Unit A) plus the plugin verb dispatcher (Unit B). The one genuine
core-only gap — connecting an out-of-process plugin candy a live plan's
verb words reference — got a thin new "check-load-plugins" HostBuild seam
(host_build_check_load_plugins.go) that triggers the UNCHANGED core engine
(resolveCheckRunnerContext) as a side effect; every other dependency was
already sdk-portable or resolvable off the resolved-project envelope's
existing fields (rp.Templates.VM/.Local decode 1:1 into vmshared.VmSpec /
spec.Local — the same shape a fresh core decode would produce).

Deletes the corresponding core bodies in the same commit (delete-as-you-
wire): host_build_check_run.go's hostCheckRunLive/hostCheckLive, and
charly/check_cmd.go's CheckLiveCmd + all its checkLive* methods (~715
lines net off check_cmd.go). Ports the RCA #13/#14 regression tests
(leaf-vm-under-non-vm-parent tree-walk, guest nested check-cmd quoting,
VM_HOSTDEV_COUNT nil-safety) to the plugin package verbatim in substance.

R5 grep self-test clean; go build/vet/test green in both charly and
candy/plugin-check. Live-proven on the check-exampledeploy disposable bed
(local-venue class): full R10 sequence PASS, check-live PASS 5/5 steps,
header confirms the new plugin-side dispatch executed. The VM-venue path
(pluginCheckLiveVM) is unit-tested (ported RCA regressions) but blocked
from a live bed proof by an unrelated PRE-EXISTING bug in charly vm create
(applyCueDefaults vm: unify with #vm: raw: field not allowed — traced to
candy/plugin-substrate's Raw echo field never being declared in schema/vm.cue;
confirmed zero overlap with this cutover's diff) — flagged to the wave lead
for triage; live VM-path proof follows once that lands.

Assisted-by: Claude Code (Anthropic Claude Opus 4.6; analysed on a live system)
atrawog added a commit that referenced this pull request Jul 24, 2026
…amed batch

Operator-flagged R2 violation in CHANGELOG/2026.205.2200.md's "Non-blocking
findings" section: "pre-existing" is one of R2's four explicitly-banned
framings ("pre-existing"/"out of scope"/"unrelated"/"follow-up PR"), and the
section stopped at disclosure without routing the 14 untouched-file findings
to a real, named, owned thematic batch (disclosure alone is not fixing).

Disposition is UNCHANGED — the 14 findings correctly stay OUT of this
core-minimization PR (theme-coherence + modified-code-full-compliance: none
is in a file this wave modifies). Only the WORDING changes:
  - "pre-existing" replaced throughout with "on files this wave does NOT
    modify" (still individually verified via `git diff --stat
    origin/main..HEAD -- <file>`, still itemized by file:line).
  - Explicitly routed to orchestrator task #14, the golangci-lint
    category-sweep thematic batch (gocritic/gocyclo/prealloc/unconvert/
    unparam across candy/plugin-bundle, candy/plugin-vm, candy/plugin-preempt),
    scoped and beginning immediately after this cutover lands.
  - The already-fixed QF1002/venue.go/S1040 bullets are unchanged (they were
    already compliant — fixed outright, not disclosed as debt).

Also corrected the Assisted-by trailer's model identity (Claude Opus 4.8,
this team's actual documented teammate instantiation, not 4.5).

Assisted-by: Claude Code (Anthropic Claude Opus 4.8; documentation reviewed)
atrawog added a commit that referenced this pull request Jul 24, 2026
…fixes

K1-alpha "unblock wave 1": the largest coherent core-minimization batch of
the current program, integrating two parallel legs (K1-unblock work-arms +
K5-A items, and the W4 pure-helpers/K5-A item 2 leg) plus a retention-engine
relocation. Net core reduction across charly/*.go: 92 files changed,
1,924(+)/4,327(-) = net -2,403 lines (non-test source alone: net -2,060).

Consumes three merged sdk PRs (#98, #99, #100, #101 — sdk gitlink 0eb86a1,
tag v0.2026205.1841) and one merged plugins PR (#112 — gitlink ede5c1b).

Five regressions found and fixed during integration by the full
disposable-bed R10 roster (not any single leg in isolation), each RCA'd and
fixed in this same cutover: a SIGSEGV from a namespaced box's nil
BakedMetadata; charly update on a k3s deploy never re-establishing its
forwarded kubeconfig port; and three successive sites of one underlying bug
class on the --add-candy/add_candy: path (a remote candy ref silently
dropped from later independent resolved-project re-fetches). Full narrative:
CHANGELOG/2026.205.2200.md, CHANGELOG/2026.204.0001.md,
CHANGELOG/2026.205.0130.md.

Four rounds of independent pr-validator review caught and required fixing:
a self-introduced golangci-lint finding (QF1002) initially mischaracterized
as pre-existing; two dead functions + a redundant assertion left unpruned by
a relocation; a stale CHANGELOG disclosure that missed an earlier
correction; an incorrect model attribution (corrected to Claude Sonnet 5,
the verified authoring model); and a disclosure-without-routing R2 framing
gap (the 14 genuinely pre-existing findings on untouched files are now
routed to orchestrator task #14, a named golangci-lint category-sweep
thematic batch).

Assisted-by: Claude Code Anthropic Claude Sonnet 5 (analysed on a live system)
atrawog added a commit that referenced this pull request Aug 7, 2026
…nsus

Remove every hardcoded catalog count from the prose and docs site, and autogenerate the census in the docs plugin:

- Census autogenerated — candy/plugin-docs/gen_plugins.go generateProviderIndex now emits a computed census line at the top of reference/providers.md ("N words across M plugin candies, K compiled into the binary") plus per-class counts in each section header (singular classes read "1 word"), derived from the tree at generation time (never transcribed). A new unit test (gen_plugins_test.go) re-derives the three numbers from the same plugins slice and fails the moment they diverge.
- Counts removed — the README "How many" table becomes "Class | Examples" and the census sentences are rephrased to point at the generated provider index; ~30 candy configs skill: descriptions drop their per-image counts; the docs vocabulary page mirrors the README edits.
- Pre-existing drift surfaced by the drift gate (blocking for R10) — the committed CLAUDE.md/AGENTS.md dispatcher and pre-commit-gate.sh did not match charly marketplace generate output (the fleet cutover hand-edited the dispatcher without re-sorting; the hook entity had drifted to a "candy"-path heuristic that misses the standalone tools/* modules). The hook entity is fixed to restore the correct workspace_member_roots go.work-membership logic, and the three generated files are regenerated.
- Follow-up fixes — the vocabulary page "one entity keyword" statement is reconciled with the kind row (scoped to the candy entity); the DOCS_REF pin is re-pointed to the merged docs commit.

The submodule legs (box/fedora #14, plugins #146, docs #26, docs #27) carry the README/skill/docs projections; this super leg carries the sources + the gitlink re-points to the merged producer commits.

Assisted-by: Claude Code deepseek-v4-flash:0731-cloud (analysed on a live system)
github-actions Bot pushed a commit that referenced this pull request Aug 31, 2026
…equence assertions (#518)

box/omarchy   10a1d66c -> 5857c1a5
    import pin    v2026.243.1249 -> v2026.243.1722

Three distro-omarchy PRs, all merged and each proven on the exact tree this pins:

    #14  the desktop bed's 18 shell-IPC steps assert through the `quickshell:` verb
         instead of `command: omarchy-shell …`, which reported IPC failures on STDOUT
         while exiting ZERO. Two failure-open holes closed: eight summon steps were
         passing one argument to a two-argument QML function, and all ten had no stdout
         assertion at all — `summon` answers "ok" or "unknown" and exits zero either way,
         so they would have passed against a shell that opened nothing.

    #15  UPSTREAM-TEST-TRIAGE.md — the scope boundary between what upstream's 224-entry
         shell.d suite tests and what these beds assert, recorded as a table that can be
         re-run rather than a claim.

    #16  five Class B assertions on the ISO bed from that triage: the vconsole layout,
         the initramfs hook list, logind's inhibit delay, the locale profile hook and the
         managed browser-policy directory. Every path was probed on a live guest first —
         five sibling candidates came back ABSENT by design and are deliberately not
         asserted, because asserting them would fail a CORRECT guest.

Policy B is preserved by construction: this repo's box/omarchy IS the pin the umbrella
mirrors, so the umbrella syncs to this rather than being hand-pinned.

## How tested

    $ charly box validate
    OK — checked 607 candies, 119 boxes, 44 deploys, 7 distros, 7 builders; 0 warnings, 0 errors

The beds were proven on the EXACT commits this pins, in their own PRs:

    check-omarchy-desktop-vm   (#14)  PASS (steps=9)
                                      106 steps: 104 passed, 0 failed, 2 skipped
                                      identical live and after update destroyed and
                                      rebuilt the guest from nothing

    check-omarchy-iso-vm       (#16)  PASS (steps=9)
                                      57 steps: 57 passed, 0 failed, 0 skipped
                                      identical live and after the unattended reinstall,
                                      with all five new assertions verified PASS rather
                                      than skipped in BOTH passes

Claude-Session: https://claude.ai/code/session_01YKF2VLqeHHbrBDz8XftaD3

Co-authored-by: atrawog <[email protected]>
github-actions Bot pushed a commit that referenced this pull request Sep 20, 2026
…ame 404 (#624)

* fix(release): weld plugin-review v2026.263.1956 — it fixes the bare-name 404

Bump the WELDED plugin-review pin from v2026.263.1642 -> v2026.263.1956 so the
next charly release's plugin bundle carries the owner/repo slug fix merged into
opencharly/plugin-review#15.

The #14 weld (v2026.263.1642) made the engine FAST but exposed a regression: the
ghkit adoption collapsed (owner, repo) into ONE slug argument, while the tool
dispatch kept passing the BARE repo name. Every read-only tool 404'd
(/repos/spec/pulls/140), so the model correctly returned a BLOCK -- "No
retrievable PR state". Measured on umbrella #231 (charly v2026.263.1828, run
35531666727): get_pr_meta -> /repos/opencharly/pulls/231 404. That is why
spec#140, action-review#7 and umbrella #231 stayed BLOCKED after the #14 weld.

#15 adds toolSet.slug() -- the one place the engine's split (owner, repo) meets
ghkit's single slug -- resolves it once in call(), passes it at all seven
dispatch sites, and fails loudly on an empty owner instead of silently
re-creating the bare-name path. A stub-GitHub regression test drives all seven
tools and reproduces the 404s without the fix.

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

* docs: re-freeze the PR body with the real change-class bed evidence

Paste the release workflow's own plugin-build step run verbatim on the pinned
tag (plus the built binary's fix strings and the .providers manifest), correct
the R5 sweep to a real command+output, and lower the attribution tier to
`analysed on a live system` (the post-merge release build is the full R10).

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

---------

Co-authored-by: Andreas Trawoeger <[email protected]>
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