Skip to content

perf: ADO REST metadata fetcher to avoid clone-based fetch#1852

Open
Aaryan-Dadu wants to merge 3 commits into
microsoft:mainfrom
Aaryan-Dadu:perf/1808
Open

perf: ADO REST metadata fetcher to avoid clone-based fetch#1852
Aaryan-Dadu wants to merge 3 commits into
microsoft:mainfrom
Aaryan-Dadu:perf/1808

Conversation

@Aaryan-Dadu

@Aaryan-Dadu Aaryan-Dadu commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

When APM reads a marketplace hosted on Azure DevOps, it used to clone the whole repo just to read one small metadata file. GitHub and GitLab marketplaces already skip that, they fetch the single file directly over the host's API. This change gives Azure DevOps the same shortcut, so those reads are faster.

How it works:

  • Azure DevOps marketplaces now read the metadata file straight from the Azure DevOps REST API instead of cloning.
  • If that API call fails for any reason (offline, network error, an odd repo setup), it automatically falls back to the old clone method so nothing breaks.
  • It reuses APM's existing Azure DevOps sign-in (ADO_APM_PAT token or az login).
  • Results are briefly cached, just like GitHub and GitLab.

Closes #1808

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)

If this PR changes behaviour that an OpenAPM v0.1 req-XXX covers,
confirm the three-step ritual (see CONTRIBUTING.md "Adding or
changing a normative requirement"):

  • 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.

Azure DevOps marketplace sources fetched metadata (apm.yml, description,
version) through the generic-git path, resolving files via a subprocess
clone. GitHub and GitLab already have dedicated REST fetchers that avoid a
clone for single-file metadata reads; ADO now matches that fast path.

Add an `ado` source kind that routes to a new `_fetch_ado` via the existing
_FETCHERS dispatch. It reads single files through the Azure DevOps Git items
API (GET .../_apis/git/repositories/{repo}/items) and falls back to the
generic-git clone on any REST/transport failure or offline condition, so
there is no regression. A confirmed 404 returns None (file absent) without a
wasted clone.

Auth reuses AuthResolver's ADO context via try_with_fallback: ADO_APM_PAT as
HTTP Basic with an AAD `az` bearer runtime fallback; the token is never
logged or placed in the URL. ADO joins the JSON sidecar cache (1h TTL) for
parity with the GitLab REST fetcher.
Copilot AI review requested due to automatic review settings June 19, 2026 15:14

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 reached their quota limit.

@sergio-sisternes-epam sergio-sisternes-epam added the panel-review Trigger the apm-review-panel gh-aw workflow label Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

panel-review Trigger the apm-review-panel gh-aw workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(marketplace): optional ADO REST metadata client (/_apis/git/repositories/) to avoid clone-based fetch

3 participants