Skip to content

feat: print onboarding hint after successful install (#1153)#1157

Merged
rrajan94 merged 3 commits intoTracer-Cloud:mainfrom
Ryjen1:feat/1153-post-install-onboarding-hint
May 1, 2026
Merged

feat: print onboarding hint after successful install (#1153)#1157
rrajan94 merged 3 commits intoTracer-Cloud:mainfrom
Ryjen1:feat/1153-post-install-onboarding-hint

Conversation

@Ryjen1
Copy link
Copy Markdown
Contributor

@Ryjen1 Ryjen1 commented Apr 30, 2026

Summary

Fixes #1153.

After a successful install, both install.sh (Linux/macOS) and install.ps1 (Windows) now always print a clear next-step message:

Next: run 'opensre onboard' to complete setup.

The hint appears unconditionally after configure_path / the PATH warning block, so it shows up in every scenario — first-time install, reinstall, and upgrade (including the silent case where the install dir is already on PATH and configure_path returns without printing anything).


What changed

File Change
install.sh +3 lines after configure_path (blank line + hint)
install.ps1 +3 lines inside Install-OpenSre before closing brace (blank line + hint)
tests/cli/test_install_sh_path.py New _run_post_install helper + 5 new tests

Approach chosen

Option B from the issue — always print a clear next-step message. Option A (auto-running opensre onboard) was ruled out because the binary may not be on PATH in the current shell session when installed via curl | bash, making auto-run silently unreliable.


Tests

5 new tests added to tests/cli/test_install_sh_path.py:

Test What it covers
test_onboarding_hint_shown_when_path_not_set First install — configure_path writes rc file, hint follows
test_onboarding_hint_shown_when_path_already_set Reinstall/upgrade — configure_path returns silently, hint still appears
test_onboarding_hint_shown_for_bash_linux bash/linux shell
test_onboarding_hint_shown_for_main_channel --main rolling build install
test_onboarding_hint_appears_after_version_line Correct output order — hint comes after "Installed opensre v..."

The new _run_post_install helper exercises the full real post-install output block of install.sh (version print + configure_path + hint) rather than configure_path in isolation, closing the gap where the silent early-return PATH scenario was untestable with the old _run() helper.

Before: 12 passed, no assertion on "opensre onboard"
After: 17 passed, 0 failures


Testing locally

.venv/bin/python -m pytest tests/cli/test_install_sh_path.py -v

Ryjen1 added 2 commits April 30, 2026 21:13
After a successful install, both install.sh (Linux/macOS) and install.ps1
(Windows) now always print:

  Next: run 'opensre onboard' to complete setup.

The hint appears unconditionally after configure_path / the PATH warning,
so first-time installers and users upgrading an existing install both see it.

Adds 5 new tests to tests/cli/test_install_sh_path.py via a new
_run_post_install helper that exercises the full post-install output block
(version confirmation + configure_path + hint) rather than configure_path
in isolation, covering the silent early-return PATH scenario that the
existing helper could not reach.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 30, 2026

Greptile Summary

This PR adds a "Next: run opensre onboard to complete setup." hint to both install.sh and install.ps1 after a successful install. The script changes are minimal and correct. However, the five new tests in test_install_sh_path.py are tautological: the _run_post_install helper hard-codes the post-install block from install.sh — including the hint itself — so the assertions always pass regardless of what install.sh actually contains, providing no regression protection.

Confidence Score: 4/5

Safe to merge for end-users, but the new tests won't catch a regression of the feature they claim to test.

The installer changes are trivially correct. The P1 finding is in the test file: the helper copies the code under test into the test itself, making all five new assertions permanently green even if the hint is removed from install.sh. This is a real defect in the newly added test infrastructure, so the score is 4 rather than 5.

tests/cli/test_install_sh_path.py — _run_post_install helper and all five new tests need to be reworked to actually source the hint from install.sh.

Important Files Changed

Filename Overview
install.sh Adds three lines (blank line + onboarding hint) after configure_path at end of script; straightforward and correct.
install.ps1 Adds blank line + Write-Host hint inside Install-OpenSre after the PATH warning block; correctly mirrors the install.sh change.
tests/cli/test_install_sh_path.py Adds _run_post_install helper and 5 tests, but the helper hard-codes the post-install block (including the hint) in the test script rather than sourcing it from install.sh, making the new assertions tautological.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[install.sh / install.ps1 runs] --> B[Download & install binary]
    B --> C[Print version confirmation line]
    C --> D[configure_path]
    D --> E{Install dir already on PATH?}
    E -- Yes --> F[Return silently]
    E -- No / Windows --> G[Write rc file / emit PATH warning]
    F --> H["log: Next: run 'opensre onboard' to complete setup."]
    G --> H
Loading

Reviews (1): Last reviewed commit: "style: apply ruff formatting to test_ins..." | Re-trigger Greptile

Comment thread tests/cli/test_install_sh_path.py Outdated
Comment on lines +214 to +228

# --- real post-install output block (mirrors install.sh lines 690-703) ---
if [ "$INSTALL_CHANNEL" = "main" ]; then
if [ "$installed_version" = "main" ]; then
log "Installed ${{BIN_NAME}} main build to ${{INSTALL_DIR}}/${{BIN_NAME}}"
else
log "Installed ${{BIN_NAME}} main build (${{installed_version}}) to ${{INSTALL_DIR}}/${{BIN_NAME}}"
fi
else
log "Installed ${{BIN_NAME}} v${{installed_version}} to ${{INSTALL_DIR}}/${{BIN_NAME}}"
fi

configure_path

log ""
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.

P1 Tests are tautological — hint is hard-coded in the helper itself

The _run_post_install helper copies lines 690-703 of install.sh verbatim into the test script, including the new log "Next: run 'opensre onboard' to complete setup." line (line 228). Every assertion like assert "opensre onboard" in result.stdout + result.stderr will always pass because the test itself emits that string — it is not read from install.sh. If someone later deletes the hint from install.sh without touching this file, all five new tests continue to pass.

To actually guard against regression, the helper should drive the real top-level block of install.sh (e.g., source the whole script with mocked network/binary helpers and a trapped exit) rather than re-implementing it in Python. Alternatively, a simpler approach is to grep install.sh directly for the hint string as a contract test alongside the subprocess-based scenario tests.

The _run_post_install helper was copying lines 690-703 of install.sh
verbatim into the test script, including the onboarding hint itself.
This made all five new assertions permanently green even if the hint
was removed from install.sh (the test would still emit the string).

Fix: replace the hard-coded block with two changes:
  1. _find_post_install_start_line() locates the version-print block
     in install.sh at runtime by scanning for its opening line.
  2. The helper now uses 'tail -n +N install.sh' fed through eval, so
     the subprocess runs the real lines from install.sh directly.
     Any deletion or edit of the hint in install.sh will now cause the
     five scenario tests to fail as intended.

Also add two contract tests (test_install_sh_contains_onboarding_hint
and test_install_ps1_contains_onboarding_hint) that grep the script
sources directly, providing a fast and independent regression guard
that is completely decoupled from subprocess execution.
@rrajan94
Copy link
Copy Markdown
Collaborator

rrajan94 commented May 1, 2026

LGTM 👍
Validated locally: installer-path tests, lint, and typecheck passed.

@rrajan94 rrajan94 merged commit 21cf25f into Tracer-Cloud:main May 1, 2026
10 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

😤 @Ryjen1 said "I will fix this" and then actually fixed it. Legendary behavior.


👋 Join us on Discord - OpenSRE : hang out, contribute, or hunt for features and issues. Everyone's welcome.

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.

Post-install: run onboarding or tell users to run opensre onboard

2 participants