Skip to content

feat: Add support for lockless components - #430

Open
Dan Streetman (ddstreet) wants to merge 30 commits into
microsoft:mainfrom
ddstreet:lockless-rendering
Open

Dan Streetman (ddstreet) wants to merge 30 commits into
microsoft:mainfrom
ddstreet:lockless-rendering

Conversation

@ddstreet

Copy link
Copy Markdown
Contributor

This adds support for lockless rendering, in a controlled per-component transition.

During the transition, the tool will look for a file named lockless-components.txt in the same dir as the azldev.toml file (i.e., the top dir of the repo). If a component name is found inside this file, the component is considered a 'lockless' component; otherwise, the component is a legacy 'locked' component. Since our repo currently has an empty lockless-components.txt file, all our components are currently considered 'locked', and none of these updates to azldev should have any effect at all on any 'locked' component.

Until all components have been transitioned over, this adds a new command azldev comp make-lockless, which adds the specified component name(s) to the lockless-components.txt file, and runs azldev comp refresh-upstream-commit for them, to generate the component's default upstream-commit toml file. After that, the component's 'lock' file will no longer be used for anything (unless the component is removed from the lockless-components.txt file).

After transitioning all components to lockless, we should remove support for 'locked' files from azldev, and remove the azldev comp make-lockless command; and then we can remove the lockless-components.txt file from our main repo.

Most operations are the same for lockless components, but notably:

  • render operations should now work correctly, and should update the release value and generate the changelog entry correctly.
  • render operations are now slightly different, instead of backwards-searching the git commits to try to find text for a changelog entry, azldev will now prompt the user to provide a changelog entry or autorelease git commit message. This may be avoided by providing the message using the new --changelog-comment parameter.
  • render operations now will git commit the rendered files, unless the --no-git-commit parameter is used.
  • render operations now require no uncommitted changes in the repo (although uncommitted changes in the specs/ dir other than the rendering component's dist-git dir are ignored). this can be forced with --allow-uncommitted
  • renders no longer use mock for anything.
  • renders for autorelease components do not pre-rpmautospec the rendered dist-git dir.
  • there is a new command azldev comp dist-git-repo which converts the committed dist-git dir for a component into an industry-standard dist-git repo (at the path specified to --output-dir).

Besides those listed above, I have probably forgot some other changes.

Note this is still undergoing copilot testing, and there may be additional changes required; but this should not impact any components that still use 'lock' files, so we can slowly migrate components to lockless one-at-a-time and address any transition issues as we find them.

Copilot AI balanced review requested due to automatic review settings November 8, 2026 01:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Skipped local components can still have generated TOML files deleted or flagged as stale, and shared single-branch cloning can break locked renders/builds using valid commits pinned on other branches.

2 open issues
What changed in this PR

This PR introduces per-component lockless workflows through lockless-components.txt, allowing gradual migration alongside legacy lock-based operations.

Changes:

  • Add mode-aware configuration, validation, and the make-lockless migration command.
  • Support host-based rendering, release/changelog updates, and committed dist-git preparation, querying, building, and extraction.
  • Update regression tests, agent guidance, and CLI documentation; parallelize Mage validation.

This pull request requires changes. The following issues remain unresolved:

  • Critical — internal/app/azldev/cmds/component/refreshupstreamcommit.go:173: The orphan pass can delete generated TOML files for configured locked local components, or report them as stale under --check-only. Exempt configured locked components while preserving cleanup for genuinely removed components.
  • Moderate — internal/app/azldev/cmds/component/query_lockless.go:62: Querying all components serially clones and rewrites the full project history for each lockless component. Reuse shared repository objects or bulk extraction while retaining separate rpmautospec repositories.
  • Moderate — internal/app/azldev/cmds/component/render_release_carryover.go:39: An autorelease-to-static transition can restore the old %autorelease macro and skip the required static bump. Resolve the previous release to a concrete baseline instead.
  • Moderate — internal/utils/git/git.go:211: Shared single-branch cloning breaks locked workflows pinned to commits unavailable on the selected branch or through tags. Make this behavior opt-in or fetch the pinned commit before checkout.
File Description
schemas/​azldev.schema.json Clarify filtering behavior by lock mode.
pkg/​app/​azldev_cli/​azldev.go Update command-registration comments.
magefiles/​mageutil/​mageutil.go Resolve tools without changing process directory.
magefiles/​magefile.go Parallelize post-build validation.
internal/​utils/​git/​git.go Add single-branch cloning behavior.
internal/​utils/​git/​git_test.go Verify branch-clone arguments with mocks.
internal/​utils/​dirdiff/​types.go Add ignored-path options.
internal/​utils/​dirdiff/​dirdiff.go Apply exclusions during directory traversal.
internal/​utils/​dirdiff/​dirdiff_test.go Cover exclusions and unreadable entries.
internal/​upstreamcommit/​store.go Omit empty generated TOML headers.
internal/​upstreamcommit/​store_test.go Cover compact TOML and quoted names.
internal/​rpm/​spec/​structural_edit.go Preserve Release-tag formatting.
internal/​rpm/​spec/​legacy_edit.go Preserve Release-tag formatting.
internal/​rpm/​spec/​editor.go Share formatting-preserving tag replacement.
internal/​rpm/​spec/​edit_test.go Cover Release formatting across editors.
internal/​rpm/​mock/​mock.go Support and check the rpmautospec plugin.
internal/​rpm/​mock/​mock_test.go Cover plugin enablement and absence.
internal/​providers/​sourceproviders/​sourcemanager.go Forward local-config exclusion options.
internal/​providers/​sourceproviders/​sourcemanager_test.go Cover local-config exclusion.
internal/​providers/​sourceproviders/​localcontentsprovider.go Exclude TOML defining local spec paths.
internal/​providers/​sourceproviders/​localcontentsprovider_test.go Cover defining versus unrelated TOML files.
internal/​projectconfig/​render.go Clarify mode-specific file filtering.
internal/​projectconfig/​project.go Track and validate lockless components.
internal/​projectconfig/​lockmodes.go Read project component selections.
internal/​projectconfig/​loader.go Select merge semantics per component.
internal/​projectconfig/​configfile.go Defer partial lockless component validation.
internal/​projectconfig/​config.go Load selections and retain lock-directory configuration.
internal/​projectconfig/​config_test.go Cover mixed-mode loading and validation.
internal/​lockfile/​store.go Accept consistency-check exemptions.
internal/​lockfile/​show.go Skip ignored historical locks.
internal/​lockfile/​show_test.go Cover ignored corrupt historical locks.
internal/​lockfile/​lockfile.go Exempt lockless components from consistency checks.
internal/​lockfile/​lockfile_test.go Cover exemptions and orphan detection.
internal/​app/​azldev/​env.go Expose per-component lock-mode selection.
internal/​app/​azldev/​env_test.go Cover component selections and internal overrides.
internal/​app/​azldev/​core/​testutils/​testenv.go Update internal-mode comments.
internal/​app/​azldev/​core/​sources/​upstream_provenance.go Export resolver interface and reuse supplied provenance.
internal/​app/​azldev/​core/​sources/​sourceprep_test.go Cover acquisition ordering and overlay effects.
internal/​app/​azldev/​core/​sources/​render_process.py Allow processing without spectool.
internal/​app/​azldev/​core/​sources/​mockprocessor.go Carry spectool-skip settings into JSON.
internal/​app/​azldev/​core/​sources/​bumpspec.go Export RPM-wrapper generation.
internal/​app/​azldev/​core/​components/​resolver.go Skip lock population and validation for lockless components.
internal/​app/​azldev/​core/​componentbuilder/​componentbuilder.go Build directly from prepared dist-git repositories.
internal/​app/​azldev/​core/​componentbuilder/​componentbuilder_test.go Cover dist-git build options and preparation bypass.
internal/​app/​azldev/​cmds/​docs/​agent.go Serve mixed-workflow agent guidance.
internal/​app/​azldev/​cmds/​component/​update.go Restrict lock updates to locked components.
internal/​app/​azldev/​cmds/​component/​update_test.go Cover skipped components and preserved locks.
internal/​app/​azldev/​cmds/​component/​render_test.go Cover new render flags and dirty-worktree handling.
internal/​app/​azldev/​cmds/​component/​render_release_carryover.go Carry committed release state and baserelease definitions.
internal/​app/​azldev/​cmds/​component/​render_host.go Run host RPM tools and route locked mock processing.
internal/​app/​azldev/​cmds/​component/​refreshupstreamcommit.go Filter refresh work to lockless components.
internal/​app/​azldev/​cmds/​component/​refreshupstreamcommit_test.go Cover per-component refresh selection.
internal/​app/​azldev/​cmds/​component/​query.go Combine locked and lockless query workflows.
internal/​app/​azldev/​cmds/​component/​query_lockless.go Extract and process committed dist-git specs.
internal/​app/​azldev/​cmds/​component/​preparesources.go Dispatch preparation by component mode.
internal/​app/​azldev/​cmds/​component/​preparesources_test.go Adapt option-validation coverage.
internal/​app/​azldev/​cmds/​component/​preparerctx.go Select preparation context per component.
internal/​app/​azldev/​cmds/​component/​mockprocessor.go Require mock only for locked rendering.
internal/​app/​azldev/​cmds/​component/​mockproc.go Clarify locked-render dependency comments.
internal/​app/​azldev/​cmds/​component/​makelockless.go Add migration selection and pin refresh.
internal/​app/​azldev/​cmds/​component/​lockmodes.go Filter component sets by lock mode.
internal/​app/​azldev/​cmds/​component/​list.go Remove mode-dependent command construction.
internal/​app/​azldev/​cmds/​component/​legacy.go Remove obsolete no-op command wrappers.
internal/​app/​azldev/​cmds/​component/​legacy_internal_test.go Remove no-op command tests.
internal/​app/​azldev/​cmds/​component/​history.go Skip lockless components in legacy history reports.
internal/​app/​azldev/​cmds/​component/​diffsources.go Remove mode-dependent command construction.
internal/​app/​azldev/​cmds/​component/​component.go Register both workflows and new commands.
internal/​app/​azldev/​cmds/​component/​component_test.go Cover shared registration and history selection.
internal/​app/​azldev/​cmds/​component/​cmdoptions.go Simplify component flag registration.
internal/​app/​azldev/​cmds/​component/​changed_upstreamcommit.go Scope historical input comparisons to lockless components.
internal/​app/​azldev/​cmds/​component/​changed_upstreamcommit_internal_test.go Cover skipped locked comparison inputs.
internal/​app/​azldev/​cmds/​component/​changed_test.go Update mixed-mode help assertions.
internal/​app/​azldev/​cmds/​component/​build.go Dispatch lockless builds to committed dist-git.
internal/​app/​azldev/​cmds/​component/​build_lockless.go Extract dist-git, download sources, and build.
internal/​app/​azldev/​cmds/​component/​build_lockless_internal_test.go Cover lockless builds, rejected flags, and cleanup.
internal/​app/​azldev/​app.go Remove the global lockless CLI selector.
internal/​app/​azldev/​app_test.go Cover removed-flag rejection and pre-parsing.
internal/​app/​azldev/​agentskill/​doc.go Describe mixed-workflow catalogs.
internal/​app/​azldev/​agentskill/​content/​withoutlockfile/​refresh-upstream-commit.md.tmpl Remove the mode-specific refresh template.
internal/​app/​azldev/​agentskill/​content/​withoutlockfile/​comp-toml.md.tmpl Update lockless render and configuration guidance.
internal/​app/​azldev/​agentskill/​content/​withoutlockfile/​build-component.md.tmpl Document committed dist-git workflows.
internal/​app/​azldev/​agentskill/​content/​update-component.md.tmpl Limit update guidance to locked components.
internal/​app/​azldev/​agentskill/​content/​remove-component.md.tmpl Correct query workflow guidance.
internal/​app/​azldev/​agentskill/​content/​comp-toml.md.tmpl Document mixed-mode configuration and rendering.
internal/​app/​azldev/​agentskill/​content/​build-component.md.tmpl Document lockless preparation and builds.
internal/​app/​azldev/​agentskill/​agentskill.go Include refresh guidance in the default catalog.
docs/​user/​reference/​config/​config-file.md Document per-component include ordering.
docs/​user/​reference/​cli/​azldev.md Remove obsolete global flag documentation.
docs/​user/​reference/​cli/​azldev_version.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_repo.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_repo_query.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_repo_compare.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_project.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_project_new.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_project_init.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_package.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_package_list.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_image.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_image_test.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_image_list.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_image_inject-files.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_image_customize.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_image_build.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_image_boot.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_docs.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_docs_markdown.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_docs_agent.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_docs_agent_show.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_docs_agent_install.md Document mixed-workflow agent output.
docs/​user/​reference/​cli/​azldev_config.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_config_generate-schema.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_config_dump.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_component.md List migration, refresh, and dist-git commands.
docs/​user/​reference/​cli/​azldev_component_update.md Document lockless update exclusions.
docs/​user/​reference/​cli/​azldev_component_test.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_component_render.md Document lockless rendering and new flags.
docs/​user/​reference/​cli/​azldev_component_refresh-upstream-commit.md Add refresh command reference.
docs/​user/​reference/​cli/​azldev_component_query.md Document committed lockless query inputs.
docs/​user/​reference/​cli/​azldev_component_prepare-sources.md Document lockless preparation behavior.
docs/​user/​reference/​cli/​azldev_component_metadata.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_component_make-lockless.md Add migration command reference.
docs/​user/​reference/​cli/​azldev_component_list.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_component_history.md Document lockless history exclusions.
docs/​user/​reference/​cli/​azldev_component_dist-git-repo.md Add dist-git extraction command reference.
docs/​user/​reference/​cli/​azldev_component_diff-sources.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_component_changed.md Document per-component comparison selection.
docs/​user/​reference/​cli/​azldev_component_build.md Document lockless build requirements.
docs/​user/​reference/​cli/​azldev_component_add.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_completion.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_completion_zsh.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_completion_powershell.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_completion_fish.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_completion_bash.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_advanced.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_advanced_wget.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_advanced_mock.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_advanced_mock_shell.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_advanced_mock_build-rpms.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_advanced_mcp.md Remove obsolete inherited flag documentation.
docs/​user/​reference/​cli/​azldev_advanced_download-sources.md Remove obsolete inherited flag documentation.
docs/​user/​README.md Link extraction and per-component migration guides.
docs/​user/​how-to/​extract-dist-git-repo.md Explain committed history extraction and safety.
docs/​user/​how-to/​build-component.md Add lockless build workflow requirements.
docs/​user/​explanation/​config-system.md Explain per-component merge semantics.
docs/​developer/​reference/​build.md Document parallel Mage validation.
.github/​instructions/​agent-skills.instructions.md Update catalog maintenance guidance.

Review effort: Balanced

Comment thread internal/utils/git/git.go Resolved
@ddstreet

Copy link
Copy Markdown
Contributor Author

i'll get my copilot to investigate the above issues that copilot found

@ddstreet

Copy link
Copy Markdown
Contributor Author

I also have a azurelinux repo branch I'm using for testing here: https://github.com/ddstreet/azurelinux/commits/lockless-testing/

Copilot AI balanced review requested due to automatic review settings November 8, 2026 03:03
@ddstreet

Copy link
Copy Markdown
Contributor Author

i'll get my copilot to investigate the above issues that copilot found

pushed 4 new commits to address the issues copilot found above.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The lockless preparation path can delete an existing output directory during a forced dry run because cleanup occurs before the dry-run check.

1 open issue
2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 8, 2026 03:34
@ddstreet

Copy link
Copy Markdown
Contributor Author

added commit to address last round of feedback

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Lockless builds reintroduce explicitly undefined macros, and source preparation can fail when a pinned upstream commit exists only on another branch.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Apply undefine semantics to lockless mock options

internal/​app/​azldev/​cmds/​component/​build_lockless.go:62

Lockless builds pass the raw With, Without, and Defines values to mock without applying Build.Undefines. For example, an inherited defines.dist = ".azl3" with undefines = ["dist"] is correctly omitted from the rendered macros file, but this path reintroduces it through --define dist .azl3 in both SRPM and RPM builds. Filter the options using the same undefine semantics as buildMacrosMap before forwarding them, so transitioning a component does not change its effective build macros.

Medium severity Fetch pinned commits missing from the single-branch clone

internal/​providers/​sourceproviders/​fedorasourceprovider.go:133

Lockless source preparation fails when an explicit upstream pin is reachable only from another branch and is not fetched through a tag. The single-branch clone omits that commit, and checkoutTargetCommit never fetches it before checkout. Keep a multi-branch clone when effectiveCommit is set, or explicitly fetch the pinned commit.

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 8, 2026 03:44
@ddstreet

Copy link
Copy Markdown
Contributor Author

added 4 more commits based on copilot investigation

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Critical findings omitted from the published review involve incorrect macro resolution and source retrieval and pinned-commit checkout failures, requiring human assessment.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 8, 2026 05:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Unpublished findings identify a critical regression in cross-branch commit pinning and failures on ignored unreadable directories, warranting human assessment.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 8, 2026 06:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed to evaluate unpublished findings concerning cross-branch pinned-commit checkout failures and lost error diagnostics when the mock probe fails.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 8, 2026 06:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because unpublished findings identify pinned-commit checkout failures and ignored macro undefines that can disrupt source preparation and builds.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 8, 2026 16:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because lockless builds forward raw options that can reinstate macros excluded by build.undefines, causing build settings to diverge from the rendered spec.

No open issues 🎉

Review effort: Balanced

@ddstreet

Copy link
Copy Markdown
Contributor Author

Copilot can you check all your previous reviews and comments, and give a summary of anything you still see as needing action?

The emitted agent skills and instructions now describe both workflows
in one catalog:
- locked components use lock files and 'comp update';
- components listed in 'lockless-components.txt' use generated
  upstream-commit TOMLs and 'comp refresh-upstream-commit'.

The default catalog adds the refresh-upstream-commit skill, and the
azldev, build-component, comp-toml, remove-component and
update-component content covers selecting lock modes, 'make-lockless',
lockless render, build and query, and 'dist-git-repo'.

'NewCatalog(true)' keeps the all-lockless variant for internal use. The
contributor instructions no longer refer to the removed global flag.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16503351-1bf3-4693-96f1-26283e4fc641
@ddstreet

Copy link
Copy Markdown
Contributor Author

Could we also update withoutlockfile/overlays.md.tmpl and withoutlockfile/add-component.md.tmpl to match the new lockless workflow? I ran into this while transitioning curl and figuring out when to commit its upstream pin and overlays. The updated guide and refresh skill say to commit pin changes before rendering, since render reads the pin from HEAD, and not to amend the input commit to absorb the automatic render commit. But these templates still describe the old render -> commit -> re-render -> amend flow, so an agent following them could get conflicting guidance.

And I found these two cases need a slightly different user operation:

  • pin changes need a commit before render, so it results in 2 commits.
  • overlay-only iteration can use --allow-uncommitted during render, and it ends up with one single commit.

can you try this again? the required-commit parts have been removed so this might no longer apply

Rewrite the lock-file-free preview guide around
'lockless-components.txt'. It covers:
- selecting components per mode and converting them with
  'comp make-lockless';
- refreshing upstream commits;
- rendering, including how the changelog message is chosen and how
  Release is carried over;
- preparing, querying and building from committed dist-git.

The config reference and explanation pages now describe:
- per-component merge semantics;
- 'skip-file-filter' applying only to locked components;
- single-branch upstream clones;
- provenance capture before release bumping.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16503351-1bf3-4693-96f1-26283e4fc641
Copilot AI balanced review requested due to automatic review settings November 24, 2026 21:53
@ddstreet

Dan Streetman (ddstreet) commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

force-pushed a completely reworked line of commits; copilot redid all of them to try to logically separate things better. the actual code diff is limited to single doc correction. PTAL.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The render workflow differs from the PR description in its input options, commit behavior, and worktree checks, leaving migration users with an unclear contract.

3 open issues

Review effort: Balanced

@liunan-ms

Copy link
Copy Markdown
Contributor

Looking at go-git compatibility with actual git, there is a lot that doesn't work with go-git...are we sure we should actually be using it instead of just calling git directly for operations?

For the code added/changed in this PR, we should be good to use native git to read committed files and build the historical snapshots. We already call git for the history queries, so it'd be more consistent to use it for the file reads too. Also it would avoid the loose-*.pack issue that I had.

Also checked other existing go-git usage, especially the older synthetic-history code and in-memory tests, might be better to keep them for now. That should be a separate change and need more care to preserve the generated history, and some of these logics need to be cleaned up after switching to lockless.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I think it looks good. I'm supportive of the changes, just the one comment I'd like to see resolved

continue
}

if errors.Is(result.renderErr, errNoRenderChanges) || errors.Is(result.renderErr, errRenderNEVRValidation) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a lockless render can’t infer changelog text, it leaves the old files in place and tells the caller to pass --commit-message. But that error doesn’t match either case here, so the command still exits 0 unless --fail-on-error is set. A CI job that checks only the exit code can then build stale output. Can we return a nonzero exit code for these changelog errors while keeping the existing behavior for locked components?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL at the latest push to see if it addresses this

Lockless 'comp render', 'comp prepare-sources' and 'comp changed' read
committed project trees through go-git. Read them with the system's git
program instead, through a new git.Repo/git.Tree reader in internal/utils/git
built on 'rev-parse', 'ls-tree' and 'cat-file'. Missing paths and paths of the
wrong object type report git.ErrPathNotFound, matching go-git's not-found
errors, so lookups that tolerate absent files behave as before.

This covers the last-render lookup, the committed changelog and render
snapshot, commit-message detection, and the historical project snapshots and
rendered-tree comparisons of lockless 'comp changed'. Locked components keep
their existing go-git code paths unchanged.

Lockless tests now commit their fixtures to an on-disk repository read by the
real git program; locked tests keep the in-memory go-git fixture.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16503351-1bf3-4693-96f1-26283e4fc641
Copilot AI balanced review requested due to automatic review settings November 24, 2026 23:02
@ddstreet

Copy link
Copy Markdown
Contributor Author

Looking at go-git compatibility with actual git, there is a lot that doesn't work with go-git...are we sure we should actually be using it instead of just calling git directly for operations?

For the code added/changed in this PR, we should be good to use native git to read committed files and build the historical snapshots. We already call git for the history queries, so it'd be more consistent to use it for the file reads too. Also it would avoid the loose-*.pack issue that I had.

Also checked other existing go-git usage, especially the older synthetic-history code and in-memory tests, might be better to keep them for now. That should be a separate change and need more care to preserve the generated history, and some of these logics need to be cleaned up after switching to lockless.

i had copilot add a commit to change all the 'lockless' operations over to use native git command directly, pushed as a new commit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The PR description contradicts the implemented render workflow by promising unavailable flags, prompting, automatic commits, and clean-tree enforcement, which could mislead migration users.

3 open issues

Review effort: Balanced

When a lockless render cannot detect its changelog text, because no
project commit since the last render changed the component or uncommitted
changes alter it, the component keeps its existing output and the error
asks for '--commit-message'. These errors only failed the command with
'--fail-on-error', so a CI job checking the exit status could carry on
with stale output.

Report them regardless of '--fail-on-error', like the existing no-change
and NEVR validation refusals. Both errors are lockless-only, so locked
component renders keep their exit status.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16503351-1bf3-4693-96f1-26283e4fc641
For lockless components, 'comp diff-sources' only preserved 'Release'
formatting, so the source preparer stayed in locked mode and showed build
macros as a generated macros file loaded through 'Source9999' and
'%{load:...}'. Lockless rendering instead prepends inline '%define' lines,
so the displayed spec edits differed from the rendered output.

Select the lockless preparer mode with WithoutLockfileHistory(). It also
preserves 'Release' formatting, and generates no synthetic history because
diff-sources creates no dist-git. Remove the now-unused
WithPreservedReleaseFormatting() preparer option. Locked components keep
their existing options.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16503351-1bf3-4693-96f1-26283e4fc641
A lockless build fetches configured source files from the working TOML, but
only checked that each payload in the committed 'sources' manifest existed.
If a source hash changed in the TOML before the component was rendered and
committed again, the new payload was accepted and the SRPM paired new source
bytes with the old committed packaging.

Validate every payload against its hash in the committed 'sources' manifest
before building, including payloads supplied by the configured origins, and
ask for a render and commit on mismatch. Locked builds do not use this path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16503351-1bf3-4693-96f1-26283e4fc641
The lockless add-component and overlays skills still described committing,
re-rendering, and amending the commit so %changelog and Release reflect it.
Rendering now reads working-tree inputs, never commits, and takes its
changelog text from project commits or --commit-message, so a single render
followed by a commit of the rendered output is enough.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16503351-1bf3-4693-96f1-26283e4fc641
Copilot AI balanced review requested due to automatic review settings November 25, 2026 00:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The PR description and implemented render workflow remain inconsistent about supported flags, automatic commits, and handling of uncommitted inputs.

1 open issue
2 resolved since last review

Review effort: Balanced

A lockless build downloaded every missing 'sources' payload from lookaside
using the committed manifest hash. Archives modified by archive overlays are
recorded with their post-overlay hash, which lookaside does not serve, so the
build failed with a 404 (for example stb's repacked tarball).

Fetch the pinned upstream component into a temporary directory, apply the
archive overlays there, and copy the repacked archives into the build's
dist-git checkout before the remaining lookaside downloads. The result is
still checked against the committed manifest. Export ApplyArchiveOverlays
for this; locked builds keep using the source preparer unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16503351-1bf3-4693-96f1-26283e4fc641
Lockless rendering compared the raw Version tag text with the committed
spec. Specs such as alsa-lib ('Version: %{version_alsa_lib}') or pipewire
keep the same tag text when the macro definitions change, so a real version
change was missed and the previous rendered Release was carried over.

When either tag uses macros, expand both with host rpmspec in their own spec
context (the committed spec in a snapshot of its dist-git tree) and compare
the expanded values. Literal Versions are still compared directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16503351-1bf3-4693-96f1-26283e4fc641
Copilot AI balanced review requested due to automatic review settings November 25, 2026 00:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The PR description advertises prompts, flags, and automatic commits that the implemented command does not support, leaving users with inaccurate migration instructions.

1 open issue

Review effort: Balanced

@liunan-ms Nan Liu (liunan-ms) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Dan! This PR looks good; a few docs need to be updated before approval (out of sync with the latest implementation):

  • The Check links job is failing because components.md:159 points to #render-and-commit-an-upstream-component. The heading is now “Render and Commit a Component,” so the fragment should be #render-and-commit-a-component.
  • Components reference: still mentions “automatic output commits,” but render no longer commits.
  • Refresh skill example: shows render-before-commit without --commit-message, which can fail for existing non-autorelease components with uncommitted inputs.
  • Lockless guide: says render “never checks for uncommitted” files, but changelog-message detection does check relevant inputs.
  • Default overlay skill: still recommends updating the lock, committing, then re-rendering/amending, without a separate lockless path.
  • Render CLI help and refresh skill: say render never uses rpmautospec process-distgit, but temporary NEVR validation does. The rendered output stays unprocessed; the wording should distinguish that.

cfg := comp.GetConfig()
queryInputs = append(queryInputs, sources.SpecQueryInput{
Name: name, SpecRelPath: filepath.ToSlash(filepath.Join(name, specFilename)),
With: cfg.Build.With, Without: cfg.Build.Without, Defines: cfg.Build.Defines,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lockless query uses uncommitted TOML defines/with/without here, but build uses the settings embedded in committed rendered packaging. Is this mismatch expected?

For example, pipewire currently has build.without = ["v4l2", "roc"]. Adding "pulse" without rendering and committing would make query omit pipewire-pulseaudio subpackage, but build would still select it using the committed settings.

Should lockless query use the same committed macro settings as build, so it describes what would actually be built?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: needs review PRs that need review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants