refactor(hybrid-gate): consume the docs-only reusable instead of copying it - #49
Conversation
…ing it #48 added `docs-only.yml` so a caller's job in a different workflow file could reach the verdict. It left hybrid-gate with its own copy, deliberately and for one PR's width. This removes the copy. The duplication is the thing that mattered. This verdict decides whether a full build runs, so a second implementation that drifts permissive reports success having built nothing — and two copies drift silently, because any given repo exercises only one of them. thumos#775 declined to re-implement it locally for exactly that reason, and the same reasoning applies inside this repo. Pinned by SHA rather than `./` or `@main`. A relative `uses:` inside a reusable that is itself called from another repository is ambiguous about which repo it resolves against, this repo had no nested-reusable precedent to settle it, and guessing wrong takes out the gate on every repo that bumps its pin. A pinned absolute reference is unambiguous in both positions and matches how callers already pin this file. That question is why this is a separate PR: CI here proves the nesting works, where a merge would only have discovered it. `docs-only` is added to the `needs:` of both consumers, not merely referenced. `needs.<job>` is undefined for a job you do not depend on and evaluates EMPTY rather than erroring; here that fails safe — empty != 'true', so the full build always runs — but it would have disabled the docs-only exemption fleet-wide with nothing going red. No caller change is required: the `workflow_call` output keeps its name, its description, and its conservative contract that any value other than the literal `'true'` means not-docs-only. Refs thumos#775.
|
Correcting a claim in the description above before this merges. I wrote that "CI on this PR proves the nesting works." It does not, and the distinction matters
What the split did buy, which still holds:
If that first bump goes red, the revert is this single commit and the reusable stays available for I would rather say what the check actually covers than let "CI proves it" stand when CI proved the |
Follow-up to #48, which added
docs-only.ymland deliberately left hybrid-gate's own copy in placefor one PR's width. This removes the copy.
Why the duplication was the point
The verdict decides whether a full build runs. A second implementation that drifts permissive reports
success having built nothing — and two copies drift silently, because any given repo exercises
only one of them.
@t0-thumosdeclined to re-implement it locally in thumos for exactly that reason:The same reasoning applies inside this repo, which is why #48 was not the finish line.
Why this is a separate PR rather than part of #48
It rests on a question I could not answer from this repo: whether
uses: ./.github/workflows/docs-only.ymlinside a reusable that is itself called from anotherrepository resolves against this repo or against the caller's. There was no nested-reusable
precedent here to read the answer off, and if it resolves caller-side it takes out the gate on every
repo that bumps its pin.
Splitting it means CI on this PR proves the nesting works, where merging #48 with it included
would only have discovered it.
The reference is pinned by SHA —
@bf948dfbfefa9b59c2d5f6b10b5eb0df3f24fb52— rather than./or@main. That is unambiguous in both positions and matches how callers already pin this file(thumos's
gate-attestation.ymlpins@d74efb1d… # main).The subtle part
docs-onlyis added to theneeds:of both consumers, not merely referenced.needs.<job>isundefined for a job you do not depend on, and the expression evaluates empty rather than
erroring.
Here that fails safe — empty
!= 'true', sofull-gate-buildalways runs — but it would havedisabled the docs-only exemption fleet-wide with nothing going red. A bug whose only symptom is "the
optimisation quietly stopped working" is one nobody reports.
What callers see
Nothing changes for them. The
workflow_calloutput keeps its name, its description, and itsconservative contract: any value other than the literal
'true'means not-docs-only. Callers pin bySHA, so this reaches a repo only when it bumps.
The resulting job graph:
Refs thumos#775.