Skip to content

fix(ci): an untagged merge now reddens tag-on-merge and NAMES the PR - #289

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/tag-on-merge-untagged-detector
Nov 9, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/tag-on-merge-untagged-detector

Conversation

@aitrawog

@aitrawog aitrawog commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

An untagged merge is now loud: tag-on-merge ends with a step that asserts every merged PR in its sweep window resolves to a tag at its merge commit, and fails naming the PR when one does not. opencharly/.github#286's own failure — the step dying inside a transient 5xx before it wrote anything — is covered too, because the assertion runs on a non-cancelled condition, i.e. after a failed step.

Summary

The sweep could leave a merged PR untagged in two ways, and neither was visible to anyone but the person who happened to ask:

  • SILENT — in sweep mode each per-PR failure is caught and downgraded to a core.warning that prints the error and logs — continuing, so the step exits 0 with the merge untagged. A green run therefore does not mean "every merge is tagged".
  • FATAL — a transient 5xx or socket reset aborts the step before any tag is written (#286's own evidence: HttpError: other side closed in the listing read). The next step would be skipped, so the untagged merge stays unnamed even though the run is red.

The new step is the post-condition of both, and it derives no CalVer: it asks only whether each merge commit carries any tag, so it cannot drift from the naming rules in the step above (root CalVer, the Go-module form, the subdir module tag). An annotated tag is dereferenced to its commit — comparing against the tag object would be a false negative for every annotated tag in a repo that carries one.

The window is now one literal, the job's SWEEP_WINDOW_HOURS, read by both the sweep and the detector. Two literals would let the detector judge a population the sweep never acted on. A missing or non-numeric value fails the run rather than defaulting to an empty window, which would report "nothing to tag" forever.

$ git show --stat --oneline HEAD
5491546 fix(ci): an untagged merge now reddens tag-on-merge and NAMES the PR
 .github/workflows/tag-on-merge.yml    | 110 ++++++++++++++++++++-
 .github/workflows/workflow-checks.yml |   7 ++
 scripts/tag-on-merge-assert_test.sh   | 175 ++++++++++++++++++++++++++++++++++
 3 files changed, 290 insertions(+), 2 deletions(-)

How tested

The gate that owns this change is workflow-checks (this repo's .github/workflows/workflow-checks.yml); this diff also has no runtime path outside it. Every offline step of that gate was run on the committed tree at head 54915461397b32e23e7c7527de2fde12292e74fd (clean worktree):

$ bash scripts/tag-on-merge-assert_test.sh
ok   c1
ok   c2
ok   c3  ->  PR #101 — merge aaaa111111111111111111111111111111111111 (merged 2026-11-09T15:45:29Z) has no tag
ok   c4  ->  PR #101 — merge aaaa111111111111111111111111111111111111 (merged 2026-11-09T15:45:29Z) has no tag
ok   c5
ok   c6
PASS: tag-on-merge untagged-merge detector (8 properties: 4 green arms, 2 red arms naming the merge, 2 structural)

c3 and c4 print the line the detector emitted: the red arm names the merge, which is the whole property #286 asks for. The rest of the gate, same tree:

$ for s in tag-on-merge-assert_test.sh org-ruleset_test.sh retire-per-repo-dispatchers_test.sh \
           retire-per-repo-candy-gates_test.sh strip-config-version_test.sh head-settle_test.sh \
           assert-org-rulebook_test.sh reconcile-tag-on-merge-callers_test.sh bootstrap-repo-main_test.sh; do
    bash scripts/$s >/dev/null 2>&1 && echo "PASS $s" || echo "FAIL $s"; done
PASS tag-on-merge-assert_test.sh
PASS org-ruleset_test.sh
PASS retire-per-repo-dispatchers_test.sh
PASS retire-per-repo-candy-gates_test.sh
PASS strip-config-version_test.sh
PASS head-settle_test.sh
PASS assert-org-rulebook_test.sh
PASS reconcile-tag-on-merge-callers_test.sh
PASS bootstrap-repo-main_test.sh

Plus python3 scripts/check-action-runtimes.py --self-test and bash scripts/governance-reconcile.sh --self-test, both exit 0, and both changed workflows parse (yaml.safe_load).

The coverage discriminates — two mutation arms, run on this tree and then reverted. A detector that cannot fail is not a detector, so the red arms are proved by making the shipped logic wrong:

$ # mutation A: remove the step's non-cancelled condition
$ bash scripts/tag-on-merge-assert_test.sh
FAIL: the detector must carry a non-cancelled condition (!cancelled()) — without it the step is SKIPPED when the tagging step died, which is the one case (#286) where the untagged merge would otherwise stay unnamed
$ # mutation B: the merge-commit comparison replaced with `if false; then`
$ bash scripts/tag-on-merge-assert_test.sh
FAIL: case c3: expected RED (non-zero), got 0

The changed JS line executed, not merely parsed. The sweep's window expression is the only JS touched; the shipped script text was extracted and run under Node with stubs for the API it touches:

$ node /tmp/sweep-harness.mjs .github/workflows/tag-on-merge.yml good
CREATEREF refs/tags/v2026.313.1544 @ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
INFO Tagged v2026.313.1544 at aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (PR #7)
INFO PR #7 has no body — skipping CHANGELOG creation
INFO Sweep complete
RESULT: ok — the sweep computed its window from SWEEP_WINDOW_HOURS and tagged the merge

$ node /tmp/sweep-harness.mjs .github/workflows/tag-on-merge.yml bad
RESULT: ok — invalid window failed loud: SWEEP_WINDOW_HOURS is not a positive number: "nope"

The harness itself is a local one-off (not committed): what it proves is that the shipped text computes its window from the env literal and fails loud on a bad value. The committed coverage is the extracted shell step, which is the new logic.

Stated, not hidden: the sweep's tag-creation path is not exercised end to end against a real GitHub API before merge; the first live proof is the first merge after this lands, whose tag-on-merge run now carries the assertion.

Rulebook compliance

  • R0 — /charly-internals:repo-setup and /charly-internals:git-workflow are the two skills this repo's own AGENTS.md names; both were read before the first edit, and this repo's AGENTS.md ("Modify this repo", "Landing") was read first.
  • R1 — the mechanism is quoted from #286's own log (HttpError: other side closed in the listing read), the missed control is named in the workflow comment (a core.warning downgrade, plus a skipped step on the fatal path), the blast radius is every repo carrying the caller, and the root fix is the assertion. No anomaly was filed away to land this.
  • R2 — one detector, one window literal, one extraction helper reused from scripts/lib-org.sh (extract_step_run / extract_step_yaml) rather than a second awk. No CalVer logic is duplicated.
  • R3 — no sleep, no retry, no suppression. The fatal path is not silenced: a dying sweep still fails, and the detector adds the name.
  • R4 — no documented command changes; the workflow's own header comments describe the new step.
  • R5 — nothing is shadowed: the old inline 24 * 3600 * 1000 is replaced, not kept beside the new literal.
  • R6 — branch feat/tag-on-merge-untagged-detector off origin/main bd1e195; no force-push, no rewrite, nothing of another session's touched (the two open PRs in this repo, #287 and #207, are on different files).
  • R7 — coverage that fails without the change, proved by the two mutation arms above; the emitted artifact under test is the shipped step text itself, extracted from the workflow.
  • R8 — no live service is mocked in this diff's behaviour. The mock gh is the test's stand-in for the API inside the coverage, and the shipped step calls the real API.
  • R9 — not applicable: no charly binary is built or invoked by this change.
  • R10 — no disposable: true target applies to a GitHub Actions workflow; the change-class gate for this repo is workflow-checks, run above, and the required charly/pr-validator runs on this PR.

Filed issues

  • opencharly/.github#286 — this PR implements its detector half and deliberately not the retry half (R3: no blind retries or sleeps). The issue stays OPEN carrying the retry, which this PR does not close.
  • opencharly/crabbox#40 — the same missing control from the consumer end, and its recorded root fix is this assertion. Its own residual is stated: crabbox#1 merged before the caller existed, so no run at all fired and its 24h window has now expired — that one merge stays untagged, and the add-only backfill is the documented remedy. No consumer needs it: the umbrella pins crabbox at the merge commit.

Change classification

CI control — one assertion step added to the org-wide reusable tag-on-merge workflow, one test wired into workflow-checks, and the sweep window's literal named once at job level.

Breaking change + rollback: none — the workflow gains a step and reads an env value it now declares itself; no caller changes, and no tag's name or target moves. Rollback is reverting this branch.

Refs #286
Refs opencharly/crabbox#40

Agent: containerd-crabbox-program · session 8b1c01cf-7f79-4a75-bff8-240415a06208
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)

The sweep can leave a merged PR untagged in two ways, and neither was visible to
anyone but the person who happened to ask.

  * SILENT: in sweep mode every per-PR failure is caught and downgraded to
    `core.warning('... - continuing')`, so the step exits 0 with the merge
    untagged. A GREEN sweep therefore does not mean "every merge is tagged"; it
    means "no error escaped", which is a different sentence.
  * FATAL: a transient 5xx or socket reset aborts the step before any tag is
    written (#286's own failure, `HttpError: other side
    closed` inside the listing read). The next step would be SKIPPED, so the
    untagged merge stays unnamed even though the run is red.

This adds the missing control: a final step that asserts the post-condition of
BOTH paths -- every PR merged inside the sweep window resolves to a tag AT its
merge commit -- and fails naming the PR. The condition is `!cancelled()` rather
than `always()`: that is what makes it run after a FAILED step, while a
superseded run stays CANCELLED instead of turning red on a merge it never tried
to tag.

It derives no CalVer. It asks only whether each merge commit carries ANY tag, so
it cannot drift from the step's naming rules (root CalVer, the Go-module form,
the subdir module tag). An annotated tag is dereferenced to its commit;
comparing against the tag OBJECT would be a false negative for every annotated
tag in a repo that carries one.

The window is now ONE literal, the job's SWEEP_WINDOW_HOURS, read by both the
sweep and the detector. Two literals would let the detector judge a population
the sweep never acted on -- a green detector over merges nothing looked at. A
missing or non-numeric value fails the run instead of defaulting to an empty
window, which would report "nothing to tag" forever.

Coverage, executed offline (`scripts/tag-on-merge-assert_test.sh`, wired into
workflow-checks): it extracts the shipped step's text and runs THAT against a
mock `gh` which applies the step's own `--jq` filter, so the real filter is under
test. Four GREEN arms (lightweight tag; annotated tag dereferenced; a merge
outside the window; a closed-but-unmerged PR) and two RED arms which must fail
AND name the merge (no tag at all; a tag at a different commit). Two mutation
arms were run: the coverage goes red when the comparison is neutered -- a
detector that cannot fail is not a detector -- and when the step's condition is
removed.

Deliberately NOT in this change, and the reason is the rulebook rather than
effort: the retry half of #286. R3 forbids blind retries and sleeps; the control
that makes a persistent provider failure loud is the detector, and a retry can be
argued for separately once this shows how often the transient class fires. So
this change does not close #286.

Local gate: every offline workflow-checks script PASS (11/11); both workflows
parse; the shipped sweep JS was executed locally against stubs (window read from
SWEEP_WINDOW_HOURS and the tag emitted; an invalid value failed loud). The repo's
live gate (workflow-checks + the required validator) runs on the PR.

Refs #286
Refs opencharly/crabbox#40

Agent: containerd-crabbox-program
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)

Co-authored-by: Andreas Trawoeger <[email protected]>
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: 54915461397b32e23e7c7527de2fde12292e74fd (branch: feat/tag-on-merge-untagged-detector)

Security screen: PASS
Checklist: All applicable rules PASS or NA. (Tool-limited: offline test output cross-checked for internal consistency against the diff; change-class gate workflow-checks is the applicable gate, and the live GitHub-API path is honestly disclosed as unobservable pre-merge — not a block.)

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 9, 2026 16:49
@github-actions
github-actions Bot merged commit 28a0b71 into main Nov 9, 2026
4 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 9, 2026
github-actions Bot pushed a commit to opencharly/opencharly that referenced this pull request Nov 9, 2026
#958)

One `charly task sync` wave in a worktree off origin/main 5d9e744. Two pins
moved, and each new value equals the ref its leaf intent (`upstream:main`)
names, re-read from the remote rather than inferred:

  dotgithub      bd1e195cadfce40e09719d99a16f7353e1aa27bd -> 3f1ad6cab29c5ba58ad13778e139f4f24da0fd2b
  plugin-tunnel  e0edafce6c248f3bc80bb431f9e17f37d228eba7 -> ba69046fdbf88847a050e5b68e54f57b6a17c429

dotgithub moved because opencharly/.github merged the tag-on-merge assertion
(opencharly/.github#289, squash 28a0b7151a88da81611edf5ba8b11c10dd17f61d, tag
v2026.313.1651) plus its CHANGELOG commit. plugin-tunnel had squash-advanced on
its own remote: `not-on-the-served-line`, which is an advance available now, not
a divergence.

R9: the binary that ran the wave and the gate was built IN this worktree
(`charly/scripts/bootstrap-charly.sh`, `charly version 2026.313.1024`) from the
tree's own charly checkout 68fc2a62 — the rebuild is the proof, because a
CalVer stamp at build time cannot prove binary==source on its own. The wave did
not move the charly pin, so the binary stayed valid for the gate.

Gate on the committed tree:

  charly task verify   -> 48 step(s), 0 failed, 0 skipped   (exit 0)
  currency             -> 0 of 409 pin(s) NOT current [409 cur]

The gate log carries ONE line a reader should classify rather than skim:
`WARNING: charly is a dev/worktree build (not installed at /usr/bin or
/usr/local/bin); NOT loading the installed package's plugins`. That is the
worktree-build NOTICE R9 requires — the gate must run a binary built from this
tree, never a shared install — and not a gate warning: every step reports pass,
0 skipped.

Two gitlinks staged, nothing else. No hand-pin.

Agent: containerd-crabbox-program
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)

Co-authored-by: Andreas Trawoeger <[email protected]>
github-actions Bot pushed a commit that referenced this pull request Nov 10, 2026
…ver write the source repo (#296)

Clean successor to #295, which the validator auto-closed after five counting verdicts.
The state is the same as that PR's final head — every finding from its five rounds is
fixed here — carried as ONE commit on a branch off fresh `main`.

TWO DEFECTS, AND THE P0 THEY EXPOSED.

1. P0 — the REUSABLE was replaced by a caller. The `#204` fleet reconcile copies the
   canonical CALLER template to `.github/workflows/tag-on-merge.yml` in every repo,
   including `opencharly/.github`, where that path is the REUSABLE every caller invokes.
   Commit 30139d6 wrote the caller over it: `workflow_call` 2 -> 0 and the #289 detector
   gone, so every `uses: opencharly/.github/.github/workflows/tag-on-merge.yml@main` in
   the org was calling a non-reusable workflow. This restores the file from 28a0b71 and
   adds the guard that should have existed: the SOURCE repo is skipped, never written.

2. The write bypassed the release chain. The reconcile PUTs to `main`, so nothing tags
   it — and a head that is untagged and not the `docs: add CHANGELOG …` commit above a tag
   fails `design-pintag` for every pin that advances to it (389 findings measured), while
   that control forbids RAISING its census. The write now captures the PUT's
   `.commit.sha`, derives the CalVer from that commit's own committer date, and mints the
   tag at it. THE FORM IS PER-REPO, mirroring the reusable: `sdk`, `spec` and `plugin-gh`
   get Go's module form `v0.<y><doy>.<hhmm>`, everything else the plain CalVer — a plain
   `v2026.…` on a proxy-consumed module is a major version needing a `/vN` path that no
   consumer could name.

Gate on this tree:

  reconcile-tag-on-merge-callers_tag_test.sh  PASS (6 properties)
  reconcile-tag-on-merge-callers_test.sh      17 passed, 0 failed
  org-ruleset_test.sh                         all assertions passed
  tag-on-merge-assert_test.sh                 green (it failed while the reusable was a caller)
  workflow_call in the restored reusable      2

RCA, the controls this PR produced, each from a round of the closed thread:

* a pasted transcript must be REGENERATED after the last edit to the file that produces it
  — round 1 pasted a line the file could not print;
* a limitation in the body is a finding to eliminate or file, never a substitute for the
  arm — round 2's "the mock cannot drive the repo name" was false, and `SOURCE_REPO=fixture`
  exercises the guard;
* a test header is written LAST, by reading the arms — round 3's header claimed an
  idempotency arm that did not exist;
* "the CalVer shape tag-on-merge uses" is THREE shapes, not one — round 4's module-form bug
  would have minted unusable tags on `sdk`, `spec` and `plugin-gh`.

Agent: containerd-crabbox-program
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)

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.

2 participants