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

Reduce the surface area of the configuration crate. #297

Merged
merged 10 commits into from
Feb 14, 2024

Conversation

SamirTalwar
Copy link
Contributor

@SamirTalwar SamirTalwar commented Feb 14, 2024

What

This makes a few changes to the configuration (version 3) to reduce the surface area.

All changes are refactors.

How

  1. unqualified_schemas was deprecated and has been removed.
  2. set_connection_uri is only used in tests, so I moved it to the tests.
  3. ConfigureOptions has been moved to its own file to keep things a bit more private.
  4. Other functions have been made private.
  5. When configuring, we avoid cloning where possible.

Copy link
Contributor

@plcplc plcplc left a comment

Choose a reason for hiding this comment

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

Some thoughts, but otherwise nice.

justfile Outdated
@@ -234,6 +234,8 @@ generate-chinook-configuration: build start-dependencies
echo "$(tput bold)$(tput setaf 3)WARNING:$(tput sgr0) Not updating the Aurora configuration because the connection string is unset."; \
fi

./scripts/archive-old-ndc-metadata.sh '{{POSTGRES_V3_CHINOOK_NDC_METADATA}}'
Copy link
Contributor

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's much point to keeping these older versions around in this breaking-changes-epoch. (Even this PR makes changes to an archived version, which is non-sensical)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll just remove it.

@@ -15,6 +15,8 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
pub struct Metadata {
#[serde(default)]
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think scalar_types belong in Metadata because the set of scalar types is not itself a root observable/introspected entity but instead derived from the column types and comparison operators etc.

I don't think having the set of scalar types be part of the metadata enables any new behaviors for a user, except maybe the ability to provoke the ndc to expose an inconsistent schema (I'm not sure).

IMO it'd be more appropriate to have the scalar types be part of RuntimeConfiguration instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, let's revert this for now and bring it back once RuntimeConfiguration is stored rather than re-computed per request.

We do not want to work with old configurations until the beta release.
@SamirTalwar SamirTalwar added this pull request to the merge queue Feb 14, 2024
Merged via the queue into main with commit 636450d Feb 14, 2024
28 checks passed
@SamirTalwar SamirTalwar deleted the samirtalwar/evolve-configuration-v3 branch February 14, 2024 19:33
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