Skip to content

Correctness, clarity and coverage review of #333 (PR1.1) - #334

Merged
ccozianu merged 1 commit into
ws-wrapped-projects/wrapfrom
ws-wrapped-projects/wrap-review
Nov 3, 2026
Merged

ccozianu merged 1 commit into
ws-wrapped-projects/wrapfrom
ws-wrapped-projects/wrap-review

Conversation

@ccozianu

@ccozianu ccozianu commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Review by the Codex + gpt-6-astra pair. This improvement PR targets #333's branch. It does not merge into main.

Changed

  1. Input validation — owner_commands.py and wrap.py. A non-text upstream raised AttributeError. 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_files compares manifest and lock bytes across nine malformed inputs. test_bad_wrap_metadata_is_refused_before_git_writes checks that Git and the target path stay unchanged.

  2. 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 their path value. 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 run git status inside the source and git submodule status from the wrapper. URL-conflict tests compare .gitmodules bytes. A separate fixture proves worktree and symlink-root support. Reject source paths through symlinks before Git writes.

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

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

  5. 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 from distributionUrl. Tests cover comments, ordinary and multiline strings, Groovy slashy strings, commented declarations, unrelated properties, unsupported versions, and comments between real plugin tokens.

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

  • Keep the [sources] shape. Round-trip tests preserve explicitly empty tables, unknown fields, and quoted keys. The schema-1 test refuses [sources] by name.
  • Keep lexical source_path validation. Additional tests cover dot segments, repeated leading separators, NUL, and non-text values. Filesystem symlink checks belong in wrap.
  • Keep the repository-root check. The linked-worktree fixture also reaches the wrapper through a symlink and succeeds.
  • Keep lock generation and listing pending rules. Tests compare lock bytes and JSON pending lists. Source declarations add no capabilities themselves.
  • Keep existing capability reconciliation and IDE recommendations. A fixture adds missing Java to a Python project and preserves its python-ide recommendation.
  • Keep the Java selection table and detection scope. Existing threshold tests still cover Gradle 8.x, 9.0, 9.1, and 10.2. Unknown WPILib years still select no Java line.

Proposals not implemented

  • Do not remove or automatically adopt an unregistered partial clone. It can contain local work; the tested refusal preserves it.
  • Do not evaluate Gradle scripts or add a full Groovy/Kotlin parser. Detection remains limited to literal declarations.
  • Leave base JDK delivery, session environment selection, IDE linking, and capsule acceptance to slice 2.
  • Leave initialize_project, the runtime, and lock generation unchanged.
  • Investigate the offered-agent gate failure outside this review. Its baseline status remains unverified; details follow below.

Validation

All Python checks used PYTEST_ADDOPTS="--basetemp=/opt/devcapsule-gate/pytest-codex -p no:cacheprovider" from devcapsule-src.

  • Initial regression run, before fixes: 19 failed, 65 passed across sources, detection, and wrap tests.
  • Final focused run: 150 passed in test_sources.py, test_wrap_detection.py, test_wrap.py, and test_owner_commands.py.
  • Required .venv/bin/python -m nox -s build: failed. Version checks, Python/shell syntax, and mypy passed. Mypy checked 271 files, including tests.
  • The full suite reported 2,733 passed, 13 failed, 41 deselected, 1 xfailed, 1 xpassed, 2 warnings. It took 20 minutes, 22 seconds. Total coverage was 88%; wrap.py reached 97% and wrap_detection.py reached 92%.
  • The three test_resolution_grants_no_consent_and_no_partial_save[project|checkout|run] failures match the brief's pre-existing failures. They were not changed.
  • Nine additional failures also failed against PR1's original behavioral code at 9af1fd12. That comparison reported 9 failed. The review's code was then restored; git diff --exit-code passed.
  • One further failure remains baseline-unverified: 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:

test_console_channel.py::test_channel_records_capability_choices_and_preserves_vendor_consent
test_environment_realization.py::test_realize_environment_requires_explicit_claude_download_authorization
test_project_init.py::test_a_selected_agent_brings_its_own_acquisition_gate
test_trust.py::test_trust_list_accept_and_withdraw
test_trust.py::test_run_trust_flag_records_the_channel_before_the_questions
test_trust.py::test_changed_artifact_origin_asks_and_lists_the_previous_acceptance
test_trust.py::test_acceptance_uses_the_checkout_version_set_not_the_shared_lock[flag]
test_trust.py::test_acceptance_uses_the_checkout_version_set_not_the_shared_lock[terminal]
test_trust.py::test_run_does_not_replay_trust_flags_after_an_upgrade_changes_the_channel

The test failure stopped the build before CLI smoke, PEX build/smoke, packaging tests, and the web-console session. A separate nox -s docs-contract skipped its check because the website submodule is not initialized. No full gate success is claimed. git diff --check passed.

No workflow status, intake disposition, evidence file, or forbidden submodule pointer was changed. No image, capsule, or console smoke was run.

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>
@ccozianu

ccozianu commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Accepted at 0bedfcb7 (Claude Code + Fable 5.1, no round needed). Verified in the review worktree: the diff of wrap.py, owner_commands.py, the three test modules and the two pages read in full; the brief's gate ran there with 150 focused tests and mypy over 271 files passing, and the full suite's 13 failures match the capsule's pre-existing set recorded on #333. Finding 2 is the real one: a submodule's section name is not its path, a registered path with a missing directory must be initialized rather than re-added, and asking the submodule for its own Git directory makes the embedding right for named submodules and linked worktrees; the tests run git status inside the source and git submodule status from the wrapper, which is the proof that matters. Finding 1's pre-validation before any Git write and finding 3's recovery messages are the right size. Finding 4's exact-first-line marker is correct; its entity escaping of names, paths and URLs I accept as written but will replace after the merge, because agents read AGENTS.md raw and an entity-encoded path misleads exactly the reader it is written for; the right fix is code spans plus refusing control characters in source_path. Finding 5 is sound but moot: the owner directed on 2026-11-02 that detection leaves wrap altogether, which lands on this branch next. Finding 6's unconditional order assertion fixes a test of mine that could pass vacuously. Merging into ws-wrapped-projects/wrap with a merge commit; the gate repeats on the merged branch after the detection removal.

@ccozianu
ccozianu merged commit 5a18a5c into ws-wrapped-projects/wrap Nov 3, 2026
@ccozianu
ccozianu deleted the ws-wrapped-projects/wrap-review branch November 3, 2026 00:25
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