Fix PQ file path canonicalization and migrate legacy PQ files#3159
Fix PQ file path canonicalization and migrate legacy PQ files#3159lvca merged 1 commit intoArcadeData:mainfrom
Conversation
Summary of ChangesHello @tae898, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue where Product Quantization (PQ) files could be stored or accessed using non-canonical, shortened file paths, potentially leading to data loss or incorrect loading. The changes introduce a robust system to enforce canonical paths for all PQ file operations and include an automatic migration utility to relocate any existing legacy PQ files to their correct, canonical locations, ensuring data integrity and consistent behavior. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🧪 CI InsightsHere's what we observed from your CI run for b660669. 🟢 All jobs passed!But CI Insights is watching 👀 |
There was a problem hiding this comment.
Code Review
This pull request introduces a fix for Product Quantization (PQ) file path canonicalization and adds a migration path for legacy PQ files. The changes ensure that PQ files are consistently read from and written to a canonical path derived from the mutable component file path. A new private method, createPQFileWithFallback, handles the logic for finding and migrating legacy PQ files to their new canonical location. The implementation is solid, but I have a few suggestions to improve robustness and clarity in the new migration logic.
| final int dot = primaryBasePath.indexOf('.'); | ||
| if (dot > 0) { | ||
| legacyBasePath = primaryBasePath.substring(0, dot); | ||
| } |
There was a problem hiding this comment.
The current logic for deriving the legacy base path using primaryBasePath.indexOf('.') is fragile. It can fail if the database path itself contains a dot (e.g., /path/to/db.v1/). A more robust approach would be to find the dot within the filename part of the path, after the last file separator.
| final int dot = primaryBasePath.indexOf('.'); | |
| if (dot > 0) { | |
| legacyBasePath = primaryBasePath.substring(0, dot); | |
| } | |
| final int lastSeparator = primaryBasePath.lastIndexOf(File.separator); | |
| final int dot = primaryBasePath.indexOf('.', lastSeparator > -1 ? lastSeparator + 1 : 0); | |
| if (dot > -1) { | |
| legacyBasePath = primaryBasePath.substring(0, dot); | |
| } |
| if (targetParent != null && !Files.exists(targetParent)) { | ||
| Files.createDirectories(targetParent); | ||
| } | ||
| Files.move(legacyPQ.getFilePath(), pq.getFilePath(), StandardCopyOption.REPLACE_EXISTING); |
There was a problem hiding this comment.
The code checks if the canonical PQ file exists with !pq.exists() before attempting to move the legacy file. Therefore, using StandardCopyOption.REPLACE_EXISTING is redundant and could mask a potential race condition. Removing it would allow Files.move to fail with a FileAlreadyExistsException if the file is created concurrently, which would provide a clearer signal of an underlying issue.
| Files.move(legacyPQ.getFilePath(), pq.getFilePath(), StandardCopyOption.REPLACE_EXISTING); | |
| Files.move(legacyPQ.getFilePath(), pq.getFilePath()); |
| Files.move(legacyPQ.getFilePath(), pq.getFilePath(), StandardCopyOption.REPLACE_EXISTING); | ||
| LogManager.instance().log(this, Level.INFO, | ||
| "Migrated PQ file from legacy path %s to canonical %s", legacyPQ.getFilePath(), pq.getFilePath()); | ||
| } catch (final Exception e) { |
There was a problem hiding this comment.
Catching the generic Exception is too broad and can hide RuntimeExceptions that might indicate bugs. It's better practice to catch more specific exceptions related to file operations, such as IOException and SecurityException, to make the error handling more precise and intentional.
| } catch (final Exception e) { | |
| } catch (final IOException | SecurityException e) { |
|
could you take a look at this? thanks! |
Bumps `cucumber.version` from 7.22.1 to 7.34.2. Updates `io.cucumber:cucumber-java` from 7.22.1 to 7.34.2 Release notes *Sourced from [io.cucumber:cucumber-java's releases](https://github.com/cucumber/cucumber-jvm/releases).* > v7.34.2 > ------- > > ### Fixed > > * [Core] Reverted: Early filtering of anonymous classes for glue ([#3158](https://redirect.github.com/cucumber/cucumber-jvm/pull/3158)) > > v7.34.1 > ------- > > ### Fixed > > * Ensure dependencies converge ([#3157](https://redirect.github.com/cucumber/cucumber-jvm/issues/3157) > > v7.34.0 > ------- > > ### Added > > * [Core] Hide successful hooks by default in HTML report ([cucumber/react-components#415](https://redirect.github.com/cucumber/react-components/pull/415)) > * [Java] Support Provider instances with Pico Container ([#2879](https://redirect.github.com/cucumber/cucumber-jvm/issues/2879), [#3128](https://redirect.github.com/cucumber/cucumber-jvm/pull/3128) Stefan Gasterstädt) > * [Java] Add Step info to `@BeforeStep` and `@AfterStep` hooks ([#3139](https://redirect.github.com/cucumber/cucumber-jvm/pull/3139), Menelaos Mamouzellos) > > ### Changed > > * [Core] Refactor internals to use [messages-ndjson](https://github.com/cucumber/messages-ndjson) for serialization ([#3138](https://redirect.github.com/cucumber/cucumber-jvm/pull/3138)) > * [Core] Early filtering of anonymous classes for glue ([#3150](https://redirect.github.com/cucumber/cucumber-jvm/pull/3150), Julien Kronegg) > > ### Fixed > > * [Core] Ignore all potential class loading issues ([#3135](https://redirect.github.com/cucumber/cucumber-jvm/pull/3135), Christoph Läubrich) > > v7.33.0 > ------- > > ### Added > > * [Java] Add `Scenario.getLanguage()` to return the current language ([#3124](https://redirect.github.com/cucumber/cucumber-jvm/pull/3124) Stefan Gasterstädt) > > ### Changed > > * [Core] Upload Cucumber Reports with Gzip encoding ([#3115](https://redirect.github.com/cucumber/cucumber-jvm/pull/3115)) > * [Core] Render the empty tag expression as an empty string ([#222](https://redirect.github.com/cucumber/tag-expressions/pull/222)) > * [Core] Update dependency io.cucumber:html-formatter to v22.2.0 > * [Core] Update dependency io.cucumber:tag-expressions to v8.1.0 > * [Core] Update dependency io.cucumber:cucumber-json-formatter to v0.3.2 > > ### Fixed > > * [Core] Improve error message for missing operands in tag expressions ([#221](https://redirect.github.com/cucumber/tag-expressions/pull/221)) > * [Core] Include empty scenarios and backgrounds in json report ([#34](https://redirect.github.com/cucumber/cucumber-json-formatter/pull/34)) > > v7.32.0 > ------- > > ### Changed > > * [Core] Update dependency io.cucumber:gherkin to v36.1.0 > * [Core] Update dependency io.cucumber:html-formatter to v22.1.0 > * [Core] Update dependency io.cucumber:junit-xml-formatter to v0.11.0 > * [Core] Update dependency io.cucumber:pretty-formatter to v2.4.1 > > ### Fixed > > * [Core] Add OS version to `Meta` message ([#3108](https://redirect.github.com/cucumber/cucumber-jvm/pull/3108)) > * [Core] Fix interpolated data tables and doc string arguments in Json report ([#29](https://redirect.github.com/cucumber/cucumber-json-formatter/pull/29)) > > v7.31.0 > ------- > > ### Added > > * [Core] Add a `UsageJsonFormatter`, use with `--plugin usage-json` ([#3086](https://redirect.github.com/cucumber/cucumber-jvm/pull/3086) M.P. Korstanje) ... (truncated) Changelog *Sourced from [io.cucumber:cucumber-java's changelog](https://github.com/cucumber/cucumber-jvm/blob/main/CHANGELOG.md).* > [7.34.2] - 2026-01-29 > --------------------- > > ### Fixed > > * [Core] Reverted: Early filtering of anonymous classes for glue ([#3158](https://redirect.github.com/cucumber/cucumber-jvm/pull/3158)) > > [7.34.1] - 2026-01-28 > --------------------- > > ### Fixed > > * Ensure dependencies converge ([#3157](https://redirect.github.com/cucumber/cucumber-jvm/issues/3157) > > [7.34.0] - 2026-01-28 > --------------------- > > ### Added > > * [Core] Hide successful hooks by default in HTML report ([cucumber/react-components#415](https://redirect.github.com/cucumber/react-components/pull/415)) > * [Java] Support Provider instances with Pico Container ([#2879](https://redirect.github.com/cucumber/cucumber-jvm/issues/2879), [#3128](https://redirect.github.com/cucumber/cucumber-jvm/pull/3128) Stefan Gasterstädt) > * [Java] Add Step info to `@BeforeStep` and `@AfterStep` hooks ([#3139](https://redirect.github.com/cucumber/cucumber-jvm/pull/3139), Menelaos Mamouzellos) > > ### Changed > > * [Core] Refactor internals to use [messages-ndjson](https://github.com/cucumber/messages-ndjson) for serialization ([#3138](https://redirect.github.com/cucumber/cucumber-jvm/pull/3138)) > * [Core] Early filtering of anonymous classes for glue ([#3150](https://redirect.github.com/cucumber/cucumber-jvm/pull/3150), Julien Kronegg) > > ### Fixed > > * [Core] Ignore all potential class loading issues ([#3135](https://redirect.github.com/cucumber/cucumber-jvm/pull/3135), Christoph Läubrich) > > [7.33.0] - 2025-12-09 > --------------------- > > ### Added > > * [Java] Add `Scenario.getLanguage()` to return the current language ([#3124](https://redirect.github.com/cucumber/cucumber-jvm/pull/3124) Stefan Gasterstädt) > > ### Changed > > * [Core] Upload Cucumber Reports with Gzip encoding ([#3115](https://redirect.github.com/cucumber/cucumber-jvm/pull/3115)) > * [Core] Render the empty tag expression as an empty string ([#222](https://redirect.github.com/cucumber/tag-expressions/pull/222)) > * [Core] Update dependency io.cucumber:html-formatter to v22.2.0 > * [Core] Update dependency io.cucumber:tag-expressions to v8.1.0 > * [Core] Update dependency io.cucumber:cucumber-json-formatter to v0.3.2 > > ### Fixed > > * [Core] Improve error message for missing operands in tag expressions ([#221](https://redirect.github.com/cucumber/tag-expressions/pull/221)) > * [Core] Include empty scenarios and backgrounds in json report ([#34](https://redirect.github.com/cucumber/cucumber-json-formatter/pull/34)) > > [7.32.0] - 2025-11-21 > --------------------- > > ### Changed > > * [Core] Update dependency io.cucumber:gherkin to v36.1.0 > * [Core] Update dependency io.cucumber:html-formatter to v22.1.0 > * [Core] Update dependency io.cucumber:junit-xml-formatter to v0.11.0 > * [Core] Update dependency io.cucumber:pretty-formatter to v2.4.1 > > ### Fixed > > * [Core] Add OS version to `Meta` message ([#3108](https://redirect.github.com/cucumber/cucumber-jvm/pull/3108)) > * [Core] Fix interpolated data tables and doc string arguments in Json report ([#29](https://redirect.github.com/cucumber/cucumber-json-formatter/pull/29)) > > [7.31.0] - 2025-10-27 > --------------------- > > ### Added > > * [Core] Add a `UsageJsonFormatter`, use with `--plugin usage-json` ([#3086](https://redirect.github.com/cucumber/cucumber-jvm/pull/3086) M.P. Korstanje) ... (truncated) Commits * [`b5292ab`](cucumber/cucumber-jvm@b5292ab) Prepare release v7.34.2 * [`3f97272`](cucumber/cucumber-jvm@3f97272) Revert "Avoid scanning anonymous classes ([#3150](https://redirect.github.com/cucumber/cucumber-jvm/issues/3150))" ([#3158](https://redirect.github.com/cucumber/cucumber-jvm/issues/3158)) * [`26a7afa`](cucumber/cucumber-jvm@26a7afa) Update Revapi supressions ([#3159](https://redirect.github.com/cucumber/cucumber-jvm/issues/3159)) * [`2a1a3d6`](cucumber/cucumber-jvm@2a1a3d6) Prepare for the next development iteration * [`88372a3`](cucumber/cucumber-jvm@88372a3) Prepare release v7.34.1 * [`142b589`](cucumber/cucumber-jvm@142b589) Ensure dependencies converge pt2 * [`9e77642`](cucumber/cucumber-jvm@9e77642) Ensure dependencies converge * [`4d9dd93`](cucumber/cucumber-jvm@4d9dd93) Prepare for the next development iteration * [`d16903c`](cucumber/cucumber-jvm@d16903c) Prepare release v7.34.0 * [`7948150`](cucumber/cucumber-jvm@7948150) Update CHANGELOG * Additional commits viewable in [compare view](cucumber/cucumber-jvm@v7.22.1...v7.34.2) Updates `io.cucumber:cucumber-junit-platform-engine` from 7.22.1 to 7.34.2 Release notes *Sourced from [io.cucumber:cucumber-junit-platform-engine's releases](https://github.com/cucumber/cucumber-jvm/releases).* > v7.34.2 > ------- > > ### Fixed > > * [Core] Reverted: Early filtering of anonymous classes for glue ([#3158](https://redirect.github.com/cucumber/cucumber-jvm/pull/3158)) > > v7.34.1 > ------- > > ### Fixed > > * Ensure dependencies converge ([#3157](https://redirect.github.com/cucumber/cucumber-jvm/issues/3157) > > v7.34.0 > ------- > > ### Added > > * [Core] Hide successful hooks by default in HTML report ([cucumber/react-components#415](https://redirect.github.com/cucumber/react-components/pull/415)) > * [Java] Support Provider instances with Pico Container ([#2879](https://redirect.github.com/cucumber/cucumber-jvm/issues/2879), [#3128](https://redirect.github.com/cucumber/cucumber-jvm/pull/3128) Stefan Gasterstädt) > * [Java] Add Step info to `@BeforeStep` and `@AfterStep` hooks ([#3139](https://redirect.github.com/cucumber/cucumber-jvm/pull/3139), Menelaos Mamouzellos) > > ### Changed > > * [Core] Refactor internals to use [messages-ndjson](https://github.com/cucumber/messages-ndjson) for serialization ([#3138](https://redirect.github.com/cucumber/cucumber-jvm/pull/3138)) > * [Core] Early filtering of anonymous classes for glue ([#3150](https://redirect.github.com/cucumber/cucumber-jvm/pull/3150), Julien Kronegg) > > ### Fixed > > * [Core] Ignore all potential class loading issues ([#3135](https://redirect.github.com/cucumber/cucumber-jvm/pull/3135), Christoph Läubrich) > > v7.33.0 > ------- > > ### Added > > * [Java] Add `Scenario.getLanguage()` to return the current language ([#3124](https://redirect.github.com/cucumber/cucumber-jvm/pull/3124) Stefan Gasterstädt) > > ### Changed > > * [Core] Upload Cucumber Reports with Gzip encoding ([#3115](https://redirect.github.com/cucumber/cucumber-jvm/pull/3115)) > * [Core] Render the empty tag expression as an empty string ([#222](https://redirect.github.com/cucumber/tag-expressions/pull/222)) > * [Core] Update dependency io.cucumber:html-formatter to v22.2.0 > * [Core] Update dependency io.cucumber:tag-expressions to v8.1.0 > * [Core] Update dependency io.cucumber:cucumber-json-formatter to v0.3.2 > > ### Fixed > > * [Core] Improve error message for missing operands in tag expressions ([#221](https://redirect.github.com/cucumber/tag-expressions/pull/221)) > * [Core] Include empty scenarios and backgrounds in json report ([#34](https://redirect.github.com/cucumber/cucumber-json-formatter/pull/34)) > > v7.32.0 > ------- > > ### Changed > > * [Core] Update dependency io.cucumber:gherkin to v36.1.0 > * [Core] Update dependency io.cucumber:html-formatter to v22.1.0 > * [Core] Update dependency io.cucumber:junit-xml-formatter to v0.11.0 > * [Core] Update dependency io.cucumber:pretty-formatter to v2.4.1 > > ### Fixed > > * [Core] Add OS version to `Meta` message ([#3108](https://redirect.github.com/cucumber/cucumber-jvm/pull/3108)) > * [Core] Fix interpolated data tables and doc string arguments in Json report ([#29](https://redirect.github.com/cucumber/cucumber-json-formatter/pull/29)) > > v7.31.0 > ------- > > ### Added > > * [Core] Add a `UsageJsonFormatter`, use with `--plugin usage-json` ([#3086](https://redirect.github.com/cucumber/cucumber-jvm/pull/3086) M.P. Korstanje) ... (truncated) Changelog *Sourced from [io.cucumber:cucumber-junit-platform-engine's changelog](https://github.com/cucumber/cucumber-jvm/blob/main/CHANGELOG.md).* > [7.34.2] - 2026-01-29 > --------------------- > > ### Fixed > > * [Core] Reverted: Early filtering of anonymous classes for glue ([#3158](https://redirect.github.com/cucumber/cucumber-jvm/pull/3158)) > > [7.34.1] - 2026-01-28 > --------------------- > > ### Fixed > > * Ensure dependencies converge ([#3157](https://redirect.github.com/cucumber/cucumber-jvm/issues/3157) > > [7.34.0] - 2026-01-28 > --------------------- > > ### Added > > * [Core] Hide successful hooks by default in HTML report ([cucumber/react-components#415](https://redirect.github.com/cucumber/react-components/pull/415)) > * [Java] Support Provider instances with Pico Container ([#2879](https://redirect.github.com/cucumber/cucumber-jvm/issues/2879), [#3128](https://redirect.github.com/cucumber/cucumber-jvm/pull/3128) Stefan Gasterstädt) > * [Java] Add Step info to `@BeforeStep` and `@AfterStep` hooks ([#3139](https://redirect.github.com/cucumber/cucumber-jvm/pull/3139), Menelaos Mamouzellos) > > ### Changed > > * [Core] Refactor internals to use [messages-ndjson](https://github.com/cucumber/messages-ndjson) for serialization ([#3138](https://redirect.github.com/cucumber/cucumber-jvm/pull/3138)) > * [Core] Early filtering of anonymous classes for glue ([#3150](https://redirect.github.com/cucumber/cucumber-jvm/pull/3150), Julien Kronegg) > > ### Fixed > > * [Core] Ignore all potential class loading issues ([#3135](https://redirect.github.com/cucumber/cucumber-jvm/pull/3135), Christoph Läubrich) > > [7.33.0] - 2025-12-09 > --------------------- > > ### Added > > * [Java] Add `Scenario.getLanguage()` to return the current language ([#3124](https://redirect.github.com/cucumber/cucumber-jvm/pull/3124) Stefan Gasterstädt) > > ### Changed > > * [Core] Upload Cucumber Reports with Gzip encoding ([#3115](https://redirect.github.com/cucumber/cucumber-jvm/pull/3115)) > * [Core] Render the empty tag expression as an empty string ([#222](https://redirect.github.com/cucumber/tag-expressions/pull/222)) > * [Core] Update dependency io.cucumber:html-formatter to v22.2.0 > * [Core] Update dependency io.cucumber:tag-expressions to v8.1.0 > * [Core] Update dependency io.cucumber:cucumber-json-formatter to v0.3.2 > > ### Fixed > > * [Core] Improve error message for missing operands in tag expressions ([#221](https://redirect.github.com/cucumber/tag-expressions/pull/221)) > * [Core] Include empty scenarios and backgrounds in json report ([#34](https://redirect.github.com/cucumber/cucumber-json-formatter/pull/34)) > > [7.32.0] - 2025-11-21 > --------------------- > > ### Changed > > * [Core] Update dependency io.cucumber:gherkin to v36.1.0 > * [Core] Update dependency io.cucumber:html-formatter to v22.1.0 > * [Core] Update dependency io.cucumber:junit-xml-formatter to v0.11.0 > * [Core] Update dependency io.cucumber:pretty-formatter to v2.4.1 > > ### Fixed > > * [Core] Add OS version to `Meta` message ([#3108](https://redirect.github.com/cucumber/cucumber-jvm/pull/3108)) > * [Core] Fix interpolated data tables and doc string arguments in Json report ([#29](https://redirect.github.com/cucumber/cucumber-json-formatter/pull/29)) > > [7.31.0] - 2025-10-27 > --------------------- > > ### Added > > * [Core] Add a `UsageJsonFormatter`, use with `--plugin usage-json` ([#3086](https://redirect.github.com/cucumber/cucumber-jvm/pull/3086) M.P. Korstanje) ... (truncated) Commits * [`b5292ab`](cucumber/cucumber-jvm@b5292ab) Prepare release v7.34.2 * [`3f97272`](cucumber/cucumber-jvm@3f97272) Revert "Avoid scanning anonymous classes ([#3150](https://redirect.github.com/cucumber/cucumber-jvm/issues/3150))" ([#3158](https://redirect.github.com/cucumber/cucumber-jvm/issues/3158)) * [`26a7afa`](cucumber/cucumber-jvm@26a7afa) Update Revapi supressions ([#3159](https://redirect.github.com/cucumber/cucumber-jvm/issues/3159)) * [`2a1a3d6`](cucumber/cucumber-jvm@2a1a3d6) Prepare for the next development iteration * [`88372a3`](cucumber/cucumber-jvm@88372a3) Prepare release v7.34.1 * [`142b589`](cucumber/cucumber-jvm@142b589) Ensure dependencies converge pt2 * [`9e77642`](cucumber/cucumber-jvm@9e77642) Ensure dependencies converge * [`4d9dd93`](cucumber/cucumber-jvm@4d9dd93) Prepare for the next development iteration * [`d16903c`](cucumber/cucumber-jvm@d16903c) Prepare release v7.34.0 * [`7948150`](cucumber/cucumber-jvm@7948150) Update CHANGELOG * Additional commits viewable in [compare view](cucumber/cucumber-jvm@v7.22.1...v7.34.2) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
(cherry picked from commit 5a7a2c8)
Problem
PQ files could be written/read using shortened base paths, leaving legacy PQ artifacts in non-canonical locations and risking missing PQ data on load. Issue (#3161)
Changes
Testing