-
-
Notifications
You must be signed in to change notification settings - Fork 87
Address PR #485 review feedback: Add unique index on ExternalId, comprehensive tests, and fix test name #486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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>
There was a problem hiding this 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.ExternalIdwithWHERE ExternalId IS NOT NULLto prevent duplicates and improve query performance - Added 9 comprehensive integration tests for
MarkdownImportJobcovering create/update operations, error handling, and cache invalidation - Renamed migration test from
Should_Migrate_From_11_To_12toShould_Migrate_To_Version_13to 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; |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
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.
|
|
||
| #nullable disable | ||
|
|
||
| namespace LinkDotNet.Blog.Infrastructure.Migrations |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
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.
| Substitute.For<ILogger<MarkdownImportJob>>()); | ||
|
|
||
| // Act | ||
| await sut.RunAsync(Substitute.For<IJobExecutionContext>(), TestContext.Current.CancellationToken); |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
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.
Addresses three review comments from PR #485 regarding the Markdown Import feature.
Changes
Add unique filtered index on
ExternalId: Index onBlogPost.ExternalIdwithWHERE ExternalId IS NOT NULLfilter 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_12→Should_Migrate_To_Version_13to 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:
💡 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.