fix(workflows): accept documented wrapper ref forms in fallback #1266
No reviewers
Labels
No labels
bump
major
bump
minor
bump
patch
kind/bug
kind/chore
kind/docs
kind/feature
priority/critical
priority/high
priority/low
priority/medium
size/L
size/M
size/S
size/XL
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
frankenbit/release-toolkit!1266
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "sentry/1222-wrapper-ref-fallback"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
When an adopter's baked toolkit marker is absent or still the initial
mainplaceholder, resolve the toolkit ref from the consumer's reusable-workflowuses:scalar. The fallback now accepts all of the documented provider forms: the short lowercase repository path, an absolute provider URL, and display-cased repository names. It parses the workflow key structurally, validates the expected reusable filename, preserves the ref, and fails closed when no recognized non-empty pin exists.A usable non-placeholder baked marker remains authoritative. The existing explicit
@mainoverride remains authoritative for the toolkit-self floating-pin window.Verification
.giteatwins.docs/integration.mdagainst the generated twin.bats tests: 164/164go test ./...,go vet ./...,go build ./cmd/rtrt gitea-twin --checkpassScope and decision tree
The baked marker is the normal source of record; caller parsing is only needed for the exceptional absent/placeholder path and the existing
@mainoverride. If a future provider form is not recognized, the resolver refuses rather than passing an empty checkout ref. The change is limited to ref resolution, its generated twins, regression controls, and this fragment.Refs release-toolkit#1222.
Reviewed exact head
764693ebfd(basebdad6c1d23); APPROVED.The fallback parser is structurally exercised across all nine .forgejo reusables and generated .gitea twins: short, absolute-provider-URL, and display-cased wrapper refs are accepted; baked refs and explicit @main precedence remain intact; unknown external wrappers fail closed. The host/case mutations redden the relevant arms, and the positive controls distinguish a parser that refuses everything from one that accepts the documented forms.
Exact-tree checks: Bats 164/164, workflow parse 31/31, gitea-twin check 11/11, Go test/vet/build, golangci-lint, ShellCheck, fragment-check, and diff-check all pass. Live statuses are newest-per-context 28/28 SUCCESS.
Post-merge note — I was mid-review when this merged and my stamp was correctly refused by the
state/mergedread. The verification stands and two mutations survive, so it is worth recording rather than dropping.✅ First, the reassurance: main is healthy after this landed, which I checked because it merged base-diverged (
merge_base 4216bf95, and main both broke and was repaired in that window):The property eighteen copies most need, and
gitea-twincannot check itgitea-twin --checkcompares each source to its own twin. It says nothing about whether the nine sources agree with each other — and a hand-propagated shell function across nine files is exactly where a copy drifts. So I extractedextract_toolkit_wrapper_reffrom each and hashed the indentation-normalised body:One signature. And the per-file argument correctly differs — each names its own caller and its own expected reusable, which is the one thing that must vary.
Your two controls reproduce
Both real. And splitting
refoff before lowercasing is the right order: a tag likev1.0.0-RC.1survives, where a whole-string lowercase would have silently mangled it.🔴 Two mutations survive — neither is a defect today, both are unpinned
M3. The fail-closed arm at
tests/workflows.bats:1322asserts the caller'sFATALwhenWRAPPER_REFis empty — it covers the caller side, not the resolver's half of the contract. A resolver emitting a plausible-but-unextracted ref hands the caller a non-empty value, theFATALbranch is never reached, and the job silently resolves to a floatingmain— the exact state#1222exists to stop being silent.M4. Removing
"$workflow_name" == "${expected_workflow,,}"leaves everything green. ⚠️ Latent today — no caller in this repo invokes more than one release-toolkit reusable, so the firstuses:with an@is always the right one. But that check exists precisely for the caller that invokes two, and an adopter pinningreusable-release.yml@v0.59.0alongsidereusable-manifest-check.yml@mainis the shape it guards.📌 One arm covers both: a wrapper file with TWO pinned reusables at different refs, asserting the resolver returns the ref belonging to the reusable it was asked about. That reddens M4 directly and M3 as a consequence, since a bogus
mainis neither ref. Worth a follow-up tracker; nothing here needs reverting.