Skip to content

porch.checks has no per-protocol scoping, so valid overrides warn on protocols that lack the check #33

Description

@pseudoseed

Problem

porch.checks in .codev/config.json is a flat Record<string, CheckOverride>. An override for a check name that a given protocol does not define produces a warning on every porch status:

⚠ Unknown check override "test" (not found in protocol)

The override is correct and necessary. It just doesn't apply to every protocol.

Repro

In a repo with no package.json (an infra/GitOps repo, for example), the protocols default to npm commands that cannot run:

Protocol Check names
spir, aspir build, tests, e2e_tests
bugfix build, test, tests, regression_test
air build, test, tests, e2e_tests
pir, maintain build, tests

Overriding test is required or BUGFIX and AIR run npm test and block at the fix phase. But test does not exist in SPIR, so every porch status on a SPIR project warns.

There is no way to satisfy both. Dropping the override breaks BUGFIX and AIR; keeping it warns on SPIR.

Suggested fix

porch.consultation already solves the equivalent problem with byProtocol:

byProtocol[P].modelsByType[T] > byProtocol[P].models > modelsByType[T] > models

Give porch.checks the same treatment:

{
  "porch": {
    "checks": {
      "build": { "command": "./infra/scripts/render-manifests.sh" }
    },
    "byProtocol": {
      "bugfix": { "checks": { "test": { "command": "./infra/scripts/run-tests.sh" } } }
    }
  }
}

A narrower alternative: keep the flat map and suppress the warning when the override names a check that exists in at least one registered protocol. That fixes the noise without a config change, though it is less precise.

Context

Found while removing 56 stale local protocol copies from an infra repo so it resolves from the fork instead of shadowing it. The flat check map is the one remaining place where a repo-specific need cannot be expressed cleanly at the config layer, which is what pushes people toward copying protocol.json locally in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions