Skip to content

Remove unused subscription histories tables#6454

Open
adamzip wants to merge 1 commit into
dotnet:mainfrom
adamzip:remove-unused-subscription-tables
Open

Remove unused subscription histories tables#6454
adamzip wants to merge 1 commit into
dotnet:mainfrom
adamzip:remove-unused-subscription-tables

Conversation

@adamzip

@adamzip adamzip commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings June 29, 2026 13:31

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.

Pull request overview

This PR removes unused subscription-update tracking and dependency-flow event persistence from Arcade Services (PCS/Maestro), including the associated EF Core models and database tables, and cleans up call sites that were writing to those tables.

Changes:

  • Drop DependencyFlowEvents, SubscriptionUpdates, and SubscriptionUpdateHistory via a new EF Core migration and remove the corresponding EF models/DbSets.
  • Remove dependency-flow event recording / subscription-update action recording code paths in DependencyFlow.
  • Remove the legacy subscriptions history API endpoint and add a small BarViz helper for displaying tracked PR age.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/ProductConstructionService.DependencyFlow.Tests/Mocks/MockRedisCache.cs Included in PR file list (appears empty in checkout).
src/ProductConstructionService/ProductConstructionService.DependencyFlow/SubscriptionTriggerer.cs Removes dependency-flow event persistence helper and its invocation.
src/ProductConstructionService/ProductConstructionService.DependencyFlow/SubscriptionEventRecorder.cs Removes event/action recording responsibilities and related dependencies.
src/ProductConstructionService/ProductConstructionService.DependencyFlow/PullRequestUpdaters/PullRequestUpdater.cs Removes calls that recorded dependency-flow events and subscription update actions.
src/ProductConstructionService/ProductConstructionService.DependencyFlow/PullRequestUpdaters/DependencyPullRequestUpdater.cs Removes calls that recorded dependency-flow events and subscription update actions.
src/ProductConstructionService/ProductConstructionService.DependencyFlow/PullRequestUpdaters/CodeFlowPullRequestUpdater.cs Removes calls that recorded subscription update actions / dependency-flow events.
src/ProductConstructionService/ProductConstructionService.DependencyFlow/Model/SubscriptionUpdateAction.cs Deletes unused enum.
src/ProductConstructionService/ProductConstructionService.DependencyFlow/Model/DependencyFlowEvent.cs Deletes unused enums used for event tracking.
src/ProductConstructionService/ProductConstructionService.DependencyFlow/ISubscriptionTriggerer.cs Removes AddDependencyFlowEventAsync from the interface.
src/ProductConstructionService/ProductConstructionService.BarViz/Code/Helpers/TrackedPullRequestHelper.cs Adds helper to compute/display PR age.
src/ProductConstructionService/ProductConstructionService.Api/appsettings.Development.json Changes ApiRedirect dev config (now points at maestro).
src/ProductConstructionService/ProductConstructionService.Api/Api/v2018_07_16/Models/SubscriptionHistoryItem.cs Removes model tied to subscription history endpoint.
src/ProductConstructionService/ProductConstructionService.Api/Api/v2018_07_16/Controllers/SubscriptionsController.cs Removes /subscriptions/{id}/history endpoint and related pagination usage.
src/Maestro/Maestro.DataProviders/SqlBarClient.cs Removes RegisterSubscriptionUpdate and cleanup logic for SubscriptionUpdates.
src/Maestro/Maestro.DataProviders/ISqlBarClient.cs Removes RegisterSubscriptionUpdate contract.
src/Maestro/Maestro.DataProviders/ConfigurationIngestion/ConfigurationIngestor.cs Removes deletion cleanup against SubscriptionUpdates.
src/Maestro/Maestro.Data/Models/SubscriptionUpdateHistory.cs Removes EF model.
src/Maestro/Maestro.Data/Models/SubscriptionUpdate.cs Removes EF model.
src/Maestro/Maestro.Data/Models/DependencyFlow.cs Removes EF model for dependency-flow events.
src/Maestro/Maestro.Data/Migrations/BuildAssetRegistryContextModelSnapshot.cs Updates snapshot to remove dropped entities/tables.
src/Maestro/Maestro.Data/Migrations/20260615134416_RemoveDependencyFlowEventsAndSubscriptionUpdates.Designer.cs Adds generated migration designer for dropping tables.
src/Maestro/Maestro.Data/Migrations/20260615134416_RemoveDependencyFlowEventsAndSubscriptionUpdates.cs Adds migration to drop DependencyFlowEvents and temporal subscription update tables.
src/Maestro/Maestro.Data/BuildAssetRegistryContext.cs Removes DbSets and temporal-query helper types tied to subscription update history.
Files not reviewed (1)
  • src/Maestro/Maestro.Data/Migrations/20260615134416_RemoveDependencyFlowEventsAndSubscriptionUpdates.Designer.cs: Generated file

Comment on lines 30 to 32
"ApiRedirect": {
// "Uri": "https://maestro.dot.net/"
"Uri": "https://maestro.dot.net/"
},
Comment on lines 16 to 19
/// <summary>
///
/// Exposes methods to Read <see cref="Subscription"/>s
/// </summary>
Comment on lines 257 to 260

return Accepted();
}

/// <summary>
/// Gets a paginated list of the Subscription history for the given Subscription
/// </summary>
/// <param name="id">The id of the <see cref="Subscription"/> to get history for</param>
[HttpGet("{id}/history")]
[SwaggerApiResponse(HttpStatusCode.OK, Type = typeof(List<SubscriptionHistoryItem>), Description = "The list of Subscription history")]
[Paginated(typeof(SubscriptionHistoryItem))]
public virtual async Task<IActionResult> GetSubscriptionHistory(Guid id)
{
Maestro.Data.Models.Subscription? subscription = await _context.Subscriptions.Where(sub => sub.Id == id)
.FirstOrDefaultAsync();

if (subscription == null)
{
return NotFound();
}

IOrderedQueryable<SubscriptionUpdateHistoryEntry> query = _context.SubscriptionUpdateHistory
.Where(u => u.SubscriptionId == id)
.OrderByDescending(u => u.Timestamp);

return Ok(query);
}
}
@@ -0,0 +1,125 @@
// Licensed to the .NET Foundation under one or more agreements.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should prob have only one migration, not two

},
"ApiRedirect": {
// "Uri": "https://maestro.dot.net/"
"Uri": "https://maestro.dot.net/"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guess this was for testing? we should revert it

@@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this for?

Dictionary<UnixPath, TargetRepoDirectoryDependencyUpdates> repoDependencyUpdates = [];

// Get subscription to access excluded assets
// Get subscription to access excluded assets

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

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.

3 participants