Repository navigation
Conversation
|
Thanks for opening your first pull request in the Codna CLI! Please make sure the checks are green and that the change follows CONTRIBUTING.md. A maintainer will review it shortly. |
| result = Sandbox(network="deny", timeout_seconds=budget, env=env, network_backend=backend).run( | ||
| argv, cwd=run_dir, accepted_exit_codes=(0, 1) |
There was a problem hiding this comment.
🔴 HIGH · correctness — CODNA_JUNIT env var not updated per-suite; multi-suite runs use wrong JUnit path
The previous code built a per-run environment override: run_env = {**env, "CODNA_JUNIT": run_junit} and passed env=run_env to each Sandbox. The diff removes this and passes the shared env dict (where CODNA_JUNIT always equals the root report.xml) to every suite's Sandbox. For multi-suite runs, each suite gets its own JUnit path (report-0.xml, report-1.xml, …) in suite_junit and in --junitxml=, but the CODNA_JUNIT environment variable that pytest and any custom wrapper command reads still contains the initial path. The subsequent os.path.isfile(run_junit) check uses run_junit (the correct per-suite path), so if pytest actually writes to that path via --junitxml= the check still works — however any code inside the test suite or runner that reads $CODNA_JUNIT to write its own report will write to the wrong file, causing failures to go undetected or reports to be silently overwritten.
- result = Sandbox(network="deny", timeout_seconds=budget, env=env, network_backend=backend).run(
+ run_env = {**env, "CODNA_JUNIT": run_junit}
+ result = Sandbox(network="deny", timeout_seconds=budget, env=run_env, network_backend=backend).run(
Reply @codna fix and Codna opens a verified, test-green, risk-gated fix PR.
| runs.append(( | ||
| suite, | ||
| [sys.executable, "-m", "pytest", "-q", f"--junitxml={suite_junit}"], | ||
| suite_junit, | ||
| per_suite, | ||
| )) |
There was a problem hiding this comment.
🔴 HIGH · correctness — Removed --ignore flags cause double-collection of nested sub-suites
The old argv construction appended --ignore=<candidate> for every suite whose parent directory is the current suite being run (os.path.dirname(candidate) == suite). This prevented a container-directory pytest config (e.g. packages/) from recursively discovering and running tests already handled by nested independent suite runs (packages/pkg-a/, packages/pkg-b/). The new argv has no --ignore flags at all. When a container directory is itself a valid pytest root, pytest will collect and execute its nested sub-suites' tests both in the parent suite invocation and again in each nested suite's own Sandbox run. This produces duplicate test IDs in the failure list, inflated failure counts, and potentially conflicting JUnit output.
runs.append((
suite,
- [sys.executable, "-m", "pytest", "-q", f"--junitxml={suite_junit}"],
+ [sys.executable, "-m", "pytest", "-q", f"--junitxml={suite_junit}",
+ *[f"--ignore={c}" for c in suites if os.path.dirname(c) == suite]],
suite_junit,
per_suite,
))
Reply @codna fix and Codna opens a verified, test-green, risk-gated fix PR.
| for suite in crashed: | ||
| parts.append(f"{os.path.relpath(suite, repo_dir)}: exited non-zero with no JUnit report") |
There was a problem hiding this comment.
⚪ LOW · correctness — Crash diagnostic always reports 'no JUnit report' even when a report was produce
Previously crashed stored (run_dir, has_report) tuples, and the diagnostic message distinguished 'exited non-zero with JUnit report but no failing test ids' (a suite that wrote XML but had no <failure> elements, e.g. a pytest internal error encoded in XML) from 'exited non-zero with no JUnit report'. The refactor drops has_report and always emits the 'no JUnit report' message. A suite that produces a JUnit file but with no parseable failing test ids will be misreported, making it harder to diagnose whether the crash produced evidence.
Reply @codna fix and Codna opens a verified, test-green, risk-gated fix PR.
Automated mirror of cli/ (flattened), the root allowlist (server.json, glama.json, LICENSE, .gitleaks.toml) and the public-root/ community tree from thyn-ai/codna at db1cd15dc8e3949dd13f0e1d58a523b8deef739e. Merges itself via auto-merge once the mirror's required checks (codna review, Analyze (python)) pass and the codna-ai review approves; if a later sync lands first, this PR is closed as superseded -- every sync PR is a full snapshot of the exported surface.