Skip to content

feat(lib-version): let a repository declare it has no Lerian dependency - #837

Merged
bedatty merged 3 commits into
developfrom
feat/lib-version-check-allow-no-lerian-deps
Sep 24, 2026
Merged

bedatty merged 3 commits into
developfrom
feat/lib-version-check-allow-no-lerian-deps

Conversation

@bedatty

@bedatty bedatty commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Description

lerian-lib-version fails a repository whose go.mod declares no github.com/LerianStudio/* dependency:

::error title=No Lerian libraries found::No github.com/LerianStudio/* dependencies in go.mod.
Every Lerian Go service must use at least one Lerian library.

That is the right rule for a service. It is a false positive for a repository that legitimately has none — a library whose public API is standard-library only, a template, a generator.

Today such a repository has exactly one way out: run_lib_version_check: false on the Go umbrella. That does not just skip the zero-dependency verdict, it switches off the outdated-version guard the check exists for — and switches it off permanently, including after the repository grows its first Lerian dependency, which is precisely when the guard starts being useful.

This adds require_lerian_libs (composite input require-lerian-libs), default true, so nothing changes for any current caller. Set to false, the absence is reported as a warning and the check exits clean.

Deliberately narrow, matching the wording already in the file for outdated_non_blocking: it softens only that verdict. A missing or unreadable go.mod, an outdated dependency and every infrastructure error keep failing, so a repository that opts out cannot turn a broken pipeline into a pass.

On the default. I kept it at true rather than inverting it. Flipping it would silently drop the standards gate for every Go service on the channel, and that is a policy call for this repo's owners, not a side effect of a bug fix. If you would rather have false as the default, it is a one-line change on top of this PR and I am happy to make it.

Where it came from

lib-boilerplate, the template new Lerian Go libraries are created from (LerianStudio/lib-boilerplate#13). Its placeholder API depends on the standard library only — on purpose, since the template must compile before anyone writes real code — so the umbrella failed on it and the template had to disable the whole check. With this input, the template (and every library generated from it) passes lib_version_require_lerian_libs: false and keeps the version guard live for the day it takes its first Lerian dependency.

Changes

File Change
src/validate/lerian-lib-version/action.yml New require-lerian-libs input (default "true"); the zero-dependency branch reports a warning and exits 0 when it is not true. The failing branch's report now names the input as the supported way out.
.github/workflows/lerian-lib-version-check.yml New require_lerian_libs input (boolean, default true), forwarded to the composite; header comment updated.
.github/workflows/go-pr-validation.yml New lib_version_require_lerian_libs input (boolean, default true), forwarded to the check.
docs/lerian-lib-version-check.md, docs/go-pr-validation.md Input tables, plus three rows in the outcome table covering the new paths.

Testing

  • actionlint on both workflow files — clean.
  • YAML parses for the two workflows and the composite; defaults verified programmatically as true / true / "true" (no behavior change without opting in).
  • The composite's check script extracted and run through bash -n and shellcheck -S error — clean.
  • The zero-dependency branch exercised against a go.mod with no Lerian requires: REQUIRE_LERIAN_LIBS=true → ::error + exit 1 (today's behavior, unchanged); REQUIRE_LERIAN_LIBS=false → ::warning + exit 0.

I did not run the workflow end-to-end from a caller — that needs a branch pin from a test repo, which I can do if you want it exercised before merge.

Breaking Changes

None. Every input defaults to the current behavior.

The zero-dependency verdict assumes the caller is a service, where depending on
at least one Lerian library is a company-standards rule. It is a false positive
for a repository that legitimately has none: a library whose public API is
standard-library only, a template, a generator. Those had one way out —
run_lib_version_check: false on the umbrella — which also switched off the
outdated-version guard the check exists for, and switched it off permanently,
including after the repository grows its first Lerian dependency.

Adds require_lerian_libs (composite: require-lerian-libs), default true, so
nothing changes for anyone who does not set it. When false, "no Lerian
libraries" is reported as a warning and the check exits clean instead of
failing.

Deliberately narrow, matching outdated_non_blocking: it softens only that one
verdict. A missing or unreadable go.mod, an outdated dependency and every
infrastructure error keep failing, so a repository that opts out cannot turn a
broken pipeline into a pass.

Found on lib-boilerplate, the Go library template: its example depends on the
standard library only, so the umbrella failed with "No github.com/LerianStudio/*
dependencies in go.mod" and the template had to disable the whole check.
@bedatty
bedatty requested a review from a team as a code owner September 24, 2026 19:13
@lerian-studio lerian-studio added the size/S PR changes 50–199 lines label Sep 24, 2026
@lerian-studio

lerian-studio commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🛡️ CodeQL Analysis Results

Languages analyzed: actions

✅ No security issues found.


🔍 View full scan logs | 🛡️ Security tab

@lerian-studio lerian-studio added documentation Improvements or additions to documentation workflow Changes to one or more reusable workflow files golang Changes to Go-related workflows validate Changes to PR validation composite actions (src/validate/) composite Changes to any composite action manifest (src/**/*.yml) labels Sep 24, 2026
@lerian-studio

lerian-studio commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🔍 Lint Analysis

Check Files Scanned Status
YAML Lint 3 file(s) ✅ success
Action Lint 2 file(s) ✅ success
Pinned Actions 3 file(s) ✅ success
Markdown Link Check 2 file(s) ✅ success
Spelling Check 6 file(s) ✅ success
Shell Check 3 file(s) ✅ success
README Check 3 file(s) ✅ success
Composite Schema 1 file(s) ✅ success
Deployment Matrix no changes ⏭️ skipped

🔍 View full scan logs

@lerian-studio

lerian-studio commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🔍 PR Validation Summary

✅ PR Mergeable — no blocking failures

Check Status Blocking
Source Branch ✅ success yes
PR Title ✅ success yes
PR Description ✅ success yes
Breaking Change Guard ✅ success yes
Commit Signatures ✅ success yes
PR Size ✅ success no
Auto Labels ✅ success no
PR Metadata ✅ success no

🔍 View workflow run

@lerian-studio

This comment has been minimized.

@lerian-studio lerian-studio added the review-ready Required checks passed — CodeRabbit is cleared to review label Sep 24, 2026
@coderabbitai

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: LerianStudio/github-actions-shared-workflows/.coderabbit.yml

Review profile: ASSERTIVE

Plan: Essentials

Run ID: a324bcfc-410b-4239-96b9-5287d0aa8a95

📥 Commits

Reviewing files that changed from the base of the PR and between 543a9a3 and db15a70.

📒 Files selected for processing (4)
  • .github/workflows/lerian-lib-version-check.yml
  • docs/lerian-lib-version-check.md
  • src/validate/lerian-lib-version/action.yml
  • src/validate/lerian-lib-version/test.py

Limit details: You’ve used the included review currently available. Your 97 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


Walkthrough

The library version check adds a setting that controls whether no direct Lerian dependencies cause failure. The setting defaults to true and passes from the Go PR workflow through the reusable workflow to the validation action. Missing or unreadable go.mod, outdated dependencies, and infrastructure errors remain blocking.

Changes

Lerian dependency requirement

Layer / File(s) Summary
Action input and no-dependency result
src/validate/lerian-lib-version/action.yml, docs/lerian-lib-version-check.md
The action adds require-lerian-libs, defaulting to true. When it is disabled and no Lerian dependency is found, the action writes a non-enforcing report, emits a warning, and exits successfully. The documentation describes the input and result.
Reusable workflow input and action wiring
.github/workflows/lerian-lib-version-check.yml, docs/lerian-lib-version-check.md
The reusable workflow adds require_lerian_libs and passes its value to the action. The documentation describes the input and failure outcomes.
Go PR workflow input and forwarding
.github/workflows/go-pr-validation.yml, docs/go-pr-validation.md
The Go PR workflow adds lib_version_require_lerian_libs and forwards it to the reusable workflow. The documentation lists the input.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: gandalf-at-lerian

Merge Risk: 🔵 Low · up to db15a

The opt-out may not work when testing a branch-channel workflow before the matching action is released at @v1. Stable use can proceed after that release; account for this timing when validating the change.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 1 files. (3 skipped: 3… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: allowing repositories to declare that they have no Lerian dependency.
Description check ✅ Passed The description explains the motivation, behavior, affected files, testing, and breaking-change status. It omits the template's Type of Change checklist and Related Issues section, but the required ch…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 1 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.


Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]

This comment was marked as resolved.

…e opt-out

The `Lerian Lib Version Advisory Tests` check was failing on this branch. The
new REQUIRE_LERIAN_LIBS expansion runs under `set -euo pipefail`, and the test
harness did not define it, so the script aborted at the first expansion and
every verdict test read as a pass of the wrong kind. The harness now mirrors
the action's declared default, which is what it does for every other input.

The opt-out was `!= "true"`, so any unrecognised value waived the rule —
`require-lerian-libs: tru` from a direct composite caller silently turned a
compliance check off. Only the literal "false" opts out now, and a value that
is neither emits a warning, so the typo is visible instead of enforcing a rule
the caller believed it had disabled. The reusable workflow coerces a boolean
and can only ever send "true" or "false", so this only affects direct callers.

Seven tests cover the input, including the typo and empty-value paths and the
three verdicts the exception must not widen to.

Also corrected an overstated guarantee, in all four places it was written: the
new text claimed every infrastructure error keeps failing, but an unresolvable
releases API has always reported ⚠️ Unknown and passed. The failure-modes table
additionally still carried an unqualified "App has no Lerian libs → Fail" row
that the three new rows below it contradicted, plus two claims that a go.mod
with no Lerian libraries always fails, which is now `require_lerian_libs`'s
call rather than `outdated_non_blocking`'s.
The previous fixture spelled the invalid value "tru", which the Spelling Check
job flagged — correctly, since it cannot tell a deliberate fixture from a real
misspelling. Replaced with two values that are likelier to reach the action for
real: "FALSE", where only the case is wrong, and a bare "no", which YAML 1.1
reads as a boolean but which arrives at an action input spelled as written.
Better coverage than the invented typo it replaces.
@lerian-studio

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@bedatty
bedatty merged commit 1d6a2e8 into develop Sep 24, 2026
35 checks passed
@github-actions
github-actions Bot deleted the feat/lib-version-check-allow-no-lerian-deps branch September 24, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

composite Changes to any composite action manifest (src/**/*.yml) documentation Improvements or additions to documentation golang Changes to Go-related workflows review-ready Required checks passed — CodeRabbit is cleared to review size/S PR changes 50–199 lines validate Changes to PR validation composite actions (src/validate/) workflow Changes to one or more reusable workflow files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants