Skip to content

fix(setup): quit setup when fail#504

Merged
MaojiaSheng merged 1 commit intomainfrom
refactor_setup
Mar 10, 2026
Merged

fix(setup): quit setup when fail#504
MaojiaSheng merged 1 commit intomainfrom
refactor_setup

Conversation

@zhoujh01
Copy link
Collaborator

@zhoujh01 zhoujh01 commented Mar 9, 2026

Description

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

@zhoujh01 zhoujh01 changed the title refactor: quit setup when fail fix(setup): quit setup when fail Mar 9, 2026
@github-actions
Copy link

github-actions bot commented Mar 9, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Cargo Target Resolution

Verify that _resolve_cargo_target_dir correctly locates the Cargo target directory in all scenarios (with/without CARGO_TARGET_DIR, with/without successful cargo metadata, workspace vs non-workspace).

def _resolve_cargo_target_dir(self, cargo_project_dir, env):
    """Resolve the Cargo target directory for workspace and overridden builds."""
    configured_target_dir = env.get("CARGO_TARGET_DIR")
    if configured_target_dir:
        return Path(configured_target_dir).resolve()

    try:
        result = subprocess.run(
            ["cargo", "metadata", "--format-version", "1", "--no-deps"],
            cwd=str(cargo_project_dir),
            env=env,
            check=True,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
        )
        metadata = json.loads(result.stdout.decode("utf-8"))
        target_directory = metadata.get("target_directory")
        if target_directory:
            return Path(target_directory).resolve()
    except Exception as exc:
        print(f"[Warning] Failed to resolve Cargo target directory via metadata: {exc}")

    return cargo_project_dir.parents[1] / "target"
Artifact Check Fallback Paths

Confirm that when pre-built artifacts are partially missing or skipped builds fail, the artifact checks correctly propagate errors and abort setup.

def _run_stage_with_artifact_checks(
    self, stage_name, build_fn, required_artifacts, on_success=None
):
    """Run a build stage and always validate its required outputs on normal return."""
    build_fn()
    for artifact_path, artifact_name in required_artifacts:
        self._require_artifact(artifact_path, artifact_name, stage_name)
    if on_success:
        on_success()

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

PR Code Suggestions ✨

No code suggestions found for the PR.

@MaojiaSheng MaojiaSheng merged commit ae4c641 into main Mar 10, 2026
47 checks passed
@MaojiaSheng MaojiaSheng deleted the refactor_setup branch March 10, 2026 01:30
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants