Expose Markdown validation selection

This commit is contained in:
2026-10-07 23:26:48 +00:00
parent 6397d41517
commit 40068af1bf
20 changed files with 403 additions and 23 deletions

View File

@@ -52,6 +52,10 @@ type ValidationSpec struct {
// GoFormat checks the formatting of committed regular Go source files. It
// does not modify repository contents and is disabled when false.
GoFormat bool
// Markdown selects committed Markdown destination and fragment checking.
// Nil disables the check; an empty object enables it with the default
// behavior, reporting outside-checkout destinations as out of scope.
Markdown *MarkdownValidationSpec
// ModuleDistribution selects checks for files that affect module-source
// distribution. Its zero value disables those checks.
ModuleDistribution ModuleDistributionValidationSpec
@@ -60,6 +64,13 @@ type ValidationSpec struct {
FileSize *FileSizeValidationSpec
}
// MarkdownValidationSpec selects behavior for committed Markdown links.
type MarkdownValidationSpec struct {
// EnforceCheckoutBoundary fails when a local destination resolves outside
// the candidate checkout. Submodule contents remain out of scope.
EnforceCheckoutBoundary bool
}
// FileSizeValidationSpec selects a maximum size for each committed blob.
type FileSizeValidationSpec struct {
// LimitBytes is the maximum decimal byte count. Nil selects 1,000,000;
@@ -107,14 +118,19 @@ type GoValidationSpec struct {
// Validation.GoFormat checks regular committed Go source after those selected
// Go checks and before AdditionalChecks. Its zero value disables formatting.
// Validation.ModuleDistribution.WorkspaceFiles rejects committed workspace
// files after the other selected shared checks. Its zero value disables the
// distribution check and does not change Go's workspace environment.
// files after formatting. Its zero value disables that distribution check and
// does not change Go's workspace environment.
// Validation.ModuleDistribution.LocalReplacements parses committed go.mod
// declarations, including nested modules, and rejects filesystem replacements
// after workspace-file inspection. Its zero value disables that check.
// Validation.FileSize checks each selected committed blob after module
// distribution checks. Its nil value disables size checks; an empty object
// enables the default limit.
// Validation.Markdown checks committed local Markdown destinations and
// supported fragments after file-size inspection and before AdditionalChecks.
// Nil disables the check; an empty object enables it. Outside-checkout
// destinations are reported as out of scope unless the selected specification
// enforces the checkout boundary. Submodule contents remain out of scope.
// The zero values of all selections preserve the ordinary suite. If
// Build selects targets, Check builds them after validation in temporary
// storage outside the worktree, then rechecks
@@ -143,6 +159,7 @@ func candidateRequest(request ReleaseRequest) candidate.Request {
FullVet: request.Validation.Go.FullVet,
CompileTargets: make([]validation.Target, len(request.Validation.Go.CompileTargets)),
GoFormat: request.Validation.GoFormat,
Markdown: internalMarkdownSettings(request.Validation.Markdown),
ModuleDistribution: validation.ModuleDistributionSettings{
WorkspaceFiles: request.Validation.ModuleDistribution.WorkspaceFiles,
LocalReplacements: request.Validation.ModuleDistribution.LocalReplacements,
@@ -159,6 +176,13 @@ func candidateRequest(request ReleaseRequest) candidate.Request {
return result
}
func internalMarkdownSettings(spec *MarkdownValidationSpec) *validation.MarkdownSettings {
if spec == nil {
return nil
}
return &validation.MarkdownSettings{EnforceCheckoutBoundary: spec.EnforceCheckoutBoundary}
}
func internalFileSizeSettings(spec *FileSizeValidationSpec) *validation.FileSizeSettings {
if spec == nil {
return nil