Skip to content

Redirect health check #1340

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

Merged
merged 15 commits into from
Jun 16, 2025
Merged

Redirect health check #1340

merged 15 commits into from
Jun 16, 2025

Conversation

cotti
Copy link
Contributor

@cotti cotti commented Jun 3, 2025

Closes #759

This PR introduces a new subcommand for docs-builder under diff: validate. An optional parameter can be used to define the base path of the documentation folder. docs is the default.

As we have different interfaces on both builder and assembler now that leverage external commands, I saw fit to do a minor refactoring and move the functionality to a base class, and extended it to serve multiple-line outputs as well.

@cotti cotti self-assigned this Jun 3, 2025
@cotti cotti requested a review from a team as a code owner June 3, 2025 21:55
@cotti cotti added the feature label Jun 3, 2025
Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

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

Left a few comments!

Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

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

Nitpicky changes but functionally and code wise this LGTM !


public partial class LocalGitRepositoryTracker(DiagnosticsCollector collector, IDirectoryInfo workingDirectory) : ExternalCommandExecutor(collector, workingDirectory), IRepositoryTracker
{
public IEnumerable<string> GetChangedFiles(string lookupPath)
Copy link
Member

@Mpdreamz Mpdreamz Jun 12, 2025

Choose a reason for hiding this comment

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

I think it'd be good if we include the type of change and e.g the target.

e.g if I have the following staged changes:

R  docs/configure/site/landing-page.md -> docs/configure/site/landing-page-2.md

the error message is:

Error: docs/configure/site/landing-page.md does not have a redirect rule set. Please add a redirect rule in this project's _redirects.yml.
NOTE: docs/configure/site/landing-page.md

Where the file we want to report on is the current renamed file landing-page-2.md.

It would also be good for the error to be descriptive to the type of change.

  • File 'x' was deleted but has no redirect targets, this will lead to broken links.
  • File 'x' was renamed to 'y' but has 'x' has no redirect configuration.
Error: docs/configure/site/landing-page.md does not have a redirect rule set. Please add a redirect rule in this project's _redirects.yml.
NOTE: docs/configure/site/landing-page.md 

I think the file to include in the diagnostics should be _redirects.yml file since that is the file causing the error.

Copy link
Member

Choose a reason for hiding this comment

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

Having all the renames will also make it easier to feed all the renames into docs-builder mv through docs-builder diff apply in a follow up :)

Copy link
Member

Choose a reason for hiding this comment

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

Another note we can detect local unstaged renames using

git stash push -- docs
git stash show --name-status
git stash pop

Copy link
Member

Choose a reason for hiding this comment

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

Another note we can detect local unstaged renames using

git stash push -- docs
git stash show --name-status
git stash pop

I think only this change remains!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yes

Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

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

Thanks for adding local changes too, small nitpick left but LGTM!

var defaultBranch = GetDefaultBranch();
var commitChanges = CaptureMultiple("git", "diff", "--name-status", $"{defaultBranch}...HEAD", "--", $"./{lookupPath}");
var localChanges = CaptureMultiple("git", "status", "--porcelain");
_ = Capture("git", "stash", "push", "--", $"./{lookupPath}");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_ = Capture("git", "stash", "push", "--", $"./{lookupPath}");
ExecIn([], "git", "stash", "push", "--", $"./{lookupPath}");

var localChanges = CaptureMultiple("git", "status", "--porcelain");
_ = Capture("git", "stash", "push", "--", $"./{lookupPath}");
var localUnstagedChanges = CaptureMultiple("git", "stash", "show", "--name-status", "-u");
_ = Capture("git", "stash", "pop");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_ = Capture("git", "stash", "pop");
ExecIn([], "git", "stash", "pop");

@cotti cotti merged commit 469c825 into main Jun 16, 2025
15 checks passed
@cotti cotti deleted the redirect_health_check branch June 16, 2025 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Force creation of redirects
3 participants