Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 25, 2026

Addresses three review comments from PR #485 regarding the Markdown Import feature.

Changes

  • Add unique filtered index on ExternalId: Index on BlogPost.ExternalId with WHERE ExternalId IS NOT NULL filter to improve import lookup performance while allowing multiple nulls. Prevents table scans and duplicate external IDs.

  • Add MarkdownImportJobTests: 9 integration tests covering create/update paths, disabled feature behavior, error handling (invalid markdown, source provider failures, partial failures), and cache invalidation logic.

  • Rename test: Should_Migrate_From_11_To_12Should_Migrate_To_Version_13 to reflect actual target version.

The unique index prevents the non-deterministic update behavior mentioned in the review when multiple posts share the same external ID:

builder.HasIndex(x => x.ExternalId)
    .HasDatabaseName("IX_BlogPosts_ExternalId")
    .IsUnique()
    .HasFilter("ExternalId IS NOT NULL");

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 25, 2026 21:36
Co-authored-by: linkdotnet <26365461+linkdotnet@users.noreply.github.com>
Co-authored-by: linkdotnet <26365461+linkdotnet@users.noreply.github.com>
Co-authored-by: linkdotnet <26365461+linkdotnet@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Markdown import feature for syncing blog posts Address PR #485 review feedback: Add unique index on ExternalId, comprehensive tests, and fix test name Jan 25, 2026
Copilot AI requested a review from linkdotnet January 25, 2026 21:46
@linkdotnet linkdotnet marked this pull request as ready for review January 25, 2026 22:01
Copilot AI review requested due to automatic review settings January 25, 2026 22:01
@linkdotnet linkdotnet merged commit f53cb0c into feat-#484 Jan 25, 2026
3 checks passed
@linkdotnet linkdotnet deleted the copilot/sub-pr-485 branch January 25, 2026 22:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request addresses review feedback from PR #485 by adding a unique filtered index on BlogPost.ExternalId, comprehensive integration tests for the Markdown Import feature, and fixing a test name to reflect the correct migration version.

Changes:

  • Added unique filtered index on BlogPost.ExternalId with WHERE ExternalId IS NOT NULL to prevent duplicates and improve query performance
  • Added 9 comprehensive integration tests for MarkdownImportJob covering create/update operations, error handling, and cache invalidation
  • Renamed migration test from Should_Migrate_From_11_To_12 to Should_Migrate_To_Version_13 to accurately reflect the target version

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/LinkDotNet.Blog.UpgradeAssistant.Tests/MigrationManagerTests.cs Renamed test method to accurately reflect migration to version 13
tests/LinkDotNet.Blog.IntegrationTests/Web/Features/MarkdownImportJobTests.cs Added comprehensive test suite with 9 tests covering all major scenarios including create, update, error handling, and cache invalidation
src/LinkDotNet.Blog.Infrastructure/Persistence/Sql/Mapping/BlogPostConfiguration.cs Added unique filtered index on ExternalId column for data integrity and performance
src/LinkDotNet.Blog.Infrastructure/Migrations/BlogDbContextModelSnapshot.cs Updated model snapshot to reflect new ExternalId index
src/LinkDotNet.Blog.Infrastructure/Migrations/20260125214130_AddUniqueIndexOnExternalId.cs Added migration to create unique filtered index on ExternalId
src/LinkDotNet.Blog.Infrastructure/Migrations/20260125214130_AddUniqueIndexOnExternalId.Designer.cs Auto-generated designer file for the new migration
Files not reviewed (1)
  • src/LinkDotNet.Blog.Infrastructure/Migrations/20260125214130_AddUniqueIndexOnExternalId.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


#nullable disable

namespace LinkDotNet.Blog.Infrastructure.Migrations;
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

The namespace for this migration file is inconsistent with other migration files in the same directory. All other migrations in the codebase use LinkDotNet.Blog.Web.Migrations as their namespace (see 20250830110439_AddAuthorNameInBlogPost.cs, 20260109211327_AddBlogPostTemplate.cs, and 20260125204524_AddExternalIdToBlogPost.cs), but this file uses LinkDotNet.Blog.Infrastructure.Migrations. This inconsistency could lead to confusion and potential issues with migration discovery. Please change the namespace to match the established convention.

Copilot uses AI. Check for mistakes.

#nullable disable

namespace LinkDotNet.Blog.Infrastructure.Migrations
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

The namespace for this migration designer file is inconsistent with other migration files in the same directory. All other migrations in the codebase use LinkDotNet.Blog.Web.Migrations as their namespace, but this file uses LinkDotNet.Blog.Infrastructure.Migrations. This inconsistency could lead to confusion and potential issues with migration discovery. Please change the namespace to match the established convention.

Copilot uses AI. Check for mistakes.
Substitute.For<ILogger<MarkdownImportJob>>());

// Act
await sut.RunAsync(Substitute.For<IJobExecutionContext>(), TestContext.Current.CancellationToken);
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

The tests in this file use TestContext.Current.CancellationToken while other similar job test files in the codebase use CancellationToken.None (see BlogPostPublisherTests.cs and SimilarBlogPostJobTests.cs). For consistency with the established pattern in the codebase, consider using CancellationToken.None instead of TestContext.Current.CancellationToken unless there's a specific reason for the different approach.

Copilot uses AI. Check for mistakes.
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.

2 participants