Skip to content

Hand a Caller's hook-input to the validate and resolve-upstream Hooks - #4465

Merged
ptr727 merged 3 commits into
developfrom
burndown/task-hook-input
Nov 26, 2026
Merged

ptr727 merged 3 commits into
developfrom
burndown/task-hook-input

Conversation

@ptr727

@ptr727 ptr727 commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Per the maintainer's 2026-11-01 answer on #3325 (option 1), a hub task's hook can now learn which caller runs it.

  • check-upstream-version-task.yml and validate-task.yml each take an optional hook-input string, default empty.
  • Each task runs its caller's hook from one of two guarded steps. The plain step runs when hook-input is empty and passes nothing, as today. The second runs only when it is set and passes with: hook-input. So a caller passing nothing runs its hook exactly as before, a hook declaring no such input included. A caller that sets the value needs a hook declaring hook-input.
  • The upstream task reads versions from whichever of the two steps ran.
  • The hub's no-op validate-default never receives the value.
  • The hub's own resolve-upstream and validate hooks declare the input, ignored, so actionlint accepts the new with: blocks against them. They also show the declaration a caller's hook copies.
  • docs/reusable-workflows.md states the input in "The Hook Contract" and in "Adopting the Gates". "Adopting the Type-Specific Tasks" now has ESPHome-NonRoot's second tracker pass hook-input: dependency and its own state-file, so its one hook can branch and the two trackers no longer share one state file.
  • tests/test_workflow_steps.py pins both routes, with a mutation test for each guard, the passed value, and the input's declaration.

No caller stub changes, since every fleet caller is outside this repository. WORKFLOW.md describes no hook inputs, so it stays true.

Closes on promotion: #3325

Verification

  • actionlint and markdownlint via scripts/docker_lint.py: clean. Before the hub hooks declared the input, actionlint failed on both new steps, which is why they declare it.
  • The full unittest suite: 5016 tests pass (13 skipped), including the new HookInputCase in test_workflow_steps.py.
  • The pre-commit gate (ruff, mypy, the prose gate, the repo gate) passed on each commit.
  • Local strict review: two recorded passes. The first raised three findings. Two were fixed in b8b0ded: the test did not read required, and the doc sentences were misplaced. The third is listed below. The second pass was clean.

Pre-existing findings, not filed

  • .agents/skills/branching-and-release-model/references/release-publish-mechanics.md "Wrapper repos that track an upstream release" (pre-existing, incomplete instruction): it gives a package-list snapshot tracker as its auto-merge: false example without saying that a second tracker in a repository that already runs one needs its own state-file and a hook-input for the shared hook. The text predates this change and stays true as written. This change put the full second-caller shape in docs/reusable-workflows.md "Adopting the Type-Specific Tasks".

🤖 Generated with Claude Code

ptr727 and others added 2 commits November 25, 2026 17:18
validate-task.yml and check-upstream-version-task.yml each take an
optional hook-input string and pass a non-empty value to the caller's
hook from a guarded step of its own, so a hook declaring no such input
is never handed one. A repository calling the upstream tracker twice can
now tell its one hook which caller runs it, and a caller can hand its
change-gate result to an expensive validate hook.

The hub's own validate and resolve-upstream hooks declare the input, so
actionlint accepts the new steps. The adoption doc's second tracker now
passes hook-input and a state file of its own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…gether

The hook-input test now reads required as well as type and default, with a
mutation flipping it to true. The doc moves the hook-input sentences past the
package-hook ones, so "A package hook also" follows the release-asset text it
continues.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Nov 26, 2026
Copilot AI lite review requested due to automatic review settings November 26, 2026 01:30
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head b8b0deda4ff23b37d6f7d045728b6a1891822f0c, the content this pull request carries at that commit against develop, and it recorded 0 findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The change still contains three active documentation and workflow-contract inconsistencies about how non-empty hook inputs are handled, so clarification is needed before approval.

3 open issues
What changed in this PR

This pull request extends reusable validation and upstream-version workflows so callers can optionally pass a string to their repository-owned hooks while preserving existing behavior when no input is provided.

Changes:

  • Adds guarded hook-input handling to both reusable tasks.
  • Declares the optional input in the hub's validation and upstream-resolution hooks.
  • Updates upstream output selection, documentation, and structural workflow tests.
File Description
tests/​test_workflow_steps.py Adds structural and mutation tests for hook routing, input forwarding, declarations, and upstream output selection.
docs/​reusable-workflows.md Documents the hook-input contract and downstream adoption patterns, including the second upstream tracker.
.github/​workflows/​validate-task.yml Adds optional hook-input handling for repository validation hooks.
.github/​workflows/​check-upstream-version-task.yml Adds optional hook-input handling for upstream version resolution and supports output from either hook route.
.github/​actions/​validate/​action.yml Declares the optional validation hook input for actionlint compatibility and caller guidance.
.github/​actions/​resolve-upstream/​action.yml Declares the optional upstream-resolution hook input for actionlint compatibility and caller guidance.

Review effort: Lite

Comment thread .github/workflows/validate-task.yml Resolved
Comment thread docs/reusable-workflows.md Resolved
@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.74%. Comparing base (b38e084) to head (488d8cc).
⚠️ Report is 354 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4465      +/-   ##
===========================================
- Coverage    81.60%   79.74%   -1.87%     
===========================================
  Files           26       48      +22     
  Lines         9070    16517    +7447     
===========================================
+ Hits          7402    13172    +5770     
- Misses        1668     3345    +1677     
Flag Coverage Δ
python-3.13 79.74% <ø> (-1.87%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

A caller setting hook-input still hands it to a hook that declares no such
input, so the comments, the doc, and the test docstring now promise
unchanged behavior only to a caller passing none, and say a caller setting
it needs a hook that declares it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727

ptr727 commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 488d8cc8a42b0e1b7dd42e6fd9ea10fa38bbc1a7, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727
ptr727 merged commit 8b6ad8b into develop Nov 26, 2026
14 checks passed
@ptr727
ptr727 deleted the burndown/task-hook-input branch November 26, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants