Skip to content

hooks: harden quality-gate ordering, timeouts, and worktree integration coverage #671

Description

@carlospedreira

Context

Follow-up from #666 after rebasing the optional quality gate onto #642. The pragmatic merge establishes the core behavior: enter-done resolves the workflow task worktree and runs the full verify chain there. This issue tracks the remaining quality-gate-specific hardening without duplicating the generic transition-hook context and project-root fallback work in #669.

Required behavior

  • Preserve worktree cleanliness after quality commands. 05-verify-quality.ps1 currently runs after 01-git-clean.ps1, so a successful test/lint command can create or modify files after cleanliness has already passed. Reorder the checks or rerun cleanliness after the quality gate.
  • Enforce the declared timeout. src/hooks/verify/config.json declares timeout_seconds, but verify execution currently relies only on the enclosing enter-done max_duration; add a real per-hook/per-command timeout with reliable child-process cleanup and actionable timeout reporting.
  • Add combined integration coverage proving the enabled quality command executes in the registered task worktree when the runtime/hook is launched from an unrelated directory.

Acceptance criteria

  • An exit-zero quality command that dirties a tracked or non-ignored file cannot leave the task in done with an unclean worktree.
  • A hung test or lint command is stopped at the documented timeout, including its child process tree, and the transition reports which check timed out.
  • An enter-done integration test configures an enabled quality command that records its cwd, launches from an unrelated directory, supplies a normal workflow task plus valid worktree-map entry, and proves the recorded cwd is the task worktree.
  • The integration test also proves a failing quality command aborts the done transition through the normal enter-done result path.
  • Existing Test-VerifyQuality.ps1, Test-Hooks.ps1, and structure tests remain green.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status
    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions