Skip to content

fix(rpm-repos): address PR review feedback and lint failures#1

Merged
reubeno merged 2 commits into
feat/toml-driven-rpm-reposfrom
copilot/fix-pr-checks-and-feedback
May 5, 2026
Merged

fix(rpm-repos): address PR review feedback and lint failures#1
reubeno merged 2 commits into
feat/toml-driven-rpm-reposfrom
copilot/fix-pr-checks-and-feedback

Conversation

Copilot AI commented May 5, 2026

Copy link
Copy Markdown

Resolves Copilot review feedback on PR microsoft#156 and the failing Lint and Scenario tests checks (the latter caused by an out-of-date checked-in JSON schema snapshot).

Behavior changes

  • validateRemoteURI: rejects opaque URIs (e.g. https:example.com) and requires a non-empty Host.
  • validateGPGKey: same opaque rejection; http(s) requires Host, file:// requires empty Host + absolute Path (i.e. real file:///abs/path form).
  • addConfiguredImageBuildRepos: no-op (info log) when inputs.image-build is unconfigured, instead of hard-failing. The .kiwi description and --repo flags continue to supply repos for those projects. The "all entries filtered out by arches" path is unchanged.

Schema

  • RpmRepoResource.JSONSchemaExtend now mirrors the runtime constraints: oneOf(base-uri, metalink) and a tightened gpg-key pattern (^((https?|file)://\S+|[^\s:]\S*)$).
  • Escaped commas in the gpg-key description struct tag — without this, the jsonschema reflector truncates the description at the first comma, which is why the previous schema only listed http.
  • Regenerated schemas/azldev.schema.json (this is what was making TestCheckedInSchemasAreUpToDate fail).

Lint

  • Renamed prepare_test.go and resources_test.go to *_internal_test.go (they exercise unexported symbols; the suffix is the repo's existing escape hatch from testpackage).
  • //nolint:recvcheck on ResourcesConfig and RpmRepoResourceJSONSchemaExtend must be a value receiver because invopop/jsonschema only invokes value-receiver methods via t.Implements.
  • Split validateRpmRepo into validateRpmRepoSource / validateRpmRepoGPG to drop cyclomatic complexity below 15 and remove the single-case switch.
  • Extracted siteDefaultsPerm = 0o644 and schemeHTTP/HTTPS/File constants; renamed short variables; applied staticcheck QF1001/QF1002; reworded ST1005 errors; assert.Empty over assert.Equal(t, "", …).

Tests

  • Added TestValidateRpmRepo cases for the new URI shape rules: opaque base-uri/metalink/gpg-key, missing host on https:///path, and file://server/share/....

@reubeno reubeno marked this pull request as ready for review May 5, 2026 21:45
@reubeno reubeno merged commit 0e3f0ab into feat/toml-driven-rpm-repos May 5, 2026
1 check passed
@reubeno reubeno deleted the copilot/fix-pr-checks-and-feedback branch May 5, 2026 21:46
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