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

Deprecate legacy items #1141

Merged
merged 4 commits into from
Dec 11, 2024
Merged

Conversation

wprzytula
Copy link
Collaborator

The following items are now marked as deprecated:

Serialization:

  • scylla::impl_serialize_value_via_value
  • scylla::impl_serialize_row_via_value_list
  • scylla::ValueList
  • scylla::serialize::batch::LegacyBatchValuesAdapter
  • scylla::serialize::batch::LegacyBatchValuesIteratorAdapter
  • scylla::serialize::row::ValueListAdapter
  • scylla::serialize::row::ValueListToSerializeRowAdapterError
  • scylla::serialize::row::serialize_legacy_row
  • scylla::serialize::value::ValueAdapter
  • scylla::serialize::value::ValueToSerializeValueAdapterError
  • scylla::serialize::value::serialize_legacy_value
  • scylla_cql::frame::value::LegacyBatchValues
  • scylla_cql::frame::value::LegacyBatchValuesFirstSerialized
  • scylla_cql::frame::value::LegacyBatchValuesIterator
  • scylla_cql::frame::value::LegacyBatchValuesFromIter
  • scylla_cql::frame::value::LegacyBatchValuesIteratorFromIterator
  • scylla_cql::frame::value::TupleValuesIter
  • scylla_cql::frame::value::Value

Deserialization:

  • scylla::impl_from_cql_value_from_method
  • scylla::transport::iterator::LegacyNextRowError
  • scylla::transport::legacy_query_result::IntoLegacyQueryResultError
  • scylla::transport::legacy_query_result::MaybeFirstRowTypedError
  • scylla::transport::legacy_query_result::RowsExpectedError
  • scylla::transport::legacy_query_result::SingleRowError
  • scylla::transport::legacy_query_result::IntoTypedRows
  • scylla::transport::legacy_query_result::TypedRowIter
  • scylla_cql::cql_to_rust::FromCqlValError
  • scylla_cql::cql_to_rust::FromRowError

Fixes: #1139

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • [ ] I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • [ ] I have provided docstrings for the public items that I want to introduce.
  • [ ] I have adjusted the documentation in ./docs/source/.
  • I added appropriate Fixes: annotations to PR description.

@wprzytula wprzytula self-assigned this Dec 6, 2024
@wprzytula wprzytula added the API-stability Part of the effort to stabilize the API label Dec 6, 2024
@wprzytula wprzytula added this to the 0.15.1 milestone Dec 6, 2024
@github-actions github-actions bot added the semver-checks-breaking cargo-semver-checks reports that this PR introduces breaking API changes label Dec 6, 2024
Copy link

github-actions bot commented Dec 6, 2024

cargo semver-checks detected some API incompatibilities in this PR.
Checked commit: c136255

See the following report for details:

cargo semver-checks output
./scripts/semver-checks.sh --baseline-rev 7710af03ef7e7367627375043959b39924d7c5a4
+ cargo semver-checks -p scylla -p scylla-cql --baseline-rev 7710af03ef7e7367627375043959b39924d7c5a4
     Cloning 7710af03ef7e7367627375043959b39924d7c5a4
    Building scylla v0.15.0 (current)
       Built [  23.753s] (current)
     Parsing scylla v0.15.0 (current)
      Parsed [   0.055s] (current)
    Building scylla v0.15.0 (baseline)
       Built [  22.301s] (baseline)
     Parsing scylla v0.15.0 (baseline)
      Parsed [   0.053s] (baseline)
    Checking scylla v0.15.0 -> v0.15.0 (no change)
     Checked [   0.117s] 95 checks: 94 pass, 1 fail, 0 warn, 0 skip

--- failure type_marked_deprecated: #[deprecated] added on type ---

Description:
A type is now #[deprecated]. Downstream crates will get a compiler warning when using this type.
        ref: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.37.0/src/lints/type_marked_deprecated.ron

Failed in:
  Enum LegacyNextRowError in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla/src/transport/iterator.rs:1162
  Enum SingleRowTypedError in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla/src/transport/legacy_query_result.rs:324
  Enum IntoLegacyQueryResultError in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla/src/transport/legacy_query_result.rs:203
  Enum MaybeFirstRowTypedError in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla/src/transport/legacy_query_result.rs:286
  Enum SingleRowError in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla/src/transport/legacy_query_result.rs:305
  Struct RowsExpectedError in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla/src/transport/legacy_query_result.rs:233
  Struct TypedRowIter in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla/src/transport/legacy_query_result.rs:40
  Struct TypedRowIter in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla/src/transport/legacy_query_result.rs:40

     Summary semver requires new minor version: 0 major and 1 minor checks failed
    Finished [  47.258s] scylla
    Building scylla-cql v0.4.0 (current)
       Built [  11.000s] (current)
     Parsing scylla-cql v0.4.0 (current)
      Parsed [   0.035s] (current)
    Building scylla-cql v0.4.0 (baseline)
       Built [  11.110s] (baseline)
     Parsing scylla-cql v0.4.0 (baseline)
      Parsed [   0.036s] (baseline)
    Checking scylla-cql v0.4.0 -> v0.4.0 (no change)
     Checked [   0.101s] 95 checks: 94 pass, 1 fail, 0 warn, 0 skip

--- failure type_marked_deprecated: #[deprecated] added on type ---

Description:
A type is now #[deprecated]. Downstream crates will get a compiler warning when using this type.
        ref: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.37.0/src/lints/type_marked_deprecated.ron

Failed in:
  Enum FromRowError in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/cql_to_rust.rs:19
  Enum FromRowError in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/cql_to_rust.rs:19
  Struct LegacyBatchValuesIteratorFromIterator in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/value.rs:896
  Struct ValueListAdapter in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/types/serialize/row.rs:453
  Struct LegacyBatchValuesFirstSerialized in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/value.rs:1822
  Struct ValueAdapter in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/types/serialize/value.rs:964
  Struct LegacySerializedValues in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/value.rs:690
  Struct LegacyBatchValuesIteratorAdapter in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/types/serialize/batch.rs:364
  Enum ValueListToSerializeRowAdapterError in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/types/serialize/row.rs:710
  Struct ValueTooBig in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/value.rs:21
  Struct LegacyBatchValuesFromIter in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/value.rs:1648
  Enum FromCqlValError in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/cql_to_rust.rs:42
  Enum FromCqlValError in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/response/cql_to_rust.rs:42
  Enum ValueToSerializeValueAdapterError in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/types/serialize/value.rs:1489
  Struct TupleValuesIter in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/value.rs:1724
  Struct LegacyBatchValuesAdapter in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/types/serialize/batch.rs:340
  Struct LegacySerializedValuesIterator in /home/runner/work/scylla-rust-driver/scylla-rust-driver/scylla-cql/src/frame/value.rs:830

     Summary semver requires new minor version: 0 major and 1 minor checks failed
    Finished [  23.052s] scylla-cql
make: *** [Makefile:61: semver-rev] Error 1

@wprzytula
Copy link
Collaborator Author

semver-checks deem this PR API-breaking, but if you read its message through, you'll see that it only requires a minor version bump, not major - so it's OK to do the changes in 0.15.1 (because we consider the last number the minor version number).

@Lorak-mmk
Copy link
Collaborator

semver-checks deem this PR API-breaking, but if you read its message through, you'll see that it only requires a minor version bump, not major - so it's OK to do the changes in 0.15.1 (because we consider the last number the minor version number).

We should make message and tag different if only a minor version bump is required. Especially after 1.0

Lorak-mmk
Lorak-mmk previously approved these changes Dec 6, 2024
@wprzytula
Copy link
Collaborator Author

Please don't merge yet. I'll update thiserror after 2.0.6 got released, so that there are no unnecessary module-level `#![allow(deprecated)] attributes.

Copy link
Collaborator

@Lorak-mmk Lorak-mmk left a comment

Choose a reason for hiding this comment

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

Commit: "codewide: deprecate legacy serialization API's items "

Do we strictly need this "legacy" module? Why not just deprecate the items?
If it is required for some reason, then it's creation should be a separate commit, not the same one that adds deprecation.

scylla-cql/src/frame/response/cql_to_rust.rs Show resolved Hide resolved
scylla/src/transport/errors.rs Show resolved Hide resolved
thiserror fixed handling of deprecated items in 2.0.6, which is crucial
for the next commits introducing deprecation notice for legacy types.
Note: this is not a breaking change, because thiserror does not appear
in the public API.
There were some remnants from the legacy deserialization API that had
not been marked with #[deprecated] attribute.
@wprzytula
Copy link
Collaborator Author

Do we strictly need this "legacy" module? Why not just deprecate the items?

There are a huge lot of items, it would be a lot of meaningless work to attribute each of them.
I will split the commit into two.

@Lorak-mmk
Copy link
Collaborator

Do we strictly need this "legacy" module? Why not just deprecate the items?

There are a huge lot of items, it would be a lot of meaningless work to attribute each of them. I will split the commit into two.

But you are also applying deprecation notices to the items inside this new module, not only to the module itself.
So what work was avoided by creating this module?

To make deprecations in value.rs less invasive, as measured by the
number of required changes in the next commit, a `legacy` module is
extracted for all legacy items.
As a bonus, the future deletion of legacy items will be clearer.

I recommend viewing this commit with whitespace changes ignored.
@wprzytula wprzytula force-pushed the deprecate-legacy-items branch from 6bab921 to da6102a Compare December 9, 2024 18:19
Items constituting the legacy serialization API hadn't been marked with
the #[deprecated] attribute. As we're going to remove them soon, let's
warn users about that explicitly.
@wprzytula wprzytula force-pushed the deprecate-legacy-items branch from da6102a to c136255 Compare December 9, 2024 18:24
@wprzytula
Copy link
Collaborator Author

Do we strictly need this "legacy" module? Why not just deprecate the items?

There are a huge lot of items, it would be a lot of meaningless work to attribute each of them. I will split the commit into two.

But you are also applying deprecation notices to the items inside this new module, not only to the module itself. So what work was avoided by creating this module?

Those notices from inside the new module were leftovers. Now there is per-module global deprecation notice.

@wprzytula wprzytula requested a review from Lorak-mmk December 9, 2024 18:29
Comment on lines +23 to +34
#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum SerializeValuesError {
#[error("Too many values to add, max 65,535 values can be sent in a request")]
TooManyValues,
#[error("Mixing named and not named values is not allowed")]
MixingNamedAndNotNamedValues,
#[error(transparent)]
ValueTooBig(#[from] ValueTooBig),
#[error("Parsing serialized values failed")]
ParseError,
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this not part of the legacy module?

Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto for ValueTooBig

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SerializeValuesError is used in types::serialize::row::SerializedValues::add_value, and SerializeValuesError contains a variant for ValueTooBig. That's why I left those not deprecated.

@wprzytula wprzytula requested a review from muzarski December 11, 2024 12:12
@wprzytula wprzytula merged commit 868d86f into scylladb:main Dec 11, 2024
11 checks passed
@wprzytula wprzytula deleted the deprecate-legacy-items branch December 11, 2024 13:13
wprzytula added a commit to wprzytula/scylla-rust-driver that referenced this pull request Dec 11, 2024
Deprecate legacy items

(cherry picked from commit 868d86f)
@wprzytula wprzytula mentioned this pull request Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API-stability Part of the effort to stabilize the API semver-checks-breaking cargo-semver-checks reports that this PR introduces breaking API changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate legacy APIs before we delete them in 1.0
3 participants