Skip to content

feat(settings): application setup script - #702

Open
Ziinc wants to merge 9 commits into
mainfrom
claude/keen-mendel-h5mza3
Open

Ziinc wants to merge 9 commits into
mainfrom
claude/keen-mendel-h5mza3

Conversation

@Ziinc

@Ziinc Ziinc commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Adds an app-level setup script in Application settings.

  • Runs only from the Run button, or on every app startup when that switch is on. Runs are serialized across instances by a file lock and time out after 30 minutes.
  • Each run's output is stored as log records and shown in the Logs tab under "App setup".
  • New core::shell_step runner, shared with workflow checks and the workspace setup script: kills the whole process group on timeout, survives non-UTF-8 output, and doesn't hang on background jobs.
    🤖 Generated with Claude Code
    https://claude.ai/code/session_0145f4pMgZpmUQJwC2GbL2mr

Comment thread src/components/SettingsPage.tsx Outdated
Comment thread src-tauri/src/core/app_setup_script.rs

@Ziinc Ziinc left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewed correctness, surrounding call paths, code quality and regression coverage at c504f276. Found 1 actionable issue; details and suggested regression checks are inline.

Validation: source review and GitHub workflow inspection. The PR-head CI workflow reports success. Rust/integration tests were not rerun locally because this environment has no Cargo toolchain.

Comment thread src-tauri/src/core/app_setup_script.rs Outdated
Comment thread src/components/AppSetupScriptSettings.tsx Outdated
Comment thread src-tauri/src/core/app_setup_script.rs Outdated
claude and others added 6 commits October 9, 2026 21:48
Adds an app-level setup script in Application settings. It runs once per
distinct script (SHA-256 and run timestamp stored in the app DB settings
table), reruns when the saved script changes, and optionally runs on
every app startup.
- Save the setup script only when it was edited, and keep its inputs
  disabled until the stored status loads, so saving other settings can
  no longer wipe the script.
- Report `running` from an in-flight counter instead of an unrecorded
  hash, so a skipped or failed spawn no longer shows "Running..." forever.
- Hold a file lock beside the app DB from the hash check until the run is
  recorded, so instances sharing the DB run a script once.
- Kill the script's process group after 30 minutes, and stop waiting on
  background jobs that keep its output pipes open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E1poGWXMSFcPsJ8V5gujWG
…tput

- Saving settings no longer runs the script. It runs from a Run button
  next to the status line, or on every startup when that switch is on.
- Each run's output is stored as log records next to the app DB and
  shown in the Logs tab under a new "App setup" source.
- Drop the script-hash run-once tracking that implicit runs relied on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0145f4pMgZpmUQJwC2GbL2mr
- Add core::shell_step, the `sh -c` runner now used by workflow checks,
  the workspace setup script and the app setup script. It kills the
  script's whole process group on timeout, keeps reading past non-UTF-8
  output instead of closing the pipe (which killed the script with
  SIGPIPE), and waits up to 2s after exit for output to drain without
  hanging on background jobs that hold the pipes open.
- App setup runs are recorded only after their output has drained, so
  the Logs tab never caches a truncated run.
- A startup run counts as running only once it knows it will run, so a
  skipped startup no longer shows "Running…" while another instance
  holds the run claim.
- Run ignores clicks until the started run is reported, so a double
  click starts one run.
- Settings shows the error when the setup script status fails to load.
- Logs tab: one FilteredLogs component backs the Checks and App setup
  sources.
- core::app_db_path_from_env is the one TREQ_APP_DB_PATH /
  TREQ_APP_DATA_DIR lookup.
- Integration test resets the last run before each test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0145f4pMgZpmUQJwC2GbL2mr
Keeps SettingsPage under the 500-line lint limit after rebasing onto the
agent-finished notification setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0168dvZ9czkPzsQELRFSK9wK
@Ziinc
Ziinc force-pushed the claude/keen-mendel-h5mza3 branch from 4be063f to d9fa9b0 Compare October 9, 2026 22:03
Ziinc and others added 2 commits October 9, 2026 22:29
jj 0.46 adds a .git worktree file to new workspaces in colocated repos, so a
create interrupted after registration left a directory with .jj and .git.
The recovery check only accepted a lone .jj entry and refused the retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0168dvZ9czkPzsQELRFSK9wK
After moving the status query into useAppSetupScript, the refresh timer was
not rescheduled when a run flipped the status to running, so the result of
the run never appeared. Drive the interval from state set on each fetch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0168dvZ9czkPzsQELRFSK9wK

This branch was successfully deployed

1 active deployment
preview — 87bb7af1 Deployed Oct 9, 2026 by Ziinc via build #1760
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants