Skip to content

Redirect health check - #1340

Merged
cotti merged 15 commits into
mainfrom
redirect_health_check
Jun 16, 2025
Merged

cotti merged 15 commits into
mainfrom
redirect_health_check

Conversation

@cotti

@cotti cotti commented Jun 3, 2025 •

Copy link
Copy Markdown
Contributor

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

@Mpdreamz Mpdreamz left a comment

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.

Left a few comments!

@Mpdreamz Mpdreamz left a comment

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.

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)

@Mpdreamz Mpdreamz Jun 12, 2025 •

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.

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah yes

@cotti
cotti requested a review from Mpdreamz June 12, 2025 18:34

@Mpdreamz Mpdreamz left a comment

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.

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
Copy Markdown
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
Copy Markdown
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");

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