Skip to content

Latest commit

 

History

History
214 lines (179 loc) · 9.79 KB

PowerForge.Web.QualityGates.md

File metadata and controls

214 lines (179 loc) · 9.79 KB

PowerForge.Web Quality Gates (Recommended Defaults)

This document captures recommended, low-surprise defaults for running PowerForge.Web across multiple sites with consistent CI behavior.

Goals

  • Dev loops should be fast and informative (warnings allowed, limited previews).
  • CI should be strict but stable (fail only on new regressions).
  • Themes should be contract-driven (feature flags + required fragments + CSS selector checks).
  • Output should not silently bloat (simple budgets like total file count).

Recommended Pipeline Pattern (Dev + CI In One File)

Use a single pipeline.json and drive strictness via --mode.

Run locally:

  • powerforge-web pipeline --mode dev

Run in CI:

  • powerforge-web pipeline --mode ci

Example pipeline.json:

{
  "$schema": "./Schemas/powerforge.web.pipelinespec.schema.json",
  "steps": [
    { "task": "build", "config": "./site.json", "out": "./_site", "clean": true },

    {
      "task": "verify",
      "id": "verify-dev",
      "config": "./site.json",
      "skipModes": ["ci"],
      "warningPreviewCount": 5
    },
    {
      "task": "verify",
      "id": "verify-ci",
      "config": "./site.json",
      "modes": ["ci"],
      "baseline": "./.powerforge/verify-baseline.json",
      "failOnNewWarnings": true,
      "failOnNavLint": true,
      "failOnThemeContract": true,
      "warningPreviewCount": 10,
      "errorPreviewCount": 10
    },

    {
      "task": "audit",
      "id": "audit-ci",
      "modes": ["ci"],
      "siteRoot": "./_site",
      "summary": true,
      "sarif": true,
      "baseline": "./.powerforge/audit-baseline.json",
      "failOnNewIssues": true,
      "checkAgentContentSecurity": true,
      "agentContentFiles": ["llms.txt", "llms-full.txt", "llms.json"],
      "agentPublicationCatalog": "./data/ecosystem/stats.json",
      "agentPublicationCatalogMaxAgeHours": 48,
      "agentNuGetOwner": "ExampleOwner",
      "agentPowerShellGalleryOwner": "ExampleOwner",
      "maxTotalFiles": 2000,
      "failOnCategories": "budget",
      "failOnIssueCodes": "media-img-dimensions,heading-order,head-render-blocking"
    }
  ]
}

Notes:

  • verify baselines are stored under ./.powerforge/verify-baseline.json by default when generated from the CLI.
  • audit already supports baselines (failOnNewIssues) and can gate on categories (useful for budgets).
  • Use failOnIssueCodes for surgical CI blocking when only specific warnings should fail the build.
  • Use suppressWarnings as a scalpel; prefer baselines for "existing debt".
  • Use suppressIssues (audit) as a scalpel too (e.g. PFAUDIT.BUDGET), but prefer baselines for existing debt and failOnCategories for enforceable budgets.
  • Verify baseline keys strip any leading [CODE] prefix for stability (so adding/changing warning codes does not break baselines).
  • Warning code catalog: Docs/PowerForge.Web.WarningCodes.md.
  • An empty verify baseline (0 keys) is valid and enables failOnNewWarnings semantics ("any warning is new").
  • Verify markdown hygiene now flags multiline HTML media tags (img/iframe/etc.) because they can render as escaped text in output; keep media tags single-line or use markdown/shortcodes.
  • markdown-fix now auto-normalizes multiline media opening tags (img, iframe, video, audio, source, picture) outside code fences.
  • CI pattern: add a dry-run markdown-fix step with failOnChanges:true and write reportPath/summaryPath artifacts for fast remediation.
  • Keep CI builds clean (clean:true). After removing routes or changing synced surfaces, run a clean local build before inspecting _site; incremental dev builds can leave stale HTML that no longer corresponds to source content.

Machine-Facing Artifact Security

Enable checkAgentContentSecurity on the final audit step that reads the built site. The scanner reads configured artifacts as strict UTF-8, never executes their commands, and reports findings through the normal audit, baseline, JSON, and SARIF surfaces.

The scanner:

  • detects invisible bidirectional, tag, and zero-width Unicode controls;
  • warns on high-confidence prompt overrides and downloaded scripts piped into an interpreter;
  • extracts NuGet, PowerShell Gallery, npm, PyPI, crates.io, RubyGems, and Packagist install commands;
  • verifies package existence and exact versions against public registries;
  • rejects package commands that redirect resolution to non-canonical feeds, repositories, indexes, or config files;
  • can require three-part exact-version NuGet and PowerShell Gallery commands to match an owner-scoped publication catalog, including per-module PowerShell Gallery Owners evidence;
  • can optionally resolve external hosts and detect selected dangling-service fingerprints without fetching unique report paths.

Owner verification is fail-closed. When agentNuGetOwner or agentPowerShellGalleryOwner is set, its ecosystem defaults to owner verification for every extracted package. The command must pin an exact version, the catalog owner must match, and the same package/version must be present in the catalog. Use agentRequireOwnerVerification to narrow that scope. Use agentRegistryVerifiedPackages only for explicit third-party exceptions; those packages still have to exist at their public registry.

Public registry APIs do not expose a consistent ownership contract for every ecosystem. PowerForge therefore makes owner claims only from the generated NuGet/PowerShell Gallery catalog and treats other ecosystems as existence and version checks.

The command scanner accepts Node package installation only when it is isolated from the current project graph: use a global npm, pnpm, or Bun install, or use both --ignore-scripts and --package-lock-only with npm. Local install/add/update commands can consume an existing manifest and run its lifecycle scripts, so the scanner rejects them rather than verifying only the package named on the command line.

The same project-isolation rule applies to other mutating clients. Composer require must use --no-update --no-plugins --no-scripts, and Bundler add must use --skip-install; otherwise an existing project can introduce uninspected dependencies or executable hooks. PackageManagement Save-Package is audited as a NuGet download and must name an exact version, select the NuGet provider, and use the canonical source. Pipeline inputs, transitive dependency downloads, and provider bootstrapping are rejected.

External-host verification is optional because it adds network-dependent checks. Trusted domains can be excluded with agentTrustedDomains. Keep it disabled in offline builds, or enable it in a dedicated connected CI job. Package references, hosts, decompressed registry responses, and total network time all have conservative configurable limits; an exceeded limit fails before additional network work.

Direct CLI example:

powerforge-web audit --site-root .\_site `
  --agent-content-security `
  --agent-content-file llms.txt,llms-full.txt,llms.json `
  --agent-publication-catalog .\data\ecosystem\stats.json `
  --agent-publication-catalog-max-age-hours 48 `
  --agent-nuget-owner ExampleOwner `
  --agent-powershell-gallery-owner ExampleOwner `
  --sarif

Creating/Updating Baselines

Verify baseline (creates ./.powerforge/verify-baseline.json):

powerforge-web verify --config .\site.json --baseline-generate

Audit baseline (creates ./.powerforge/audit-baseline.json by default):

powerforge-web audit --site-root .\_site --baseline .\.powerforge\audit-baseline.json --baseline-generate

Common Rules Of Thumb

  • Prefer failOnNewWarnings (verify) and failOnNewIssues (audit) in CI.
  • Use clean builds for route-removal changes before trusting rendered smoke checks; stale incremental output can make deleted pages look like current regressions.
  • Prefer strict theme contracts over "it renders ok on one site":
    • theme.manifest.json should declare features and featureContracts.
    • For apiDocs, include required fragments and a CSS selector contract.
  • With failOnNavLint:true, keep Navigation.Surfaces explicit for feature-heavy sites (docs, apiDocs) so nav contracts fail early instead of drifting across page types.
  • Add budgets only when you can defend them:
    • maxTotalFiles is a simple early warning for accidental output explosion.
    • Sites with API references can legitimately exceed 800 files (per-type pages add up quickly). Set a budget that reflects the site's expected scale (example: 2000-5000) or exclude known large outputs from budgets via budgetExclude (for example api/**).

Compatibility Lock (Prevent Silent Default Drift)

If you want CI behavior to stay frozen across engine updates, enable:

  • requireExplicitChecks: true on audit/doctor steps

When enabled, the step fails fast unless these checks are explicitly set in the step:

  • checkSeoMeta
  • checkNetworkHints
  • checkRenderBlockingResources
  • checkHeadingOrder
  • checkLinkPurposeConsistency
  • checkMediaEmbeds
  • checkAgentContentSecurity (audit only)

Example:

{
  "task": "audit",
  "siteRoot": "./_site",
  "requireExplicitChecks": true,
  "checkSeoMeta": false,
  "checkNetworkHints": true,
  "checkRenderBlockingResources": true,
  "checkHeadingOrder": true,
  "checkLinkPurposeConsistency": true,
  "checkMediaEmbeds": true,
  "checkAgentContentSecurity": true
}

Links between owned sites

Enable OwnedLinks in site.json and provide config on the pipeline audit step. Sitemaps provide a cached page inventory; bounded HTTP checks confirm missing entries and follow redirects. Set Severity to error to fail on confirmed 404/410 destinations. Network failures and incomplete checks are unknown warnings, which remain subject to existing warning/new-issue gates and baselines. Builds without this opt-in policy do not acquire network checks.