Skip to content

fix(cli): require --repo-name for Pacman packages in subdirectories - #101

Merged
bketelsen merged 1 commit into
mainfrom
lucilla/pacman-repo-name-skip-gap
Nov 13, 2026
Merged

bketelsen merged 1 commit into
mainfrom
lucilla/pacman-repo-name-skip-gap

Conversation

@frostyard-machines

Copy link
Copy Markdown

Summary

Fixes #96
Fixes #99

#96. validateConfig required --repo-name only when filepath.Glob(inputDir/*.pkg.tar.*) matched, so it saw only the input root. Generation scans the input recursively, so a Pacman package in a subdirectory was published under a fallback database name (--origin, else custom). That contradicts docs/specs/generators.md ("--repo-name is required for Pacman repositories"). Now validateConfig runs the recursive scanner one time (scannedPackageTypes) and uses the result for both the Debian --codename check and the Pacman --repo-name check. The old code ran this scan already for the Debian check, so the change adds no scan.

#99. ADR-0018 says that the known gap (a content change without a version or revision bump keeps its identity and is not republished) is stated in the flag help, the action input description and README.md. The action input already stated it. This PR adds it to the --skip-published-identities help, to README.md and to the help listing in docs/guides/usage.md.

Tests (new file internal/cli/generate_reponame_test.go):

  • TestGeneratePacmanRequiresRepoName: a Pacman package in the input root, in sub/ and in a/b/ is refused without --repo-name, and no output directory is written. The subdirectory and nested subdirectory cases fail on main (error = <nil>).
  • TestGenerateSkipPublishedIdentitiesHelpStatesKnownGap pins the gap in the flag help. It fails on main.

Checks

  • make check: formats, then runs the verify gate (tidy, vet, gofmt, lint at the mise pin, docs integrity, unit tests). Green locally.
  • make ci: no Docker on the authoring host, so CI runs it.
  • Generator/scanner/signer changes: no generator, scanner or signer code changes.

Risk tier

  • Tier 1: Low
  • Tier 2: Moderate
  • Tier 3: High
  • Tier 4: Critical

Rationale: matched risk path: internal/cli/generate.go (L1, "update verification: the digest-conflict gate and the signature-verified skip of published sysexts"). Why the change is safe:

  • The digest-conflict gate and the signature-verified skip do not change. The only code changes in the file are the help string of --skip-published-identities and the input-type detection in validateConfig.
  • The Debian --codename check uses the same recursive scan as before, with the same error type, error message and order. Only the helper's name and return type change.
  • The Pacman check gets stricter: it now refuses a configuration that main accepted silently. It cannot accept a configuration that main refused, except a file whose name contains .pkg.tar. but that the scanner does not detect as Pacman. Generation does not publish such a file as a Pacman package, so the check now matches what generation publishes.

Docs housekeeping

  • No new docs. docs/specs/generators.md now says that the recursive scan decides when --repo-name is required. README.md stays at 440 words (the limit is 1000).

Verification

  • node scripts/check-docs.mjs green (in make check)
  • docs/specs/generators.md updated with the code

The --repo-name check globbed only the input root, while generation scans
the input recursively, so a Pacman package in a subdirectory was published
under a fallback database name. Validation now runs the recursive scanner
once and uses the result for the Debian --codename check and the Pacman
--repo-name check.

State the ADR-0018 known gap (a content change without a version or
revision bump is not republished) in the --skip-published-identities help
and in README.md, as the ADR requires.

Fixes #96
Fixes #99
@github-actions github-actions Bot added level:L1 Read every line risk:high Touches a high-risk path (ADR-0068) labels Nov 13, 2026
@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/cli/generate.go 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@frostyard-machines

Copy link
Copy Markdown
Author

Cross-review: Ready

  • Reviewer: openai/gpt-6.1-sol (read-only, 1 pass). Coder: deepseek/deepseek-flash.
  • Reviewed base 05a5bcb17db20f73e44a38d013634f942fa044f1, head 40851eee5f958f98d1c5b0af78837135091731d8 (the current head). All 5 changed paths reviewed; internal/cli/generate.go (risk path, L1) read first.
  • Findings: none. Blocking: none.
  • Reviewer notes: validation and generation now use the same FileSystemScanner.Scan, so hidden directories, file symlinks and undetected files are treated the same in both. No new scan: the existing Debian scan is shared. runGeneration (the digest-conflict gate and the signature-verified skip) is unchanged. The Debian check keeps its error type, messages and order.

Revert test

In a scratch worktree at 40851ee, with only internal/cli/generate.go reverted to 05a5bcb (tests kept):

go test ./internal/cli/ -run 'TestGeneratePacmanRequiresRepoName|TestGenerateSkipPublishedIdentitiesHelpStatesKnownGap'
--- FAIL: TestGeneratePacmanRequiresRepoName/subdirectory
    generate_reponame_test.go:51: error = <nil>, want --repo-name is required for Pacman
--- FAIL: TestGeneratePacmanRequiresRepoName/nested_subdirectory
    generate_reponame_test.go:51: error = <nil>, want --repo-name is required for Pacman
--- FAIL: TestGenerateSkipPublishedIdentitiesHelpStatesKnownGap
    generate_reponame_test.go:69: --skip-published-identities help lacks "Known gap"

At the head the same tests pass, and make build and make check pass. CI (make ci, pr-triage, codecov/patch) is green at 40851ee.

@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 13, 2026
@bketelsen
bketelsen added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit d9a20d4 Nov 13, 2026
4 checks passed
@bketelsen
bketelsen deleted the lucilla/pacman-repo-name-skip-gap branch November 13, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L1 Read every line ready-for-human Reviewed, CI green: ready for Brian to review and merge risk:high Touches a high-risk path (ADR-0068)

Projects

None yet

2 participants