Skip to content

I0817 — Phase timing and work counters behind MJ_TIMING

Time every validator and count every YAML flatten and git call when MJ_TIMING is set, and report them ranked at exit.

DONE wave 0 · p0 · implementation profile · runs alone

Part of M004 — Performance is executable evidence, and the hot path does no canonical work twice.

Objective

Time every validator and count every YAML flatten and git call when MJ_TIMING is set, and report them ranked at exit.

Why

Nothing else in this milestone can be measured without it; optimisation without a ranking is guessing.

Current state

Landed on feature/performance-truth as 77f5d79: the dispatcher declares one phase per validator, mj_git and mj_yaml_flatten count.

Desired state

Phases and counters are the vocabulary every later issue reports in.

Scope

  • lib/common.sh
  • lib/doctrine.sh
  • test/cases/08_no_forbidden_constructs.sh

Out of scope

  • A tracing backend
  • Timing that is on when MJ_TIMING is unset

Dependencies

None. This issue is a root of the graph.

What waits on this

Acceptance criteria

  • The report ranks phases by time and sums counters on stderr, with the command output untouched
  • Off, a phase or a count costs one test and no subprocess

Validation

  • MJ_TIMING=1 bin/majordomus doctor
  • bash test/run.sh 08_no_forbidden_constructs

Evidence required

  • phase_timing

Evidence

coverstypecommandresultat commit
phase_timingtestMJ_TIMING=1 bin/majordomus doctorthe report on stderr ranks one phase per validator and sums the yaml_flatten and git counters; on this repository the two largest phases are the project-model and command-coverage validators, together two thirds of doctor's total; case 08 accepts the timing file as a scratch path; cases 02, 14, 17 and 18 pass unchanged77f5d79

Risk

The clock is EPOCHREALTIME where bash has it and perl otherwise; whole seconds where neither exists, and the report says which.

Timeline

started
2026-09-05T01:35:00Z
verified
2026-09-05T01:44:00Z
completed
2026-09-05T01:44:00Z

Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.

Canonical record: .ai/repo/project/issues/I0817.yaml. Read it back with majordomus plan show I0817.