Skip to content

chore(ava): fix most test cases bug - #840

Merged
Yzing merged 1 commit into
v4from
dev/yanz/v4/07
Nov 5, 2025
Merged

chore(ava): fix most test cases bug#840
Yzing merged 1 commit into
v4from
dev/yanz/v4/07

Conversation

@Yzing

@Yzing Yzing commented Nov 5, 2025

Copy link
Copy Markdown

PR includes

  • fixed #0
  • fix most test cases bug
  • documents, demos

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Yzing, 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 and rectifies several issues within the data feature extraction and type analysis mechanisms of the ava library. The core changes involve a more unified approach to numerical type recommendations, better detection of boolean values, and adjustments to how graph-like data structures are inferred. These updates are reflected in the comprehensive modifications to the unit test suite, ensuring the robustness and accuracy of the data analysis functionalities.

Highlights

  • Refined Number Type Recommendation: Consolidated 'integer' and 'float' recommendations into a single 'number' type in data analysis, impacting how numerical data is categorized across various test cases.
  • Improved Boolean Type Detection: Enhanced the analyzeType function to explicitly identify boolean values, preventing them from being misclassified as strings.
  • Updated Test Suite: Modified numerous test cases in index.test.ts to align with the new type recommendation logic and improved data analysis features, including adjustments to distinct counts and types.length expectations.
  • Graph Data Structure Enhancements: Added 's' as a potential source field key in findBestSourceField for relation inference, and removed some explanatory comments in relation.ts.
  • Build Configuration Update: Included test files in the TypeScript compilation (tsconfig.json) and removed an obsolete ts-jest diagnostic setting from jest.config.js.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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

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.

Code Review

This pull request includes several useful fixes and refactorings, particularly in the test suite and DataStore implementation. The configuration changes for Jest and TypeScript are also positive improvements. However, I've identified two instances in __tests__/unit/extract/feature/index.test.ts where test expectations appear to have been updated to align with incorrect logic, potentially masking underlying bugs in data type analysis. My comments provide more detail on these specific cases.

const info = analyzeField(array) as StringColumnFeature;
expect(info.recommendation).toBe('string');
expect(info.recommendation).toBe('null');
expect(info.distinct).toBe(1);

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.

high

The expectation for distinct is incorrect here. For an array containing only null or nil values, the number of distinct values should be 0. The test now expects 1. This change seems to accommodate a bug in a utility function when it receives an empty array, which causes it to report one distinct value (undefined).

This test should assert that distinct is 0. The underlying issue in the utility function should be addressed separately.

Suggested change
expect(info.distinct).toBe(1);
expect(info.distinct).toBe(0);

expect(isInterval(analyzeField([1.1, 2]))).toBe(true);
expect(isNominal(analyzeField(['是', '否']))).toBe(true);
expect(isDiscrete(analyzeField([1, 2, 3, 4, 5, 6, 7]))).toBe(true);
expect(isNominal(analyzeField([1, 0, 1, 0, 1, 0, 1]))).toBe(false);

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.

high

This test expectation seems incorrect. The array [1, 0, 1, 0, 1, 0, 1] should be classified as boolean by analyzeField because it has only two distinct values (0 and 1), which is a special case for boolean types. The isNominal function returns true for fields with a boolean recommendation. Therefore, this test should expect true.

Suggested change
expect(isNominal(analyzeField([1, 0, 1, 0, 1, 0, 1]))).toBe(false);
expect(isNominal(analyzeField([1, 0, 1, 0, 1, 0, 1]))).toBe(true);

@Yzing
Yzing requested review from hustcc and leondt1 November 5, 2025 07:07
@Yzing
Yzing merged commit 615d884 into v4 Nov 5, 2025
1 check failed
@Yzing
Yzing deleted the dev/yanz/v4/07 branch November 5, 2025 07:24
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