Skip to content

Preserve legacy tag configurations - #34

Merged
Stardust0831 merged 2 commits into
mainfrom
fix/legacy-tag-limit-compatibility
Jul 20, 2026
Merged

Preserve legacy tag configurations#34
Stardust0831 merged 2 commits into
mainfrom
fix/legacy-tag-limit-compatibility

Conversation

@Stardust0831

@Stardust0831 Stardust0831 commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • allow existing oversized or overlong tags to survive unrelated connection edits
  • allow progressive tag cleanup without permitting new limit violations
  • cover connection drafts, settings preference saves, and storage batch updates

Validation

  • git diff --check
  • full Rust and platform validation delegated to GitHub Actions because the local workspace has no Rust toolchain

Summary by CodeRabbit

  • Bug Fixes
    • Editing connections with legacy tags that exceed current limits no longer fails as long as those tags stay unchanged.
    • Users can progressively remove legacy overlong or excessive tags without triggering validation errors.
    • Attempting to add new tags beyond current limits is still rejected.
    • Batch server preference updates now apply the same legacy-tag handling consistently (including allowing reduced tag lists while preventing re-addition past limits).

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c5fd472d-b17f-4ea7-a866-e439bc2df027

📥 Commits

Reviewing files that changed from the base of the PR and between 30b89a2 and 5fb782e.

📒 Files selected for processing (3)
  • crates/mountmate-app/src/main.rs
  • crates/mountmate-core/src/connection.rs
  • crates/mountmate-core/src/storage.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • crates/mountmate-app/src/main.rs
  • crates/mountmate-core/src/storage.rs
  • crates/mountmate-core/src/connection.rs

📝 Walkthrough

Walkthrough

Connection tag validation now compares edits with existing tags, preserving legacy over-limit values when unchanged while rejecting new violations. Application and batch storage paths use this behavior, with tests covering preservation, progressive cleanup, and rejected additions.

Changes

Legacy tag validation

Layer / File(s) Summary
Tag preservation and connection validation
crates/mountmate-core/src/model.rs, crates/mountmate-core/src/connection.rs
Adds tag_update_only_preserves_existing and extends connection validation to account for existing tags and folders, including legacy-limit test coverage.
Connection preference editing
crates/mountmate-app/src/main.rs
Validates edited connection tags against stored tags, preserving unchanged legacy overlong values while rejecting additional tags.
Batch preference validation
crates/mountmate-core/src/storage.rs
Normalizes incoming and existing tags before conditionally applying tag-count and character-length limits during batch updates, while reusing the validated server reference.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: preserving existing legacy tag configurations during edits.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/legacy-tag-limit-compatibility

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
crates/mountmate-core/src/storage.rs (1)

1137-1185: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Exercise the new preservation exception.

The reduction reaches the normal limit, so pre-PR validation would also pass. Start with at least MAX_CONNECTION_TAGS + 2 tags and reduce to MAX_CONNECTION_TAGS + 1; also cover an unchanged legacy overlong tag. This verifies storage actually permits preserve-only legacy states while rejecting additions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/mountmate-core/src/storage.rs` around lines 1137 - 1185, The test
batch_preferences_allow_progressive_cleanup_of_legacy_tag_limits currently only
exercises the normal MAX_CONNECTION_TAGS boundary. Initialize the server with at
least MAX_CONNECTION_TAGS + 2 tags, reduce it to MAX_CONNECTION_TAGS + 1, and
assert that an unchanged legacy overlong tag set is also accepted while any
further tag addition is rejected.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/mountmate-app/src/main.rs`:
- Around line 8355-8357: Update the Message::BatchAddTag handling to use
existing-aware validation via validated_connection_tags_for_existing when
selected servers’ tags remain unchanged, or skip those no-op updates. Preserve
validation for actual tag changes so legacy over-limit servers already
containing the tag do not reject valid updates for other servers.

---

Nitpick comments:
In `@crates/mountmate-core/src/storage.rs`:
- Around line 1137-1185: The test
batch_preferences_allow_progressive_cleanup_of_legacy_tag_limits currently only
exercises the normal MAX_CONNECTION_TAGS boundary. Initialize the server with at
least MAX_CONNECTION_TAGS + 2 tags, reduce it to MAX_CONNECTION_TAGS + 1, and
assert that an unchanged legacy overlong tag set is also accepted while any
further tag addition is rejected.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 587d20e0-835b-4638-a5a9-fc43b443d754

📥 Commits

Reviewing files that changed from the base of the PR and between a3b1921 and 30b89a2.

📒 Files selected for processing (4)
  • crates/mountmate-app/src/main.rs
  • crates/mountmate-core/src/connection.rs
  • crates/mountmate-core/src/model.rs
  • crates/mountmate-core/src/storage.rs

Comment on lines 8355 to +8357
fn validated_connection_tags(tags: &[String], locale: Locale) -> Result<Vec<String>, String> {
validated_connection_tags_for_existing(tags, None, locale)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Apply existing-aware validation to batch no-op updates.

Message::BatchAddTag still calls this strict wrapper at Line 2048 even when Lines 2044-2046 leave a selected server’s tags unchanged. A legacy-over-limit server that already has the chosen tag then rejects the entire batch, including valid changes for other selected servers. Use the existing-aware validator there (or omit no-op updates).

Proposed fix
- let tags = validated_connection_tags(&tags, locale)?;
+ let tags = validated_connection_tags_for_existing(
+     &tags,
+     Some(server.tags.as_slice()),
+     locale,
+ )?;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/mountmate-app/src/main.rs` around lines 8355 - 8357, Update the
Message::BatchAddTag handling to use existing-aware validation via
validated_connection_tags_for_existing when selected servers’ tags remain
unchanged, or skip those no-op updates. Preserve validation for actual tag
changes so legacy over-limit servers already containing the tag do not reject
valid updates for other servers.

@Stardust0831
Stardust0831 merged commit fa0c2bd into main Jul 20, 2026
8 checks passed
@Stardust0831
Stardust0831 deleted the fix/legacy-tag-limit-compatibility branch July 20, 2026 06:23
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