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. |
| assert "write_sidecar_stamp(" in compile_section, "the compile must emit the stamp" | ||
| assert "cli_version(cli_source)" in compile_section, "the stamp version must come from cli/pyproject.toml" | ||
| assert "sidecar_build_id()" in compile_section | ||
| assert compile_section.index("_assert_sidecar_binary_clean(binary)") < compile_section.index("write_sidecar_stamp(") |
There was a problem hiding this comment.
🟡 MEDIUM · correctness — str.index() inside assert raises ValueError instead of AssertionError on mismatc
Line 815 calls compile_section.index("_assert_sidecar_binary_clean(binary)") and compile_section.index("write_sidecar_stamp(") directly inside an assert statement. If either substring is absent from compile_section, Python raises ValueError (from str.index) rather than AssertionError. pytest reports the failure as an unexpected exception with no descriptive message, making CI failures hard to diagnose. The same problem applies to builder.index(...) on line 811: if either function-definition marker is absent from the script, ValueError is raised before any assertion fires. The fix is to use in checks with explicit assert ... , message statements or str.find() comparisons.
Reply @codna fix and Codna opens a verified, test-green, risk-gated fix PR.
| whatever stamp was on disk, and no unit test of the writer alone would notice the wiring being absent. | ||
| """ | ||
| builder = RELEASE_BUILDER.read_text(encoding="utf-8") | ||
| compile_section = builder[builder.index("def prepare_agent_core_bundle(") : builder.index("def verify_staged_runtime(")] |
There was a problem hiding this comment.
🟡 MEDIUM · correctness — Silent empty slice when verify_staged_runtime precedes prepare_agent_core_bundle
The slice builder[builder.index("def prepare_agent_core_bundle(") : builder.index("def verify_staged_runtime(")] relies on the two function definitions appearing in a specific order in the source file. If "def verify_staged_runtime(" appears before "def prepare_agent_core_bundle(" (or if the file is reorganized), str.index returns a smaller offset for the end than the start, and Python's string slicing silently produces an empty string. Lines 812–814 then fail with uninformative messages (string not found in ""), and line 815 raises ValueError. There is no guard against this ordering inversion.
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 7b4a09e0be48b2a45f41c973fe499b9c4faf4a60. 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.