Skip to content

fix: safely clean up Fabric test artifacts after 24 hours - #2728

Open
Rana Singh (ranadeepsingh) wants to merge 4 commits into
microsoft:masterfrom
ranadeepsingh:fix/fabric-test-cleanup-24h-20260918
Open

Rana Singh (ranadeepsingh) wants to merge 4 commits into
microsoft:masterfrom
ranadeepsingh:fix/fabric-test-cleanup-24h-20260918

Conversation

@ranadeepsingh

@ranadeepsingh Rana Singh (ranadeepsingh) commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Related Issues/PRs

Separate infrastructure fix for Fabric E2E failures caused by workspace artifact
quota exhaustion.

ADO task: AB#5628913.

What changes are proposed in this pull request?

Replace the existing name-only, three-day cleanup with a strict 24-hour policy
for artifacts owned by this repository's Fabric tests.

  • Require both creation and last-update timestamps to be older than 24 hours in
    UTC. Tag new test artifacts with an explicit OSS ownership description and
    conservatively recognize legacy names and descriptions.
  • Retain unrelated, ambiguous, active, scheduled, recently changed, or shared
    items. Re-read inventory before deleting; keep stores whenever job ownership
    or consumer relationships do not establish safe deletion.
  • Delete job definitions before stores. Check absence up to 31 times with
    two-second pauses instead of assuming a successful DELETE is immediately
    visible. A concurrent not-found response still requires confirmed absence.
  • Attempt independent job deletions after individual failures, retain stores,
    and report collected failures. Let Fabric cascade managed SQL endpoints
    rather than deleting endpoints independently.
  • Add SYNAPSEML_FABRIC_CLEANUP_DRY_RUN=true, operator documentation, and safety
    regressions in an existing CI-selected suite.
  • Make cleanup a named Fabric cleanup preflight task inside the existing
    FabricE2E job, after authentication/build setup and before the success-gated
    E2E task. Preserve cleanup JUnit results before the next SBT invocation and
    publish staged reports and phase metadata even when E2E is skipped or fails.
  • Defer suite Fabric connections, stores, and notebook submissions until test
    execution. Each suite independently caches its cleanup and setup outcomes,
    including interrupted cleanup. Failed setup cannot retry allocations for
    later tests. Successful runs retain concurrency 3, immediate per-job cleanup,
    and executor shutdown before final artifact cleanup.

This changes OSS test infrastructure and the Fabric pipeline task layout.
Public main APIs, generated code, workflows, dependency pins, and other
repositories are unchanged.

How is this patch tested?

  • Reproduced eager workspace resolution and missing preflight task failures
    before implementing the guards and pipeline split.
  • JDK 11: 43 tests passed across FabricTestArtifactTrackerSuite and
    FabricArtifactNamesSuite, with no skipped tests.
  • Full compile and Test/compile.
  • All-module scalastyle and Test/scalastyle.
  • 86 pipeline regressions, including execution of the actual Bash snippets
    with fake commands for success, cleanup failure, E2E failure, and failed setup.
  • Black 22.3.0: 207 files unchanged.
  • Six review rounds for the initial cleanup and six for this preflight
    follow-up. Findings and resolutions are committed under reviews/pr-2728/.
  • Live preview and authorized execute pass of the cleanup policy before the
    content-preserving rebase and preflight orchestration follow-up.

Both live passes examined 24 items, found 0 owned jobs and 0 owned
stores
, and confirmed 0 deletions. No unrelated items were touched, and
these passes did not reclaim capacity.

The live passes did not exercise the real deletion/confirmation, job-history,
or schedule paths because no items were eligible. Deterministic tests cover
those safeguards. Endpoint shapes and sparkjob were checked against the official
history,
schedule,
and Spark job type
contracts.

The new preflight orchestration has not yet completed a live Fabric CI run.
Local checks and a queued Azure build do not establish that the original
Fabric E2E failures are resolved.

Does this PR change any dependencies?

  • No.

Does this PR add a new feature? If so, have you added samples on website?

  • No public feature. Cleanup usage and preflight behavior are documented in
    docs/Reference/Developer Setup.md.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

Copy link
Copy Markdown

Hey Rana Singh (@ranadeepsingh) 👋!
Thank you so much for contributing to our repository 🙌.
Someone from SynapseML Team will be reviewing this pull request soon.

We use semantic commit messages to streamline the release process.
Before your pull request can be merged, you should make sure your first commit and PR title start with a semantic prefix.
This helps us to create release messages and credit you for your hard work!

Examples of commit messages with semantic prefixes:

  • fix: Fix LightGBM crashes with empty partitions
  • feat: Make HTTP on Spark back-offs configurable
  • docs: Update Spark Serving usage
  • build: Add codecov support
  • perf: improve LightGBM memory usage
  • refactor: make python code generation rely on classes
  • style: Remove nulls from CNTKModel
  • test: Add test coverage for CNTKModel

To test your commit locally, please follow our guild on building from source.
Check out the developer guide for additional guidance on testing your change.

@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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 review overview

🔵 Needs a closer look

Destructive infrastructure cleanup paths require final human review, and validation records contain unresolved inconsistencies.

Review effort: Lite
Findings: None

What changed in this PR

Updates Fabric test artifact cleanup to safely remove only owned, stale artifacts with dependency checks, dry-run support, and deletion confirmation.

Changes:

  • Adds conservative 24-hour ownership and activity filtering.
  • Adds guarded deletion, pagination, failure aggregation, and regression tests.
  • Documents cleanup operation and records review validation.
File Summary
reviews/​task-fabric-cleanup-attempt-1-review-6-claude-opus-5.md Final review and validation record.
reviews/​task-fabric-cleanup-attempt-1-review-5-gemini-3.8-flash.md Testing review and resolutions.
reviews/​task-fabric-cleanup-attempt-1-review-4-gpt-6-astra.md Failure-aggregation review record.
reviews/​task-fabric-cleanup-attempt-1-review-3-claude-opus-5.md Edge-case findings and resolutions.
reviews/​task-fabric-cleanup-attempt-1-review-2-gemini-3.8-flash.md Architecture review record.
reviews/​task-fabric-cleanup-attempt-1-review-1-gpt-6-astra.md Initial review findings.
docs/​Reference/​Developer Setup.md Documents cleanup usage and safeguards.
core/​src/​test/​scala/​com/​microsoft/​azure/​synapse/​ml/​nbtest/​FabricTestArtifactTrackerSuite.scala Adds cleanup safety regressions.
core/​src/​test/​scala/​com/​microsoft/​azure/​synapse/​ml/​nbtest/​FabricNotebookTests.scala Integrates cleanup and dry-run handling.
core/​src/​test/​scala/​com/​microsoft/​azure/​synapse/​ml/​nbtest/​FabricArtifactCleanup.scala Implements guarded cleanup logic.
core/​src/​test/​scala/​com/​microsoft/​azure/​synapse/​ml/​fabric/​FabricOperations.scala Integrates Fabric APIs and ownership metadata.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

## Summary
Replace name-only three-day cleanup with ownership-aware, UTC-based 24-hour
retention for Fabric E2E artifacts. Confirm asynchronous deletion before
reclaiming stores, and add deterministic safety regressions and operator docs.

## Prompting Intent
Investigate failing Fabric E2E pipelines, delete workspace items created by
this repository's tests only when older than 24 hours, and publish the change
as a separate PR. Preserve unrelated, active, shared, and ambiguous items.

## Linked Sources
- Existing cleanup and suite selection:
  https://github.com/microsoft/SynapseML/blob/cd45147c7025f483e86fc028069d72b070e73a55/core/src/test/scala/com/microsoft/azure/synapse/ml/nbtest/FabricNotebookTests.scala
- Existing Fabric adapter and artifact creation:
  https://github.com/microsoft/SynapseML/blob/cd45147c7025f483e86fc028069d72b070e73a55/core/src/test/scala/com/microsoft/azure/synapse/ml/fabric/FabricOperations.scala
- Operator documentation: docs/Reference/Developer Setup.md
- Six sequential review artifacts: reviews/task-fabric-cleanup-attempt-1-review-*.md
- Job history contract:
  https://learn.microsoft.com/en-us/rest/api/fabric/core/job-scheduler/list-item-job-instances
- Schedule contract:
  https://learn.microsoft.com/en-us/rest/api/fabric/core/job-scheduler/list-item-schedules
- Spark job type:
  https://learn.microsoft.com/en-us/rest/api/fabric/sparkjobdefinition/background-jobs/run-on-demand-spark-job-definition

## Rationale
Artifact names alone do not establish safe ownership or activity. Require
matching ownership metadata, expired creation/update timestamps, safe
dependencies, and idle unscheduled jobs. Re-read inventory before writes;
poll deletion visibility rather than repeat DELETE. Retain stores on any
unconfirmed job deletion, and report independent failures explicitly.
Keep the change in test infrastructure without altering public APIs or CI
configuration. This infrastructure bug fix carries the area/build PR label.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

Copilot AI review requested due to automatic review settings September 19, 2026 00:14
@ranadeepsingh
Rana Singh (ranadeepsingh) force-pushed the fix/fabric-test-cleanup-24h-20260918 branch from a016ddb to 1205df2 Compare September 19, 2026 00:14
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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 review overview

🔵 Needs a closer look

Fabric job-history and schedule requests use a Power BI token audience instead of the Fabric API audience, which can block cleanup.

Review effort: Lite
Findings: None

AB#5628913

## Summary
Move the six existing Fabric cleanup review artifacts into reviews/pr-2728/
without changing their contents or the reviewed implementation.

## Prompting Intent
The engineer requested reviews/pr-<pr_number>/ for review artifacts and an
assigned ADO work item in the current sprint linked to this pull request.

## Linked Sources
- Pull request: microsoft#2728
- Work item: https://dev.azure.com/msdata/A365/_workitems/edit/5628913
- Existing review rounds: reviews/pr-2728/task-fabric-cleanup-attempt-1-review-*.md

## Rationale
Scope the audit trail to its PR while preserving all original review findings,
resolutions, and evidence. Git blob checks confirm six content-identical moves.
No source code, dependencies, or CI configuration changes are needed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 19, 2026 00:24
@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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 review overview

🟡 Changes recommended

Relation parsing can silently ignore malformed dependency fields and permit unsafe deletion.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)

Comment on lines +49 to +50
case JsObject(fields) => fields.values.flatMap(references).toSet
case JsArray(values) => values.flatMap(references).toSet
AB#5628913

## Summary
Separate the existing Fabric cleanup from E2E execution into a named, fail-closed
pipeline task after authentication and build setup. Preserve cleanup reports
across the second SBT invocation and publish staged evidence on failure.

Defer Fabric workspace lookup, store allocation and notebook submission until
test execution. Cache per-suite cleanup and setup outcomes, preserve interrupts,
and retain bounded parallel notebook execution and tracked artifact cleanup.

## Prompting Intent
The engineer asked to make repository-owned test-item cleanup a pre-job task
before Fabric E2E rather than hiding it inside the notebook task. They approved
the explicit pipeline preflight plus lazy suite-level guards. Retain the strict
24-hour ownership policy in the separate cleanup PR, link their current-sprint
ADO task, and keep all review artifacts under reviews/pr-2728/.

## Linked Sources
- Pull request: microsoft#2728
- Tracking task: https://dev.azure.com/msdata/A365/_workitems/edit/5628913
- Operator guide: docs/Reference/Developer Setup.md
- Review findings and resolutions: reviews/pr-2728/task-5628913-attempt-2-review-*.md

## Rationale
A separate step exposes cleanup failures without introducing another job or
duplicating setup. Per-suite checks protect direct runs independently of CI.
Cached setup failures prevent later tests from retrying allocations. Laziness
allows test registration without connecting to Fabric while preserving the
existing parallel workload and public suite member types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 19, 2026 02:19
@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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 review overview

🔵 Needs a closer look

Resolve the notebook setup-error handling and cleanup initialization metadata issues, and correct the documented test command.

Review effort: Lite
Findings: 1 High severity

Open (1)

AB#5628913

## Summary
Make NotebookFixture abstract and create anonymous concrete instances where its
owning suite executes it. Preserve the repository-wide CI test coverage gate.

## Prompting Intent
The engineer reported failed Azure jobs on the Fabric cleanup PR and supplied
the test-matrix and TLS errors. Investigate each failed job, repair the introduced
fixture regression, and distinguish unrelated infrastructure and port prerequisites.

## Linked Sources
- PR: microsoft#2728
- Failed build: https://dev.azure.com/msdata/A365/_build/results?buildId=236598594
- Task: https://dev.azure.com/msdata/A365/_workitems/edit/5628913
- Port prerequisite: microsoft#2725
- Review: reviews/pr-2728/task-5628913-attempt-3-review-1-gpt-6-astra.md

## Rationale
The private helper is exercised by its parent suite, not a standalone test entry
point. Making that intent explicit fixes source discovery without adding a fake
CI selector or weakening the guard. Preserve TLS validation and strict port replay;
those failures have separate infrastructure and branch-content causes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 19, 2026 05:52
@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

CI failure triage for build 236598594:

  • UnitTests core: fixed in 16c74e638fee4f7cc1b6fb1051a0977c262d8587. The new nested NotebookFixture was incorrectly treated as a standalone suite. It is now abstract, with anonymous instances created by its owning suite. The exact failing coverage gate was reproduced before the correction and passes afterward; all 44 targeted tests, Scala style, and compile/Test compile pass. No scanner exclusion or pipeline selector was added.
  • UnitTests language: the AzureCLI task failed before SBT started. The connection to msdata.visualstudio.com received a certificate for *.azureedge.net. This is an agent/service TLS failure, not a language-test assertion. Certificate verification remains enabled.
  • Spark 4.1 compatibility: replay conflicts in FabricNotebookTests.scala. Current spark4.1 tip b4ca894139 lacks the immediate-artifact cleanup methods introduced on master by fix: harden CI cleanup and retain reusable branch guidance #2725, commit 1f33e37653. That prerequisite must reach the release branch before this replay can pass. Retrying the unchanged port cannot resolve the conflict; the gate has not been weakened.

Evidence and the direct review are in reviews/pr-2728/task-5628913-attempt-3-review-1-gpt-6-astra.md. Fresh validation will check the core fix and retry infrastructure setup, but the release prerequisite remains an explicit blocker.

@ranadeepsingh

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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 review overview

🔵 Needs a closer look

The substantial infrastructure and Fabric CI changes lack a completed live CI validation.

Review effort: Lite
Findings: 1 High severity

Open (1)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants