fix: resolve set() shadowing and sparse checkout ref issues#184
Merged
danielmeppiel merged 2 commits intomicrosoft:mainfrom Mar 6, 2026
Merged
Conversation
- cli.py: Use builtins.set() instead of set() to avoid Click command shadowing - github_downloader.py: Always pass explicit ref to git fetch (default to HEAD) Fixes microsoft#179
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes two reported regressions: set() being shadowed by a Click command in the CLI, and sparse checkout occasionally checking out the wrong commit by fetching an ambiguous ref.
Changes:
- Use
builtins.set(...)explicitly to avoid calling the Clicksetcommand handler. - Ensure sparse checkout always fetches an explicit ref (defaulting to
HEAD) before checking outFETCH_HEAD.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/apm_cli/deps/github_downloader.py | Adjusts git fetch invocation to always include a ref for sparse checkout flows. |
| src/apm_cli/cli.py | Avoids set() shadowing by explicitly referencing builtins.set(). |
Co-authored-by: Copilot <[email protected]>
danielmeppiel
approved these changes
Mar 6, 2026
danielmeppiel
added a commit
that referenced
this pull request
Apr 30, 2026
…#1073) * docs(notice): rename NOTICE.md -> NOTICE; add CLA third-party section Two changes, one file rename: 1. Rename NOTICE.md -> NOTICE, matching the Apache / CNCF convention used by upstream third-party-attribution files (kubernetes-sigs/kro, kubernetes-sigs/headlamp, etc.). The .md extension was non-idiomatic for a generated legal artifact -- NOTICE files are read by tooling (license scanners, SBOM generators) that match on the bare filename. Generator (scripts/generate-notice.py), Makefile target, and the NOTICE Drift Check workflow are all updated to operate on the extension-less path. 2. Add a 'Submitted on behalf of a third-party' section to NOTICE, crediting five contributors whose pull requests landed before the microsoft-github-policy-service CLA bot recorded a signature on file. The repo transferred from danielmeppiel/awd-cli to the microsoft org; some early PRs predate CLA enforcement, and we could not retroactively reach all contributors. Mirrors section 7 of common CLA texts (the wording adopted by CNCF NOTICE files). Driven by a new _third_party_submissions block in scripts/notice-metadata.yaml -- legally-significant wording stays alongside the per-component data, not buried in code. Contributors named (verified via Check Runs API against the microsoft-github-policy-service app, license/cla check on every merged PR by each suspected author): - @pofallon (PR #4) - @richgo (PRs #8, #25, #26, #33, #34) - @ryanfk (PR #92 -- bot ran with conclusion=null, output: 'Contributor License Agreement is not agreed yet.') - @foutoucour (PR #108) - @Jah-yee (PR #184) Listed contributors who later sign the CLA (or who were signed under a different GitHub account at the time) can request removal via issue. Co-authored-by: Copilot <[email protected]> * docs(notice): trim third-party section preamble Strip the historical/CNCF-citation paragraph and the verbatim CLA-section-7 quote. Keep only the active sentence (what the listing means + how to request removal). Co-authored-by: Copilot <[email protected]> * docs(notice): address PR #1073 review Three fixes from copilot-pull-request-reviewer: 1. Drop spurious leading '---' separator in the third-party-submissions renderer. render_component already ends each component with '---\n\n', so prepending another '---' produced two consecutive separators in NOTICE. Verified: separator count dropped from 17 to 16. 2. Sweep stale 'NOTICE.md' references in scripts/generate-notice.py (top-level docstring, Modes section, ComponentMeta and DepSpec field docstrings). The constant was renamed; the docs lagged. 3. Append (#1073) PR refs to both CHANGELOG entries; ASCII-correct the arrow ('->' instead of '->'). Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes two bugs reported in issue #179:
Bug 1: set() builtin shadowed by Click command
src/apm_cli/cli.pyset(_pre_download_results.keys())invokes Click's config set command instead of Python's builtinset()because@config.commanddecorator definesdef set(key, value)which overwrites theset = builtins.setalias.builtins.set(_pre_download_results.keys())explicitly.Bug 2: sparse checkout fetches wrong ref
src/apm_cli/deps/github_downloader.pygit fetch origin --depth=1fetches all branch tips and FETCH_HEAD points to the wrong commit, causing the expected subdirectory to be missing after checkout.Changes
cli.py: Changedset(...)tobuiltins.set(...)(line 1844)github_downloader.py: Changed conditional ref append to always pass ref (default to 'HEAD') (line 1076)Testing
python3 -m py_compile)Fixes #179