Workspace(feat[lifecycle]): Add project hooks and stop command#1048
Open
tony wants to merge 8 commits into
Open
Workspace(feat[lifecycle]): Add project hooks and stop command#1048tony wants to merge 8 commits into
tony wants to merge 8 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## parity-runtime-config #1048 +/- ##
=========================================================
+ Coverage 82.30% 82.47% +0.16%
=========================================================
Files 28 29 +1
Lines 2594 2704 +110
Branches 502 527 +25
=========================================================
+ Hits 2135 2230 +95
- Misses 328 336 +8
- Partials 131 138 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
b7442dc to
8047b2c
Compare
1e5aeb0 to
f031d96
Compare
8047b2c to
eebcf20
Compare
f031d96 to
99fbb1b
Compare
eebcf20 to
575d74a
Compare
99fbb1b to
61a6df4
Compare
575d74a to
250222d
Compare
Member
Author
Code reviewFound 1 issue:
tmuxp/docs/configuration/top-level.md Lines 74 to 77 in 250222d Implementation showing the non-blocking dispatch: tmuxp/src/tmuxp/workspace/builder.py Lines 551 to 557 in 250222d 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
d22d8e1 to
e104ea3
Compare
why: Add lifecycle cleanup and restart hooks as a separate layer above runtime config primitives. what: - Run start and restart hooks from load while preserving append behavior - Store exit and stop hook metadata on newly created tmux sessions - Add tmuxp stop with on_project_stop execution - Register the new modules' doctest fixtures and the stop subcommand in the CLI-surface guards (conftest, help-example validation), which must move in lockstep with the CLI
why: Pin hook firing semantics per load path and the stop command's behavior. what: - Load CLI tests for start/restart hook dispatch and append behavior - Stop command tests including on_project_stop execution - Builder and config tests for exit/stop hook metadata - util tests for run_hook_commands
why: Give users working references for lifecycle hooks and the stop command. what: - CLI page and API autodoc page for tmuxp stop - Lifecycle hook sections in top-level configuration docs - Example workspace file for lifecycle hooks
why: Lifecycle hook commands may contain expanded credentials, so normal logs must not persist the command text. what: - Replace hook command log extras with a redacted placeholder
why: Pin that hook failure logging keeps exit codes without leaking command text. what: - Assert redacted placeholder in hook log extras and absence of the raw command string
why: The prose claimed all hooks block tmuxp, but on_project_exit runs via tmux's client-detached hook after tmuxp has returned — the claim was false for one of the four hooks and contradicted the per-hook table on the same page. what: - Name the three blocking hooks explicitly and describe on_project_exit's deferred, non-blocking dispatch
why: run_hook_commands logs records under tmux_hook_cmd, but the key was absent from the structured-context table that downstream consumers treat as the schema contract. what: - Add the tmux_hook_cmd row to the core key table
why: The command text is redacted because hooks may expand credentials, but the failure path logged the hook's raw stdout/stderr at debug — the same secrets leak through output. what: - Replace raw output debug logging with a single suppression record carrying tmux_stdout_len / tmux_stderr_len companion fields - Add parametrized coverage asserting an echoed secret marker reaches no log record while the length fields remain attributable
e104ea3 to
3e55df9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #1047 to keep lifecycle behavior separate from runtime config primitives.
on_project_start,on_project_restart,on_project_exit, andon_project_stophandlingtmuxp stopso stored stop hooks run before killing a sessionVerification
Ran before commit:
$ rm -rf docs/_build; uv run ruff check . --fix --show-fixes; uv run ruff format .; uv run mypy; uv run py.test --reruns 0 -vvv; just build-docs;Result: ruff clean, format unchanged, mypy clean, pytest
841 passed, 2 skipped, docs built successfully with the repo's existing warning class.Stack: depends on #1047. Importer fallback follow-up is stacked on this branch.