Repository navigation
Correctness, clarity and coverage review of #333 (PR1.1) - #334
Conversation
Fix submodule path lookup, missing-directory recovery, metadata validation, failure reports, guidance escaping, and literal Gradle detection. Add manifest round-trip and listing coverage. Correct the user documentation. Evidence: the initial regression run found 19 failures on PR1. After the fixes, 146 focused cases passed. The build gate passed mypy over 271 files and is running the full suite. Co-authored-by: GPT-6 Astra Codex <noreply@openai.com>
|
Accepted at |
Review by the Codex + gpt-6-astra pair. This improvement PR targets #333's branch. It does not merge into
main.Changed
Input validation —
owner_commands.pyandwrap.py. A non-text upstream raisedAttributeError. An empty explicit path selected the default. Invalid upstream metadata could fail after Git wrote files. Validate these inputs before mutation.test_declare_source_refuses_malformed_inputs_without_touching_filescompares manifest and lock bytes across nine malformed inputs.test_bad_wrap_metadata_is_refused_before_git_writeschecks that Git and the target path stay unchanged.Submodule identity and recovery —
wrap.py. The code treated a submodule name as its path. It also tried to add registered paths whose directories were missing. Find registrations by theirpathvalue. Refuse conflicting URLs before changing files. Initialize missing registered directories. Ask the submodule for its actual Git directory before embedding it. The named-submodule tests cover present and missing directories. They rungit statusinside the source andgit submodule statusfrom the wrapper. URL-conflict tests compare.gitmodulesbytes. A separate fixture proves worktree and symlink-root support. Reject source paths through symlinks before Git writes.Failure reports —
wrap.py. Initialization and Git errors omitted the state already left behind. Add context and recovery instructions without deleting files. The EOF test proves that the submodule remains and a rerun completes. The injected Git failure occurs after registration; its rerun succeeds. The unregistered-clone test proves that local work remains for inspection.Guidance ownership and escaping —
wrap.py. A marker prefix could overwrite an owner's file. Raw project names, source paths, origins, and upstreams could insert Markdown structure. Require the exact first marker line. Escape external text and line breaks. The marker test preserves an owner's bytes. Both renderer tests reject injected headings and HTML while checking the escaped text.Detection —
wrap_detection.py. Comments and string examples could select GradleRIO. Unrelated properties could select a Gradle version. Tokenize literal plugin declarations while skipping comments and keeping strings whole. Read Gradle versions only fromdistributionUrl. Tests cover comments, ordinary and multiline strings, Groovy slashy strings, commented declarations, unrelated properties, unsupported versions, and comments between real plugin tokens.Clarity and coverage. The table-order assertion could pass without checking anything. Replace it with an unconditional order assertion. Add TOML round trips for quoted paths and unknown nested fields. Add a JSON listing check that compares pending decisions before and after source declarations. Update the listing's documented row kinds. Correct the Java selection description to match the existing tested thresholds. The user page now identifies the JDK and session environment work as pending slice 2. Document failure recovery and exact marker ownership.
Considered and left alone, because
[sources]shape. Round-trip tests preserve explicitly empty tables, unknown fields, and quoted keys. The schema-1 test refuses[sources]by name.source_pathvalidation. Additional tests cover dot segments, repeated leading separators, NUL, and non-text values. Filesystem symlink checks belong inwrap.python-iderecommendation.Proposals not implemented
initialize_project, the runtime, and lock generation unchanged.Validation
All Python checks used
PYTEST_ADDOPTS="--basetemp=/opt/devcapsule-gate/pytest-codex -p no:cacheprovider"fromdevcapsule-src.test_sources.py,test_wrap_detection.py,test_wrap.py, andtest_owner_commands.py..venv/bin/python -m nox -s build: failed. Version checks, Python/shell syntax, and mypy passed. Mypy checked 271 files, including tests.wrap.pyreached 97% andwrap_detection.pyreached 92%.test_resolution_grants_no_consent_and_no_partial_save[project|checkout|run]failures match the brief's pre-existing failures. They were not changed.9af1fd12. That comparison reported 9 failed. The review's code was then restored;git diff --exit-codepassed.test_capability_minimums.py::test_offered_agent_still_needs_consent_and_can_be_omitted. It returned 0 where the test expected 3. It downloaded real Claude Code and Playwright artifacts in this capsule. I did not repeat that acquisition for a baseline or change this unrelated test.The nine additional failures reproduced against PR1 were:
The test failure stopped the build before CLI smoke, PEX build/smoke, packaging tests, and the web-console session. A separate
nox -s docs-contractskipped its check because the website submodule is not initialized. No full gate success is claimed.git diff --checkpassed.No workflow status, intake disposition, evidence file, or forbidden submodule pointer was changed. No image, capsule, or console smoke was run.