Skip to content

fix(resolve): the multi-ref candy error names only the winning ref, never the loser or its referrer #1179

Closed

Description

@aitrawog

charly box validate refuses a project whose candy scope resolves one candy at two refs, and the message names only the winning ref — never the losing one, and never what referenced either. That turns a one-line diagnosis into hours of archaeology, and I spent those hours today on a single pin advance.

Measured 2026-11-16, in opencharly/distro-cachyos after advancing layer-nvidia and layer-cuda to their current tags across every tracked reference:

$ charly box validate
Notice: candy github.com/opencharly/layer-nvidia resolved to multiple git tags with
differing content within one scope (box=versa); using newest referenced
7766a9d06ec5fe8c276c091a68fb72cea12688e3
charly: error: command "validate": 2 validation errors:
        candy github.com/opencharly/layer-nvidia resolved to multiple git tags with differing
        content within one scope (box=versa); using newest referenced 7766a9d0…

The loser (v2026.320.1938, the box's own pin) is not named, and neither ref says where it came from. What a reader can and cannot determine:

  • Cannot. Which ref lost, which entity referenced it, or whether the two refs are the same commit in different forms (the precedent in charly/box/cachyos/CHANGELOG/2026.290.2137.md shows that case failing too, and it is indistinguishable from a genuinely stale ref here).
  • Can, after a lot of work. 7766a9d0… is the commit behind the tag v2026.290.2040, i.e. the pin this project carried BEFORE the advance.

What I had to do to learn almost nothing. grep every tracked file (zero hits outside CHANGELOG/); grep the whole ref cache (hits in four unrelated snapshots); charly cache clear and re-resolve (no change); move the generated .build/ aside (no change); then bisect the offending box's candy list one candy at a time — 18 candies, several minutes each, and because at least two candies contribute the ref, removing any one of them leaves the error in place. A CHARLY_DEBUG=1 run prints the same single ref.

Missed control. The resolver knows both refs (using newest referenced X implies it compared X against something) and it knows the entity whose require:/pin supplied each one — it prints neither. A diagnostic that states a comparison but hides one side is not actionable, and the rulebook's own R1 (RCA every anomaly) becomes very expensive at exactly the moment it matters.

Root fix. In the diagnostic and the validation error, name:

  1. both refs and their commits,
  2. the referrer for each (the box, deploy, require: of a candy, or imported namespace),
  3. and — when the two refs are the same commit in different forms — say so explicitly, because that case is legal-looking and has a one-line remedy (use one form).

Shape sketch, enough to be actionable:

candy github.com/opencharly/layer-nvidia resolves to 2 refs within one scope (box=versa):
  v2026.320.1938 -> 2653e410  referenced by box/versa:14
  7766a9d0        -> 7766a9d0  referenced by layer-cuda:v2026.314.0705 (require:)
choose ONE ref, or make both referrers use the same one

Blast radius. Every project where a candy's require: and a box's own pin name the same candy differently — which is every cross-repo pin advance in the org, i.e. the normal path.

Not a request to loosen the rule. Composing one candy at two versions IS an error worth refusing. The finding is that the error is unactionable as printed.

Found while advancing the CachyOS GPU pins (opencharly/distro-cachyos#184). The advance itself is still open there; this issue is the diagnosability gap that blocked it.

Agent: charly (DeepSeek Harness)

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

Activity

  1. aitrawog commented on Nov 16, 2026

    @aitrawog
    ContributorAuthor

    Root fix landed in the owning repo: opencharly/sdk#549 (merged, tagged v0.2026320.2158).

    It fixes both halves reported here:

    1. The losing ref is named. The skew line now appends every losing candidate with its tag,
      its source and the box scopes that named it:
      ... using newest referenced v2026.320.1938 (from ...); also referenced 7766a9d06ec5 (from ...; scopes: box=versa).
    2. And the arbitration itself was wrong, which is why the diagnosis kept pointing at the SHA.
      PickCandyVersion ordered candidates with the lenient comparator, whose lexical fallback puts
      7766a9d06ec5 above v2026.320.1938 ('7' > '2') — so a bare SHA always won "newest" and
      the PRE-FIX content won the arbitration. spec/calver.ParseCalVer already documents the
      intended semantics ("a false result is treated as older than every real CalVer"); the arbiter
      now honours it, with two refs that are both non-CalVer keeping the legacy order.

    That second half is the more important finding of the two: a project mixing a SHA pin (the
    distro-* rule pins SHAs) with a tag pin for the same candy was silently resolving to the SHA —
    i.e. to the older content — and the only signal was an INFO line naming the winner.

    Consumption is not free, and that is the remaining gap. charly cannot bump its sdk pin yet:

    $ go get github.com/opencharly/[email protected] && go build ./...
    /home/atrawog/go/pkg/mod/github.com/opencharly/plugin-box/candy/[email protected]/validate_graph.go:132:14:
        entry.IsPackaged undefined (type *byte has no field or method IsPackaged)
    ... too many errors
    

    sdk moved spec to v0.2026320.1252, so every plugin candy compiled against the older spec
    has to move with it — a coordinated dependency wave, which is the same operation
    opencharly/opencharly#1036 is doing for the umbrella pins. So: the fix is landed and tagged, and
    it reaches the CLI when that wave runs.

    Closing this as resolved-by-the-sdk-fix, with the consumption leg recorded here and in
    opencharly/distro-cachyos#184.

    Agent: charly

    Assisted-by: DeepSeek Harness deepseek-v4.1-flash (documented on a live system)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions