Skip to content

hook-telemetry: envelope schema validates nothing while ten suites hand-transcribe the field list (deepening candidate) #3410

Description

@kyle-sexton

Context

docs/conventions/hook-telemetry/envelope.schema.json is a published interface with no adapter: a repo-wide grep across *.sh / *.mjs / *.py / *.json finds no consumer beyond its own $id line (reproduced 2026-08-27). Nothing executes it.

Meanwhile the literal line for field in schema_version timestamp hook hook_event status duration_ms data; do appears in 10 test suites (go-format:351, ruff-format:380, biome-format:351, bash-format:508, powershell-format:930, typos-format:1586, markdown-format:1886 and 1933, actionlint:301, eol-normalizer:213), each followed by the same four-line jq -e "has(...)" body. Each copy is a hand transcription of the schema, and a transcription can go vacuous without any gate noticing: #3394 (d6e7830) is the concrete failure, where go-format's stdout-leak assertion grepped a variable the telemetry run never assigned and "passed unconditionally ... leaving the stdout-parity contract unguarded while appearing tested."

Deletion test: concentrates. Two adapters are natural: producers emit envelopes in production, and one schema-driven check consumes them in tests.

Proposed work

  • One envelope-check helper driven by the actual schema file (the pinned check-jsonschema is already in the toolchain), consumed by the suites in place of the transcribed loops.
  • Make the check provably non-vacuous: a deliberately malformed envelope must fail it (asserted in the helper's own suite).
  • Keep the per-suite stdout-parity assertion (envelope never on the hook's own stdout), pointed at real captured output.

Acceptance criteria

  • envelope.schema.json is executed by at least one code path (the shared check), with the schema file as the single source of the field list.
  • The ten transcription loops are replaced by calls to the shared check.
  • A malformed envelope demonstrably fails the check (mutation-style assertion in the helper's suite).

References

  • docs/conventions/hook-telemetry/envelope.schema.json, docs/conventions/hook-telemetry/README.md
  • The ten suites listed above; fix(go-format): capture the telemetry run's own stdout in the leak assertion #3394 / commit d6e7830 (the vacuous-assertion failure mode)
  • Constraint to weigh: docs/conventions/shell-test-helpers/README.md governs where shared test code may live; this proposal should be reconciled with it (repo-tooling layer vs per-plugin suites).
  • Parent candidate: the shared formatter-hook prologue (filed separately, top recommendation).
  • Found by the /architecture:improve deepening scan (2026-08-27); shallow-signal reproduced before filing. Dependency category: local-substitutable. Recommendation: Strong.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumReal value, no hard deadline; normal backlog flow.status: needs-decisionAwaiting a human or maintainer judgment call.work-class: structuralRefactors, migrations, contract changes; cross-cutting and hard to reverse.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions