Skip to content

Conversation

@linkdotnet
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings January 25, 2026 21:08
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 PR introduces a Markdown Import feature that can periodically pull markdown files from an external source, parse them into blog posts, and keep them in sync via an ExternalId field. It also wires the feature into configuration, background jobs, admin UI, and the upgrade assistant, and extends the data model to support external IDs on blog posts.

Changes:

  • Add configuration and upgrade path for a new MarkdownImport section (including ConfigVersion bump to 13.0) and extend documentation to describe the feature and configuration.
  • Implement domain and web-layer support for importing markdown posts: MarkdownMetadata/MarkdownContent, MarkdownImportParser, IMarkdownSourceProvider with FlatDirectoryMarkdownProvider, and a scheduled MarkdownImportJob that creates/updates BlogPost entities (using a new ExternalId column) and clears cache.
  • Integrate the feature into the application: appsettings defaults, ApplicationConfiguration, service registration (typed HTTP client + parser + provider), NCron background scheduling, admin Settings page button & tests, EF Core mapping/migration for ExternalId, and upgrade-assistant migrations/tests.

Reviewed changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/LinkDotNet.Blog.UpgradeAssistant/Migrations/Migration_12_To_13.cs Adds a migration step that injects a default MarkdownImport section into config JSON when missing.
tools/LinkDotNet.Blog.UpgradeAssistant/MigrationManager.cs Registers Migration12To13 and updates the effective latest config version to 13.0.
tests/LinkDotNet.Blog.UpgradeAssistant.Tests/MigrationManagerTests.cs Updates expectations to ConfigVersion 13.0 and presence of MarkdownImport, validating the new migration chain.
tests/LinkDotNet.Blog.UnitTests/Web/Features/Admin/Settings/SettingsPageTests.cs Extends Settings page tests to cover the new “Run Markdown Import” button visibility and job triggering based on configuration.
tests/LinkDotNet.Blog.TestUtilities/ApplicationConfigurationBuilder.cs Adds support to build ApplicationConfiguration instances with a MarkdownImport section for tests.
src/LinkDotNet.Blog.Web/appsettings.json Bumps ConfigVersion to 13.0 and adds a default-disabled MarkdownImport section to the shipped configuration.
src/LinkDotNet.Blog.Web/ServiceExtensions.cs Registers MarkdownImportParser, a typed HttpClient for FlatDirectoryMarkdownProvider (using MarkdownImport.Url as BaseAddress), and wires IMarkdownSourceProvider into DI.
src/LinkDotNet.Blog.Web/RegistrationExtensions/BackgroundServiceRegistrationExtensions.cs Schedules MarkdownImportJob to run every 15 minutes, conditionally on MarkdownImport.Enabled.
src/LinkDotNet.Blog.Web/Features/MarkdownImport/MarkdownImportParser.cs Implements parsing of markdown files into metadata, short description, and content, with structured logging and validation of required/optional fields.
src/LinkDotNet.Blog.Web/Features/MarkdownImport/MarkdownImportJob.cs Implements the background job that fetches markdown files, parses them, and creates or updates BlogPost entities keyed by ExternalId, then clears cache and logs outcomes.
src/LinkDotNet.Blog.Web/Features/MarkdownImport/MarkdownImportConfiguration.cs Defines MarkdownImportConfiguration with Enabled, SourceType, and Url settings.
src/LinkDotNet.Blog.Web/Features/MarkdownImport/IMarkdownSourceProvider.cs Introduces the abstraction and DTO (MarkdownFile) for sources that supply markdown files.
src/LinkDotNet.Blog.Web/Features/MarkdownImport/FlatDirectoryMarkdownProvider.cs Implements a provider that scrapes a flat directory listing via HTTP, finds .md links, and downloads their contents with logging and basic error resilience.
src/LinkDotNet.Blog.Web/Features/Admin/Settings/SettingsPage.razor Adds a conditional “Run Markdown Import” row that triggers MarkdownImportJob via IInstantJobRegistry and shows a toast when enabled in config.
src/LinkDotNet.Blog.Web/ApplicationConfiguration.cs Extends the configuration record with an optional MarkdownImport node.
src/LinkDotNet.Blog.Infrastructure/Persistence/Sql/Mapping/BlogPostConfiguration.cs Maps the new nullable ExternalId property on BlogPost with a max length constraint.
src/LinkDotNet.Blog.Infrastructure/Migrations/BlogDbContextModelSnapshot.cs Updates the EF Core model snapshot to include the ExternalId column on BlogPost.
src/LinkDotNet.Blog.Infrastructure/Migrations/20260125204524_AddExternalIdToBlogPost.cs Adds an EF migration that introduces the ExternalId column to the BlogPosts table.
src/LinkDotNet.Blog.Infrastructure/Migrations/20260125204524_AddExternalIdToBlogPost.Designer.cs Designer metadata for the ExternalId migration, reflecting the updated target model.
src/LinkDotNet.Blog.Domain/MarkdownImport/MarkdownMetadata.cs Introduces a domain record capturing markdown metadata such as id, title, image, tags, publish state, dates, and author.
src/LinkDotNet.Blog.Domain/MarkdownImport/MarkdownContent.cs Domain record combining MarkdownMetadata with short description and full content.
src/LinkDotNet.Blog.Domain/BlogPost.cs Adds an ExternalId property, and updates the Create/Update methods to set and propagate it so imported posts can be tracked.
docs/Setup/Configuration.md Documents the new MarkdownImport configuration node and links to the detailed feature documentation.
docs/Features/MarkdownImport/Readme.md Provides a full feature guide for Markdown Import, including configuration, file format, behavior, and caveats.
Readme.md Exposes Markdown Import as a top-level feature and links to the new documentation.
Files not reviewed (1)
  • src/LinkDotNet.Blog.Infrastructure/Migrations/20260125204524_AddExternalIdToBlogPost.Designer.cs: Language not supported

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

@linkdotnet
Copy link
Owner Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Jan 25, 2026

@linkdotnet I've opened a new pull request, #486, to work on those changes. Once the pull request is ready, I'll request review from you.

…rehensive tests, and fix test name (#486)

* Initial plan

* Add unique index on ExternalId and rename migration test

Co-authored-by: linkdotnet <26365461+linkdotnet@users.noreply.github.com>

* Add comprehensive tests for MarkdownImportJob

Co-authored-by: linkdotnet <26365461+linkdotnet@users.noreply.github.com>

* Add filter to unique index to handle null values

Co-authored-by: linkdotnet <26365461+linkdotnet@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: linkdotnet <26365461+linkdotnet@users.noreply.github.com>
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