Skip to content

MLE-22784 Using just a UUID as a temporary URI #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2025

Conversation

rjrudin
Copy link
Contributor

@rjrudin rjrudin commented Jul 16, 2025

Using "/temporary/(UUID)" resulted in the "/temporary" being retained if no URI modification option was provided.

Using "/temporary/(UUID)" resulted in the "/temporary" being retained if no URI modification option was provided.
@Copilot Copilot AI review requested due to automatic review settings July 16, 2025 17:28
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses an issue where temporary URIs were retaining the "/temporary" prefix when no URI modification option was provided. The fix changes the temporary URI generation from "/temporary/(UUID)" to just using the UUID directly.

  • Modified temporary URI generation to use only UUID instead of "/temporary/(UUID)" prefix
  • Added test coverage to verify URIs are UUIDs with .json extension and contain no forward slashes
  • Updated comments to explain the logic duplication with StandardUriMaker

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
ArbitraryRowConverter.java Changed temporary URI generation from "/temporary/(UUID)" to UUID only
AddEmbeddingsToJsonTest.java Added test to verify correct URI generation without URI modifier
Comments suppressed due to low confidence (1)

tests/src/test/java/com/marklogic/spark/writer/embedding/AddEmbeddingsToJsonTest.java:365

  • The test verifies that URIs don't contain forward slashes, but it doesn't validate that the URI is actually a valid UUID format. Consider adding a regex check or UUID.fromString() validation to ensure the URI is a properly formatted UUID.
            assertFalse(uri.contains("/"), message);

Comment on lines +111 to +113
// when constructing a DocumentWriteOperationImpl. This does duplicate a little bit of logic -
// StandardUriMaker assumes the same default value for a URI. That is acceptable, though, as a UUID is a very
// common way to generate a unique identifier.
Copy link
Preview

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

[nitpick] The comment mentions logic duplication but doesn't clearly explain why this duplication is acceptable or what the alternative would be. Consider clarifying the trade-offs or rationale more explicitly.

Suggested change
// when constructing a DocumentWriteOperationImpl. This does duplicate a little bit of logic -
// StandardUriMaker assumes the same default value for a URI. That is acceptable, though, as a UUID is a very
// common way to generate a unique identifier.
// when constructing a DocumentWriteOperationImpl. This logic duplicates the default URI generation
// approach used in StandardUriMaker, which also relies on a UUID. The duplication is intentional to
// ensure compatibility with the document pipeline and avoid introducing dependencies on StandardUriMaker
// in this class. Using a UUID is a widely accepted method for generating unique identifiers, and refactoring
// this logic would require changes to StandardUriMaker, which may not be desirable due to its broader usage.

Copilot uses AI. Check for mistakes.

Copy link

Quality Gate failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube

@rjrudin rjrudin merged commit 3eead34 into develop Jul 16, 2025
2 of 3 checks passed
@rjrudin rjrudin deleted the feature/temporary-uri-bug branch July 16, 2025 19:21
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