Skip to content

refactor(encryption) use StandardKeyMetadata from EncryptedOutputFile in ManifestWriterBuilder#2628

Merged
blackmwk merged 4 commits into
apache:mainfrom
xanderbailey:xb/refactor_manifest_list_writer_2
Jul 1, 2026
Merged

refactor(encryption) use StandardKeyMetadata from EncryptedOutputFile in ManifestWriterBuilder#2628
blackmwk merged 4 commits into
apache:mainfrom
xanderbailey:xb/refactor_manifest_list_writer_2

Conversation

@xanderbailey

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

In #2568 we introduced new_from_encrypted but the api isn't very ergonomic because EncryptedOutputFile has StandardKeyMetadata on it already so we don't need to pass in key_metadata also.

working towards #2034

What changes are included in this PR?

Are these changes tested?

pub fn iceberg::spec::ManifestWriterBuilder::build_v3_deletes(self) -> iceberg::spec::ManifestWriter
pub fn iceberg::spec::ManifestWriterBuilder::new(output: iceberg::io::OutputFile, snapshot_id: core::option::Option<i64>, key_metadata: core::option::Option<alloc::vec::Vec<u8>>, schema: iceberg::spec::SchemaRef, partition_spec: iceberg::spec::PartitionSpec) -> Self
pub fn iceberg::spec::ManifestWriterBuilder::new_from_encrypted(encrypted_output: iceberg::encryption::EncryptedOutputFile, snapshot_id: core::option::Option<i64>, key_metadata: core::option::Option<alloc::vec::Vec<u8>>, schema: iceberg::spec::SchemaRef, partition_spec: iceberg::spec::PartitionSpec) -> Self
pub fn iceberg::spec::ManifestWriterBuilder::new_from_encrypted(encrypted_output: iceberg::encryption::EncryptedOutputFile, snapshot_id: core::option::Option<i64>, schema: iceberg::spec::SchemaRef, partition_spec: iceberg::spec::PartitionSpec) -> iceberg::Result<Self>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This isn't a break to users since this hasn't been released or used within the crate

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I didn't realise this at the time but it's likely incorrect that we have key_metadata in this constructor at all. This should never be present with a plaintext OutputFile. But in #2568 we discussed a desire to not break this API but on closer look, I think the current API here is error-prone.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@blackmwk very interested to know your thoughts here.

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.

Yes, we should remove it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Opened a new PR here #2666, wanted to keep this one targeted. Hope that's okay.

@xanderbailey

Copy link
Copy Markdown
Contributor Author

failing CI is fixed in #2627

@xanderbailey xanderbailey force-pushed the xb/refactor_manifest_list_writer_2 branch from 584f31f to da189b6 Compare June 14, 2026 20:54
blackmwk pushed a commit that referenced this pull request Jul 1, 2026
…nencrypted manifest writer (#2666)

## Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->

- working towards #2034

Follow up for #2628 

## What changes are included in this PR?
Now that we have two constructors for `ManifestWriterBuilder`, `new` and
`new_from_encrypted`, it should never be the case that you want to
present `key_metadata` to an unencrypted `output`.

<!--
Provide a summary of the modifications in this PR. List the main changes
such as new features, bug fixes, refactoring, or any other updates.
-->

## Are these changes tested?

<!--
Specify what test covers (unit test, integration test, etc.).

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->

@blackmwk blackmwk 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.

Thanks @xanderbailey for this fix!

@blackmwk blackmwk merged commit 713e201 into apache:main Jul 1, 2026
22 checks passed
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