Skip to content

Wiring is found in a hook or in any subhook of the directory that hook dispatches to

A repository whose pre-commit is a dispatcher that runs everything in .githooks/pre-commit.d/ still has real enforcement. doctor looks in the hook itself and in every file of <hook>.d/, and reports the file that actually carries the invocation — not the dispatcher that happened to be searched first.

declared statusdeclared status: guaranteed Declared deterministic and blocking, implemented, and naming the behavioural test that is to prove it. Whether a recorded run supports it is the evidence verdict, shown beside it.

recorded evidencerecorded evidence: not run Declared guaranteed, and not supported by a recorded run: the test is named, and no passing run of the current inputs is recorded. how evidence is recorded

The finding names the file that actually carries the invocation. A subhook that is not executable is reported as not wired, because the dispatcher skips it.

What it means

A repository whose pre-commit is a dispatcher that runs everything in .githooks/pre-commit.d/ still has real enforcement. doctor looks in the hook itself and in every file of <hook>.d/, and reports the file that actually carries the invocation — not the dispatcher that happened to be searched first.

How it works

mj_hook_candidates in lib/doctor.sh expands a declared hook into the hook file plus the sorted contents of <hook>.d/. Each candidate is searched for the declared command. The finding names the file where it was found, so the report points at the subhook a person would edit. A subhook that contains the invocation but is not executable is reported as not wired, because a dispatcher iterating its directory will skip it — the check follows what the dispatcher does, not what the file says.

How to see it

mkdir -p .githooks/pre-commit.d
printf '#!/usr/bin/env bash\nmajordomus doctor\n' > .githooks/pre-commit.d/70-majordomus.sh
majordomus doctor
# FAIL wiring  pre-commit — .githooks/pre-commit.d/70-majordomus.sh is not executable
chmod +x .githooks/pre-commit.d/70-majordomus.sh
majordomus doctor
# ok  wiring  pre-commit — invoked by .githooks/pre-commit.d/70-majordomus.sh

What it does not cover

The search is textual: it proves the command appears in a file the dispatcher will execute, and that the file is executable. It does not simulate the dispatcher, so a subhook that is executable and contains the invocation but returns early on some condition is reported as wired. Swallowed exit codes are a separate check.

Why it exists

Numbered *.d/ dispatchers are the common shape of a repository that already takes its hooks seriously. Requiring such a repository to flatten its hook layout to satisfy the checker would be the tool bending the repository around itself.

Detail rendered from docs/claims/dispatcher-wiring.md.

From the statement to the proof

  1. 1 · the public statement

    Wiring is found in a hook or in any subhook of the directory that hook dispatches to

    Made on Doctrine, Doctor.

  2. 2 · the canonical claim

    dispatcher-wiringdeclared status: guaranteed in docs/CLAIMS.yaml

    Defined in read it on this site · docs/CLI.md

  3. 3 · the implementation

    lib/doctor.sh · majordomus doctor

  4. 4 · the test and the scenarios

    Test: test/cases/14_wiring_dispatcher.sh

    Executed in Adopt a repository that already has its own rules.

  5. 5 · the recorded runs

    recorded evidence: not run how evidence is recorded

Verify it yourself

The test runs in a disposable temporary repository and asserts the behaviour, not a string in the source.

from a clone of the repository
bash test/run.sh 14_wiring_dispatcher

Where this claim is used

responsibilities it covers

Related claims same implementation

The moments this answers

Searches the titles and descriptions of every page this site publishes.