Skip to content

fix(policy): accept package-at-version monorepo release tags in pinned constraint check - #3740

Closed
Mohammed Alkindi (MohammedAlkindi) wants to merge 1 commit into
microsoft:mainfrom
MohammedAlkindi:fix/require-pinned-constraint-package-at-version
Closed

Mohammed Alkindi (MohammedAlkindi) wants to merge 1 commit into
microsoft:mainfrom
MohammedAlkindi:fix/require-pinned-constraint-package-at-version

Conversation

@MohammedAlkindi

Copy link
Copy Markdown
Contributor

Description

The pinned constraint policy check treated package release tags in monorepos as bare branches. Pinned tags using the package at version format, such as those published by Changesets and Lerna, now count as pinned release constraints when followed by an exact semver version.

Issue and approved scope

Issue: Fixes #3731

Human scope-approval comment: #3731

Does this PR complete the issue, or what remains? Completes the issue.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Thank you Mohammed Alkindi (@MohammedAlkindi) for this fix and for the tests. The maintainers decided to accept exact [email protected] release tags (scope record on #3731), and we have carried your approach forward in #3775 with you as co-author. That PR keeps your classifier step and tightens the shape to at most one scope segment, so feature/[email protected] stays a bare branch. It also adds installed-CLI install and audit --ci tests and the docs. Your review on #3775 is very welcome. Closing this one in favour of it.

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 18, 2026
* fix(policy): count exact [email protected] release tags as pinned (#3731)

require_pinned_constraint now treats an exact package release tag
(<name>@X.Y.Z or @<scope>/<name>@X.Y.Z, optional leading v, semver
prerelease/build allowed, at most one scope segment) as a declared
release, through the existing classifier in policy/_constraint_pinning.py.
Dist-tags, ranges, partial versions and multi-segment names stay
violations. This changes the #3224 ruling that rejected another
package's tags, for this exact-release shape only.

Docs state that the check judges declared release intent, not
immutability; the lockfile, --frozen and require_hashes pin content.

Reworks #3740 with the contributor's classifier approach and tests.

Co-authored-by: Mohammed Alkindi <[email protected]>
Co-authored-by: Copilot App <[email protected]>

* docs(changelog): note exact [email protected] release tags for pinned constraints

apm-spec-waiver: req-pl-008 is a floor; accepting exact release tags stays conforming and the record excludes spec text changes.

Co-authored-by: Copilot App <[email protected]>

* test(policy): cover a/b/[email protected] and [email protected] at installed-CLI tier

The #3731 scope record requires installed-CLI tests showing that
multi-segment names and partial versions after @ stay violations under
warn and block; only unit tests covered them. Addresses panel follow-up
FU-1 (test-coverage-expert).

Co-authored-by: Copilot <[email protected]>

* docs(policy): align pinned-shape lists and tag mutability wording

Sibling pages still called tags immutable or listed pinned shapes
without exact [email protected] release tags, contradicting the new policy
docs. Qualifies require_hashes as security.integrity.require_hashes and
trims the repeated immutability note. Addresses panel follow-ups FU-2,
FU-3 and FU-4 (doc-writer).

Co-authored-by: Copilot <[email protected]>

* test(policy): install a release tag that names another package

The motivating ref shadcn/ui#[email protected] names the published
package, not the directory APM derives the name from. The installed-CLI
cases only used pkg-a tags on pkg-a, so this adds [email protected] on the
pkg-a subdirectory through install, --frozen and audit. Addresses
Copilot inline on tests/integration/policy/
test_require_pinned_constraint_declared_e2e.py:295.

Co-authored-by: Copilot <[email protected]>

* docs(policy): separate --frozen replay from require_hashes

require_hashes only requires a content hash on each locked entry; an
update can still record a moved tag's new commit. Replaying the
lockfile with --frozen is what installs the locked commit. Addresses
Copilot inline on docs/src/content/docs/enterprise/policy-reference.md.

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Mohammed Alkindi <[email protected]>
Co-authored-by: Copilot App <[email protected]>
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.

require_pinned_constraint rejects [email protected] release tags as bare branches

3 participants