Skip to content

Refactor pre-push checks for output-mode parity and clearer failure feedback #1780

@josecelano

Description

@josecelano

Goal

Refactor the pre-push hook to align its operator experience with the new pre-commit behavior:
concise output by default, verbose streaming on demand, and structured JSON output for automation.

Background

Issue #1769 introduced a stronger CLI and reporting contract for pre-commit, including:

  • --format=<text|json>
  • --verbosity=<concise|verbose> and --verbose alias
  • concise per-step summaries with log-path and failure tail
  • optional workspace-local log directory via environment variable

contrib/dev-tools/git/hooks/pre-push.sh still uses legacy output behavior. This creates an
inconsistent local workflow and weaker automation ergonomics in the heavier validation gate.

Because pre-push includes nightly checks and E2E, this refactor should keep the check set intact
while improving clarity, observability, and parity with pre-commit.

Scope

In Scope

  • Add --format=<text|json> to pre-push with text as default.
  • Add --verbosity=<concise|verbose> with concise as default.
  • Keep --verbose as alias for --verbosity=verbose.
  • Add concise failure summaries (step, status, elapsed, log path, failure tail).
  • Add JSON output mode with one structured payload to stdout.
  • Add configurable per-step log directory env var (follow pre-commit contract).
  • Preserve existing pre-push validation steps, including E2E.
  • Update docs/skills so pre-commit and pre-push behavior is consistent.

Out of Scope

  • Changing which checks run in pre-push.
  • Moving E2E out of pre-push.
  • CI workflow redesign.
  • Broader hook framework rewrite into Rust CLI (future option only).

Implementation Plan

Status values: TODO, IN_PROGRESS, BLOCKED, DONE.

ID Status Task Notes / Expected Output
T1 TODO Define pre-push CLI/output contract Final behavior matrix and error handling documented
T2 TODO Implement hook refactor pre-push.sh supports format/verbosity/log-dir parity
T3 TODO Validate behavior in pass and fail paths Text concise/verbose + JSON tested with exit-code verification
T4 TODO Update docs and skills Workflow docs aligned with pre-push capabilities
T5 TODO Run quality checks and finalize evidence linter all and targeted checks pass

Acceptance Criteria

  • AC1: pre-push.sh supports --format=<text|json> and --verbosity=<concise|verbose> with --verbose alias.
  • AC2: --format=text --verbosity=concise prints high-signal per-step summary; failures include log path and short tail.
  • AC3: --format=json emits one valid JSON document to stdout with step-level status and timing.
  • AC4: Invalid/unknown flags fail with exit code 2, usage hint, and stderr diagnostics.
  • AC5: Existing pre-push check ownership is preserved (including E2E in pre-push).
  • AC6: Log-directory override env var is supported and documented (parity with pre-commit behavior).
  • linter all exits with code 0
  • Relevant tests pass
  • Documentation is updated when behavior/workflow changes

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions