Repository navigation
fix: avoid subpath false positives for .git repository URLs - #2581
Daniel Meppiel (danielmeppiel) merged 4 commits into
Conversation
|
@microsoft-github-policy-service agree |
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 2 | 1 | 0 | Universal bypass breaks fixed-provider validation and canonical ownership. |
| CLI Logging Expert | 1 | 0 | 0 | Restore the actionable validation error. |
| DevX UX Expert | 1 | 1 | 0 | Cover every required URL and manifest form. |
| Supply Chain Security Expert | 1 | 0 | 0 | Provider-agnostic bypass weakens source identity protection. |
| OSS Growth Hacker | 0 | 0 | 0 | Correct GitLab support improves compatibility without extra friction. |
| Auth Expert | 1 | 0 | 0 | Use canonical GitLab host classification. |
| Doc Writer | 0 | 1 | 0 | Clarify the repository/subpath boundary concisely. |
| Test Coverage Expert | 0 | 1 | 0 | Add a hermetic deep-GitLab lifecycle regression test. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top follow-ups
- [Supply Chain Security Expert] (blocking-severity) Replace the universal
.gitreturn with a pure provider-awareDependencyReferenceguard consumingcore/host_providers. This preserves source identity without network access. - [Python Architect] (blocking-severity) Add the canonical-owner extension, static boundary guard, and matching architecture test. This prevents a parallel provider/primitive heuristic from returning.
- [Test Coverage Expert] (blocking-severity) Add HTTPS/SCP and string/object deep-GitLab pack/install/frozen lifecycle coverage with before-state negative assertions. This proves the contract at the CLI boundary.
- [CLI Logging Expert] Retain the actionable embedded-subpath error for malformed explicit URLs. This prevents cryptic downstream failures.
- [Doc Writer] Add an in-place dependency-reference clarification. This makes the boundary discoverable.
Recommendation
Fold the provider-aware guard and the full regression matrix before shipping. The change is well-scoped, but the current universal bypass undermines predictable dependency resolution.
Full per-persona findings
Python Architect
- [blocking] Terminal
.gitcurrently disables fixed-provider primitive validation atsrc/apm_cli/models/dependency/reference.py:657. - [blocking] Consume
core/host_providersfrom a single pureDependencyReferencedecision and guard that ownership.
Supply Chain Security Expert
- [blocking] A malformed explicit primitive tail can become a downstream source identity and lock/cache input.
Test Coverage Expert
- [recommended] The existing parser unit test does not exercise the required hermetic CLI lifecycle or pre-mutation negative state.
Documentation
- [recommended] Explain that deep GitLab namespace paths are repositories and primitive content belongs in
path:.
This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 2 | 0 | 0 | Nested boundary and ownership concerns were folded; scoped ownership remains appropriate. |
| CLI Logging Expert | 0 | 0 | 0 | Actionable diagnostics remain stable. |
| DevX UX Expert | 1 | 0 | 0 | Explicit virtual-file forms still fail before state through canonical validation. |
| Supply Chain Security Expert | 1 | 0 | 0 | Recursive decoding closes encoded-tail bypasses. |
| OSS Growth Hacker | 0 | 1 | 0 | Unreleased changelog entry folded. |
| Auth Expert | 0 | 0 | 0 | No auth routing concern. |
| Doc Writer | 0 | 0 | 0 | No current documentation contradiction. |
| Test Coverage Expert | 0 | 1 | 0 | Deep GitLab lifecycle no-write case folded. |
| Performance Expert | 0 | 0 | 0 | No performance concern. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Recommendation
Ship the recovery fold. The originally raised bypass, lifecycle, diagnostic, and discoverability concerns are covered by the implementation, mutation checks, lifecycle no-write assertion, and exact-head validation.
Full per-persona findings
- Python Architect: nested GitLab
.gitprimitive tails are rejected; descriptor redesign deferred as cross-cutting. - DevX UX: generic GitLab virtual-file tests now assert the canonical validation error.
- Supply Chain Security: double-encoded primitive tails are rejected.
- OSS Growth: Unreleased compatibility entry added.
- Test Coverage: deep GitLab pre-state lifecycle rejection added.
- CLI Logging, Auth, Doc Writer, and Performance: no remaining findings.
This panel is advisory. It does not block merge. Re-apply the panel-review label after addressing feedback to re-run.
2884555 to
6f759dc
Compare
6f759dc to
884d4d4
Compare
Classify explicit repository paths through the canonical host provider before deciding whether an APM primitive is embedded. This admits deep GitLab namespaces while retaining fixed-provider rejection and adds lifecycle and ownership regression coverage. Co-authored-by: Copilot <[email protected]>
Reject encoded and nested primitive tails after an explicit repository boundary while preserving deep GitLab namespaces. Stabilize lifecycle diagnostics and record the compatibility repair. addresses apm-review-panel follow-ups Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 81d14491-7c32-46fc-b045-b7cde2b2500a
884d4d4 to
7a45fea
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The regression suite for the reported GitLab false-positive does not yet cover the no-.git URL variants that were part of the original reproduction matrix, leaving the fix partially unprotected against regression.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adjusts DependencyReference’s early “embedded subpath” guard to be host-provider aware so GitLab’s arbitrarily deep subgroup namespaces (including subgroup names that collide with APM primitive directory names like collections) no longer false-positive, while still rejecting cases where a clear repository boundary (a .git segment) is followed by an APM primitive tail.
Changes:
- Update
_check_no_embedded_subpathto route parsing decisions throughclassify_host_provider(...), allowing GitLab deep namespaces while retaining strict fixed-boundary behavior for GitHub/others. - Add unit + integration regressions for deep GitLab paths and for “
.gitboundary + primitive tail” malformed URLs. - Extend architecture ownership metadata + linter checks to make embedded-subpath validation’s owner/shape enforceable.
File summaries
| File | Description |
|---|---|
src/apm_cli/models/dependency/reference.py |
Makes embedded-subpath guard provider-aware; adds .git-boundary primitive-tail detection for GitLab; centralizes the canonical error raise. |
tests/unit/test_generic_git_urls.py |
Adds regressions for deep GitLab namespaces with primitive-named subgroups; updates virtual-file rejection tests; adds boundary/tail rejection cases. |
tests/integration/test_consume_source_ref_cache_matrix.py |
Adds lifecycle-smoke coverage ensuring deep GitLab repo boundaries pack/install/frozen-replay deterministically and malformed tails fail before writing state. |
tests/integration/test_architecture_dependency_reference.py |
Adds architecture regression tests asserting single-owner/provider-aware embedded-subpath logic and guarding against bypass mutations. |
scripts/architecture_linter/checks/contracts_test_taxonomy.py |
Extends the dependency-identity rule to enforce embedded-subpath ownership/routing and prevent _APM_PRIMITIVE_DIRS usage outside the owner. |
.apm/architecture/owners/contracts-tooling.json |
Updates owner registry wording to include embedded git URL subpath validation under the same canonical owner set. |
CHANGELOG.md |
Documents the GitLab deep-namespace acceptance and the preserved rejection for “boundary + primitive tail” malformed forms. |
Review details
Suppressed comments (1)
tests/unit/test_generic_git_urls.py:79
- The object-form
type: gitlabregression test currently only covers.git-suffixed URLs; adding no-suffix variants would better lock in the intended behavior for providers with deep namespaces (matching the issue's observed matrix).
(
"https://code.example.invalid/ai/platform/collections/core.git",
"[email protected]:ai/platform/collections/core.git",
),
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ( | ||
| "https://gitlab.com/ai/platform/collections/core.git", | ||
| "[email protected]:ai/platform/collections/core.git", | ||
| ), |
Summary
Stop treating a primitive-named GitLab subgroup as an embedded APM subpath when the explicit repository URL already terminates in
.git.Changes
.gitterminator signal in_check_no_embedded_subpath.gitrepository URLshttps://gitlab.com/ai/collections/core.gitValidation
The new test covers a depth-3 GitLab repository whose subgroup is named
collections, while existing subpath-guard tests continue to cover shorthand malformed paths.Fixes #2528