Skip to content

feat: add file conflict strategy increment#652

Open
ahochsteger wants to merge 3 commits intomainfrom
feat/increment-conflict-strategy
Open

feat: add file conflict strategy increment#652
ahochsteger wants to merge 3 commits intomainfrom
feat/increment-conflict-strategy

Conversation

@ahochsteger
Copy link
Copy Markdown
Owner

Description

Adds the conflict strategy increment, addressing issue #633.

When creating a file in Google Drive and a conflict occurs, the increment strategy automatically appends a number (e.g. (1)) to the filename until an available name is found.

Optional parameters were added to StoreActionBaseArgs for greater control over the increment logic:

  • incrementStart: The initial number to append (default: 1)
  • incrementPrefix: The string added before the increment counter (default: " (")
  • incrementSuffix: The string added after the increment counter (default: ")")

This allows for matching typical Windows naming (e.g., file (1).txt) or other custom conventions (e.g., file_2.txt).

Unit tests for the new conflict strategy and parameter variations have been added to GDriveAdapter.spec.ts. Documentation, JSON schemas, and examples have been regenerated.

Closes #633

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How has this been tested?

Added exhaustive unit tests to GDriveAdapter.spec.ts establishing correct invocation for the INCREMENT strategy including safety verifications enforcing no file modifications via DRY_RUN bounds.

Furthermore, built out a new dedicated E2E scenario evaluating increment behavior fully documented under docs/docs/examples generated by the test runner.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes

Credits & Transparency

  • Community Credit: I have credited community members who suggested or contributed to this change (e.g. using Co-authored-by commit trailers or referencing issues).
  • AI Assistance: I used AI to assist with this pull request (e.g., code generation, tests).
    • Implementation planning, code gen for implementation, tests and documentation.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request primarily focuses on code formatting improvements, minor refactoring, and updates to the pull request template and documentation. The reviewer identified that the logic for generating activeTestRunId is duplicated across multiple locations in src/lib/e2e/E2E.ts and recommends centralizing this into a static helper method. Additionally, the reviewer noted that the current test case for getUuid in src/lib/e2e/E2E.spec.ts is ineffective because it tests local logic rather than the production implementation, suggesting it should be updated once the refactoring is complete.

Comment on lines +370 to +377
const activeTestRunId =
testRunId ??
(ctx &&
ctx.env &&
ctx.env.utilities &&
typeof ctx.env.utilities.getUuid === "function"
? ctx.env.utilities.getUuid().substring(0, 8)
: Math.random().toString(36).substring(2, 8))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The logic for generating activeTestRunId is duplicated in multiple places within this file (lines 370-377, 484-491, and 510-517). This increases maintenance overhead and the risk of logic drift. Consider refactoring this into a static helper method, such as E2E.getTestRunId(ctx, testRunId), to centralize the tiered fallback logic (provided ID -> environment UUID -> random string).

Comment on lines +53 to +60
const activeTestRunId =
runId ??
(mockCtx &&
mockCtx.env &&
mockCtx.env.utilities &&
typeof mockCtx.env.utilities.getUuid === "function"
? mockCtx.env.utilities.getUuid().substring(0, 8)
: "test-id")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This test case for getUuid is currently testing a local implementation of the ID generation logic (a local variable assignment) rather than the actual production code. This makes the test ineffective as it doesn't verify the behavior of the E2E class. Once the ID generation logic is refactored into a reusable method in E2E.ts, this test should be updated to call that method and verify its output under various conditions (e.g., when testRunId is provided, when the environment provides a UUID, and when it falls back to a default/random value).

Co-authored-by: chrismazanek <chrismazanek@users.noreply.github.com>
AI-Assisted: true
AI-Tool: Antigravity
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 8, 2026

Coverage Report for CI Build 24152570323

Coverage decreased (-0.06%) to 92.795%

Details

  • Coverage decreased (-0.06%) from the base build.
  • Patch coverage: 20 uncovered changes across 2 files (134 of 154 lines covered, 87.01%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/lib/e2e/E2E.ts 54 38 70.37%
src/lib/adapter/GDriveAdapter.ts 62 58 93.55%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 9926
Covered Lines: 9275
Line Coverage: 93.44%
Relevant Branches: 1038
Covered Branches: 899
Branch Coverage: 86.61%
Branches in Coverage %: Yes
Coverage Strength: 144.3 hits per line

💛 - Coveralls

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 8, 2026

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.

Add 'increment' conflict strategy with sequential numbering

2 participants