Skip to content

Conversation

@tony
Copy link
Member

@tony tony commented Nov 2, 2025

Continuation of #481

Changes

Regression coverage: tests/cli(test[add]) for --no-merge data loss

why: Capture the originally reported duplicate-root regression in a focused test fixture.
what:

  • add parametrized fixture mirroring the user-provided .vcspull.yaml
  • assert ordered duplicate sections before and after vcspull add --no-merge

Loader enhancements: preserve ordered duplicate items

why: Writers need to replay duplicate workspace roots exactly as loaded.
what:

  • extend DuplicateAwareConfigReader to record top_level_items
  • propagate the expanded return signature through CLI/config callers

Writer helper: duplicate-safe YAML emission

why: save_config_yaml flattens duplicates; --no-merge paths must round-trip the original layout.
what:

  • introduce save_config_yaml_with_items
  • add dedicated writer test to ensure duplicates persist on disk

CLI fix: vcspull add --no-merge preserves duplicates

why: Avoid data loss when users opt out of automatic merging.
what:

  • reuse ordered items to target the correct duplicate section when inserting new repos
  • switch --no-merge writes to save_config_yaml_with_items
  • keep merged code path unchanged for default behaviour

Verification

  • uv run ruff check . --fix --show-fixes
  • uv run ruff format .
  • uv run mypy
  • uv run py.test

tony added 5 commits November 2, 2025 17:10
why: Document the duplicate-root data loss bug surfaced by vcspull add --no-merge.
what:
- add parametrized fixture mirroring the reported config layout to reproduce data loss
- mark the regression test xfail until the loader/writer preserve duplicate sections
why: Drive duplicate-preserving loader and writer work via failing tests and CLI regression coverage.
what:
- assert DuplicateAwareConfigReader exposes ordered top-level items
- add writer regression verifying duplicate sections persist on save
- extend CLI no-merge test expectations and discovery mocks for new loader API
why: Provide structured metadata so writers can replay duplicate workspace roots without loss.
what:
- extend DuplicateAwareConfigReader to capture ordered top-level items
- propagate new load_with_duplicates return signature through CLI/config callers
why: Finalize the regression to ensure vcspull add keeps duplicate workspace roots when --no-merge.
what:
- remove xfail and validate ordered items before and after the add operation
why:  should respect duplicate workspace roots instead of rewriting configs when users opt out of merging.
what:
- track ordered top-level items from the loader and aggregate them for duplicate-aware operations
- introduce duplicate-preserving YAML writer and invoke it for --no-merge updates
@codecov
Copy link

codecov bot commented Nov 2, 2025

Codecov Report

❌ Patch coverage is 79.66102% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.04%. Comparing base (34ed07b) to head (f75d438).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
src/vcspull/cli/add.py 71.87% 6 Missing and 3 partials ⚠️
src/vcspull/config.py 81.81% 0 Missing and 2 partials ⚠️
src/vcspull/_internal/config_reader.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #482      +/-   ##
==========================================
- Coverage   79.10%   79.04%   -0.06%     
==========================================
  Files          13       13              
  Lines        1737     1785      +48     
  Branches      369      381      +12     
==========================================
+ Hits         1374     1411      +37     
- Misses        229      235       +6     
- Partials      134      139       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

why: Surface the data-loss regression fix in the upcoming release notes.
what:
- add bug-fix entry under v1.45.x referencing PR #482
@tony tony merged commit f74ce8e into master Nov 3, 2025
9 checks passed
@tony tony deleted the vcspull-add-bug-pt-2 branch November 3, 2025 01:26
tony added a commit that referenced this pull request Nov 4, 2025
why: path-first workflow should not create stray ./ workspaces.
what:
- always prefer tilde labels unless CLI requests ./ explicitly
- write duplicate sections using ordered loader items without config_items
- expand CLI coverage for dot workspace scenarios

refs: #483, #482, #481, #480
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.

2 participants