Skip to content

sync: mirror from thyn-ai/codna@db1cd15dc8e3949dd13f0e1d58a523b8deef739e - #37

Closed
0xamlab wants to merge 1 commit into
mainfrom
sync/db1cd15dc8e3949dd13f0e1d58a523b8deef739e
Closed

0xamlab wants to merge 1 commit into
mainfrom
sync/db1cd15dc8e3949dd13f0e1d58a523b8deef739e

Conversation

@0xamlab

@0xamlab 0xamlab commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

Copy link
Copy Markdown

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.

@codna-ai codna-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

codna review — 3 finding(s): 3 inline, 0 in summary.

Reply @codna fix on a finding to have Codna open a verified, test-green, risk-gated fix PR.

⏸ Not approved: 2 medium/high finding(s) in this review.

Comment thread codna/testrun.py
Comment on lines +379 to +380
result = Sandbox(network="deny", timeout_seconds=budget, env=env, network_backend=backend).run(
argv, cwd=run_dir, accepted_exit_codes=(0, 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 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.

Comment thread codna/testrun.py
Comment on lines +355 to +360
runs.append((
suite,
[sys.executable, "-m", "pytest", "-q", f"--junitxml={suite_junit}"],
suite_junit,
per_suite,
))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 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.

Comment thread codna/testrun.py
Comment on lines +430 to +431
for suite in crashed:
parts.append(f"{os.path.relpath(suite, repo_dir)}: exited non-zero with no JUnit report")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪ 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.

@0xamlab

0xamlab commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #38 (a later thyn-ai/codna commit). Every sync PR is a full snapshot of the exported surface, so this one carries nothing #38 does not. Closing.

@0xamlab 0xamlab closed this Oct 31, 2026
auto-merge was automatically disabled October 31, 2026 21:18

Pull request was closed

@0xamlab
0xamlab deleted the sync/db1cd15dc8e3949dd13f0e1d58a523b8deef739e branch October 31, 2026 21:18
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.

1 participant