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

Harmonize check on class name length #7175

Merged
merged 3 commits into from
Dec 6, 2023
Merged

Harmonize check on class name length #7175

merged 3 commits into from
Dec 6, 2023

Conversation

jedelbo
Copy link
Contributor

@jedelbo jedelbo commented Dec 1, 2023

What, How & Why?

Fixes #7177

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)
  • C-API, if public C++ API changed
  • bindgen/spec.yml, if public C++ API changed

Copy link

coveralls-official bot commented Dec 1, 2023

Pull Request Test Coverage Report for Build jorgen.edelbo_1

  • 2 of 2 (100.0%) changed or added relevant lines in 2 files are covered.
  • 64 unchanged lines in 13 files lost coverage.
  • Overall coverage remained the same at 91.689%

Files with Coverage Reduction New Missed Lines %
src/realm/index_string.cpp 1 87.81%
src/realm/object-store/sync/sync_manager.cpp 2 86.62%
src/realm/query_expression.cpp 3 87.01%
src/realm/sync/network/network.cpp 3 89.86%
src/realm/util/future.hpp 3 95.98%
test/test_util_network.cpp 3 97.2%
src/realm/sync/noinst/client_reset.cpp 4 92.96%
src/realm/util/assert.hpp 4 87.1%
src/realm/alloc_slab.cpp 5 92.89%
test/fuzz_group.cpp 6 47.95%
Totals Coverage Status
Change from base Build 1893: 0.0%
Covered Lines: 232008
Relevant Lines: 253039

💛 - Coveralls

Copy link
Contributor

@jbreams jbreams left a comment

Choose a reason for hiding this comment

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

I don't think this is actually what would make client reset crash, but the change looks fine to me and is certainly less confusing than subtracting six from a constant.

@jedelbo
Copy link
Contributor Author

jedelbo commented Dec 4, 2023

@jbreams do you think this PR is in such a good shape that you would be able to actually approve it? 😄

@jedelbo
Copy link
Contributor Author

jedelbo commented Dec 4, 2023

I hope you agree that the check actually was wrong before.

@jedelbo jedelbo requested a review from jbreams December 4, 2023 15:26
@@ -293,6 +296,7 @@ class Group : public ArrayParent {
using TableNameBuffer = std::array<char, max_table_name_length>;
static StringData class_name_to_table_name(StringData class_name, TableNameBuffer& buffer)
{
REALM_ASSERT(class_name.size() <= max_class_name_length);
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we add a similar assertion to table_name_to_class_name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think there would be a point in that. It just returns a substring.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, but table_name is not supposed to have more than 63 characters

CHANGELOG.md Outdated
@@ -8,6 +8,7 @@
### Fixed
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
* Update existing std exceptions thrown by the Sync Client to use Realm exceptions. ([#6255](https://github.com/realm/realm-core/issues/6255), since v10.2.0)
* Having a class name of length 57 would make client reset crash ([#7176](https://github.com/realm/realm-core/issues/7176), since v10.0.0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

is it that a class name of length 57 (63-6) should be allowed whereas before it was up to 56? I think this should be mentioned because it is not clear what this is fixing.

Copy link
Collaborator

@danieltabacaru danieltabacaru left a comment

Choose a reason for hiding this comment

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

LGTM mod minor changes

@jedelbo jedelbo merged commit fed5000 into master Dec 6, 2023
2 checks passed
@jedelbo jedelbo deleted the je/RCORE-1896 branch December 6, 2023 12:17
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Client reset imposes stricter character limits on table name
3 participants