Skip to content

Ryan/reversion#3

Merged
ryan-wong157 merged 9 commits into
mainfrom
ryan/reversion
Mar 24, 2026
Merged

Ryan/reversion#3
ryan-wong157 merged 9 commits into
mainfrom
ryan/reversion

Conversation

@ryan-wong157
Copy link
Copy Markdown
Member

@ryan-wong157 ryan-wong157 commented Mar 21, 2026

Version Notes: v1.2.0

  • Cleaned up repo root checks from Henry's merge
  • Removed repo root checks from srlaunch.
  • Added host/srutils.py for common logic between srpkg and srbuild
  • Added toml param file generation and autofilling, as well as autofilling a main file template in srpkg
  • Added integration tests for srpkg and srlaunch
  • Added .gitignore

@ryan-wong157 ryan-wong157 requested a review from genryjiang March 21, 2026 05:42
@ryan-wong157 ryan-wong157 self-assigned this Mar 21, 2026
@ryan-wong157 ryan-wong157 requested a review from SebMoore March 21, 2026 05:43
@genryjiang
Copy link
Copy Markdown

nice work, just a few thoughts:

  • I would caution against assuming paths are one level above in the event that tests are moved, reorganised or run from an installed package or we want to run it against PATH in the future

Other than that, LGTM

@ryan-wong157
Copy link
Copy Markdown
Member Author

Yep will keep for now, but can change later

…idate_name to not accept empty strings, fixed typo in readme
Copilot AI review requested due to automatic review settings March 24, 2026 03:15
@ryan-wong157 ryan-wong157 merged commit 3f1d3a1 into main Mar 24, 2026
4 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the host-side tooling to share common repo-root detection/validation logic, expands srpkg’s scaffolding output (TOML params + main.cpp template), and adds CI-backed integration tests.

Changes:

  • Added host/srutils.py and refactored srpkg/srbuild to use shared repo-root resolution + validation.
  • Updated srpkg package skeleton generation (param TOML + main.cpp template; removed older config/param JSON behavior).
  • Added pytest integration tests and a GitHub Actions workflow to run them.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
target/srlaunch Removes repo-root checks; derives deploy/ location from script path.
host/srutils.py New shared helper module for repo-root resolution/validation and error exits.
host/srpkg Refactors repo checks to srutils; updates generated package structure and templates.
host/srbuild Refactors repo checks to srutils; adjusts parallel build invocation.
host/tests/conftest.py Adds fixtures to create a temporary git repo with expected structure.
host/tests/test_srpkg_integration.py Adds end-to-end integration tests for srpkg.
host/tests/test_srbuild_integration.py Adds end-to-end integration tests for srbuild.
.github/workflows/test.yml Adds CI job to run pytest integration tests.
README.md Updates version header and adds v1.2.0 notes.
.gitignore Adds standard Python/IDE/OS ignores and CLI artifact ignores.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread target/srlaunch
BIN_PATH = DEPLOY_ROOT/"bin"

if not (DEPLOY_ROOT/"bin").exists() and not (DEPLOY_ROOT/"param").exists():
print(f"Error: {__file__} not in deploy/tools directory")
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The deploy/tools location check only prints an error and then continues executing. This can lead to confusing later failures (e.g., missing BIN_PATH) while still showing a “not in deploy/tools” message. Consider failing fast here (e.g., call die()/sys.exit) once the location check fails.

Suggested change
print(f"Error: {__file__} not in deploy/tools directory")
print(f"Error: {__file__} not in deploy/tools directory")
sys.exit(1)

Copilot uses AI. Check for mistakes.
Comment thread target/srlaunch
Comment on lines +32 to +35
DEPLOY_ROOT = Path(__file__).resolve().parents[1]
BIN_PATH = DEPLOY_ROOT/"bin"

if not (DEPLOY_ROOT/"bin").exists() and not (DEPLOY_ROOT/"param").exists():
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The condition if not (DEPLOY_ROOT/"bin").exists() and not (DEPLOY_ROOT/"param").exists() will only flag an error when both directories are missing. If the script is misplaced but one of these directories happens to exist, the check won’t trigger. If the intent is to ensure srlaunch is under deploy/tools, validate the expected structure more directly (e.g., check Path(__file__).parent.name == "tools" and that DEPLOY_ROOT/"bin" exists).

Suggested change
DEPLOY_ROOT = Path(__file__).resolve().parents[1]
BIN_PATH = DEPLOY_ROOT/"bin"
if not (DEPLOY_ROOT/"bin").exists() and not (DEPLOY_ROOT/"param").exists():
SCRIPT_DIR = Path(__file__).resolve().parent
DEPLOY_ROOT = SCRIPT_DIR.parents[0]
BIN_PATH = DEPLOY_ROOT/"bin"
if SCRIPT_DIR.name != "tools" or not (DEPLOY_ROOT/"bin").exists() or not (DEPLOY_ROOT/"param").exists():

Copilot uses AI. Check for mistakes.
Comment thread host/srutils.py
Comment on lines +32 to +36
def resolve_repo_root(cwd: Path = Path.cwd()) -> Path:
candidate = git_toplevel(cwd)
if not candidate.exists() or not candidate.is_dir():
raise RuntimeError("Error: repo root does not exist or is not a directory")
return candidate
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

resolve_repo_root(cwd: Path = Path.cwd()) captures Path.cwd() at import time (default args are evaluated once). If any caller relies on the default, it may resolve the wrong directory. Prefer cwd: Path | None = None and set cwd = Path.cwd() inside the function.

Copilot uses AI. Check for mistakes.
Comment thread host/srpkg
Comment on lines +159 to +166
def fill_main(paths: PkgPaths) -> None:
text = f"""#include "my_node.hpp" // TODO: change to your node

int main(int argc, char* argv[]) {{
// TODO: initialise SRNode
// TODO: Spin SRNode and catch exceptions
return 0;
}}
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The generated src/main.cpp template hardcodes #include "my_node.hpp", but the package generator doesn’t create that header (and the name won’t match most packages). This makes newly generated packages fail to compile by default. Consider generating a matching header (e.g., {pkg_name}.hpp) and including it, or removing the include / using an include that is guaranteed to exist.

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +3 to +8
## Version Notes: v1.2.0
- Cleaned up repo root checks from Henry's merge
- Removed repo root checks from `srlaunch`.
- Added `host/srutils.py` for common logic between `srpkg` and `srbuild`
- Added toml param file generation and autofilling, as well as autofilling a main file template in `srpkg`
- Added integration tests for `srpkg` and `srlaunch`
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The v1.2.0 notes claim “Added integration tests for srpkg and srlaunch”, but this PR adds integration tests for srpkg and srbuild (and no srlaunch tests are present under host/tests). Please update the version notes to match what was actually added, or add the missing srlaunch tests if intended.

Copilot uses AI. Check for mistakes.
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.

3 participants