Skip to content
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

feat: 15.2.3 bug fix release #370

Merged
merged 7 commits into from
Nov 20, 2024
Merged

feat: 15.2.3 bug fix release #370

merged 7 commits into from
Nov 20, 2024

Conversation

aaronm-2112
Copy link
Member

@aaronm-2112 aaronm-2112 commented Nov 20, 2024

Summary by Sourcery

Release version 15.2.3 with bug fixes for forbidden characters in dataset names and improved save progress handling in Guided Mode.

Bug Fixes:

  • Restrict forbidden characters in Guided Mode datasets to prevent JSON save file issues.
  • Move guidedSaveProgress to trigger after every successful page exit for broader save coverage.

Enhancements:

  • Refactor the guidedSaveProgress function to improve code readability and maintainability.

Copy link

Thank you for submitting this pull request! We appreciate your contribution to the project. Before we can merge it, we need to review the changes you've made to ensure they align with our code standards and meet the requirements of the project. We'll get back to you as soon as we can with feedback. Thanks again!

Copy link
Contributor

sourcery-ai bot commented Nov 20, 2024

Reviewer's Guide by Sourcery

This PR implements bug fixes for version 15.2.3, focusing on two main areas: dataset name validation and guided mode progress saving. The changes improve the handling of forbidden characters in dataset names and enhance the reliability of progress saving in guided mode by consolidating the save logic and ensuring it's called after successful page transitions.

Sequence diagram for guidedSaveProgress invocation

sequenceDiagram
    participant User
    participant App
    participant guidedSaveProgress

    User->>App: Navigate to a new page
    App->>guidedSaveProgress: Call guidedSaveProgress()
    guidedSaveProgress-->>App: Save progress
    App-->>User: Page transition complete
Loading

Class diagram for dataset name validation

classDiagram
    class App {
        +evaluateStringAgainstSdsRequirements(stringToTest, stringCase)
    }
    class DatasetNameValidation {
        +check_forbidden_characters_ps(datasetNameInput)
        +evaluateStringAgainstSdsRequirements(datasetNameInput, "string-contains-forbidden-characters")
    }
    App <|-- DatasetNameValidation
    note for DatasetNameValidation "Updated to use evaluateStringAgainstSdsRequirements for forbidden character check"
Loading

File-Level Changes

Change Details Files
Improved dataset name validation with a new character restriction system
  • Added a new regex pattern for forbidden characters
  • Replaced direct character check with a new evaluation function
  • Updated error message to show complete list of forbidden characters
  • Added new test case for forbidden character validation
src/renderer/src/scripts/guided-mode/guided-curate-dataset.js
src/renderer/src/scripts/others/renderer.js
Refactored guided mode progress saving mechanism
  • Renamed saveGuidedProgress to guidedSaveProgress for clarity
  • Removed redundant progress saving calls
  • Added error handling for progress saving
  • Moved version checking logic to the progress saving function
  • Added user notification when SODA version changes
src/renderer/src/scripts/guided-mode/guided-curate-dataset.js
Version bump and cleanup
  • Updated version from 15.2.2 to 15.2.3
  • Added changelog entries for the bug fixes
  • Removed console.log statements from dataset import handling
CHANGELOG.md
package.json
package-lock.json
src/pyflask/startup/minimumApiVersion.py
src/renderer/src/scripts/organize-dataset/curate-functions.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

Thanks for making updates to your pull request. Our team will take a look and provide feedback as soon as possible. Please wait for any GitHub Actions to complete before editing your pull request. If you have any additional questions or concerns, feel free to let us know. Thank you for your contributions!

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @aaronm-2112 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -3000,9 +3006,14 @@ const guidedTransitionFromDatasetNameSubtitlePage = () => {
$("#guided-footer-div").css("display", "flex");
};

const saveGuidedProgress = async (guidedProgressFileName) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (complexity): Consider consolidating duplicate save operations and simplifying async flow patterns.

The code has accumulated unnecessary complexity that can be simplified while maintaining functionality:

  1. Consolidate duplicate save functions:
// Remove saveGuidedProgress and update guidedSaveProgress
const guidedSaveProgress = async () => {
  const fileName = window.sodaJSONObj?.["digital-metadata"]?.["name"];
  if (!fileName || typeof fileName !== "string" || !fileName.length) {
    return;
  }

  window.sodaJSONObj["last-modified"] = new Date();
  const currentVersion = document.getElementById("version").innerHTML;
  window.sodaJSONObj["last-version-of-soda-used"] = currentVersion;

  try {
    await window.fs.mkdir(guidedProgressFilePath, { recursive: true });
    await window.fs.writeFile(
      guidedFilePath, 
      JSON.stringify(window.sodaJSONObj, null, 2)
    );
  } catch (error) {
    window.log.error(error);
    throw error;
  }
};
  1. Remove unnecessary async conversion:
const guidedGetPageToReturnTo = (sodaJSONObj) => {
  const firstPageID = getNonSkippedGuidedModePages(document)[0].id;

  if (window.sodaJSONObj["previous-guided-upload-dataset-name"]) {
    return "guided-dataset-dissemination-tab";
  }

  const currentVersion = document.getElementById("version").innerHTML;
  if (window.sodaJSONObj["last-version-of-soda-used"] !== currentVersion) {
    // Show version change message where needed, e.g. in openPage
    return firstPageID;
  }

  return window.sodaJSONObj["page-before-exit"] || firstPageID;
};

These changes simplify the code by:

  • Eliminating duplicate save functions
  • Removing unnecessary async/await
  • Centralizing error handling
  • Making the code flow more linear and easier to follow

Copy link

sonarcloud bot commented Nov 20, 2024

@aaronm-2112 aaronm-2112 merged commit 79642c6 into main Nov 20, 2024
6 of 16 checks passed
Copy link

Thanks for closing this pull request! If you have any further questions, please feel free to open a new issue. We are always happy to help!

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