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

[DNM] Custom data placeholder module is not required #5243

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shauns
Copy link
Contributor

@shauns shauns commented Jan 21, 2025

DNM - exploration

This shows how config modules -- modules specified in the app.toml file -- can be made solely server led. There are few small changes here:

  • We no longer check that the app.toml matches the CLI-defined config zod schema precisely. We let unknown fields through
  • When parsing using JSON schema, we return the JSON schema-validated data, rather than the source data
  • We also remove any additional properties in this result, if additionalProperties: false is set. This means that JSON schema that covers a slice of the app.toml can be given the entire config, validate it, and return a data structure representing just thie piece that it validated. This is the same behaviour the internal zod schemas for app config follow.
  • We remove the hard-coded custom data schema and use the server provided specification. We have to hack in that this module uses single-instance management

One side-effect of this is that completely unknown sections in the app.toml are ignored but don't cause validation to fail. This is a change. This may be desirable or not... if the reason a section is ignored is because it's called [scopes] then the developer probably meant [access_scopes] and so maybe silence isn't good. Alternatively it may be the right thing to validate things we known about and ignore things we don't.

This is tested in dev and deploy but not linking yet. We'd want to test this thoroughly I think as its a somewhat low level shift.

Copy link
Contributor Author

shauns commented Jan 21, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@shauns shauns changed the title Custom data placeholder module is not required [DNM] Custom data placeholder module is not required Jan 21, 2025
Copy link
Contributor

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75.25% (-0.07% 🔻)
8876/11795
🟡 Branches
70.41% (-0.15% 🔻)
4327/6145
🟡 Functions
75.1% (+0.01% 🔼)
2326/3097
🟡 Lines
75.8% (-0.05% 🔻)
8387/11064
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / loader.ts
91.84% (-0.06% 🔻)
82.98% (-0.18% 🔻)
96.19%
92.56% (-0.06% 🔻)
🔴
... / extension.ts
55.56% (-1.59% 🔻)
57.69% 50%
56.6% (-1.58% 🔻)
🟢
... / app-event-watcher.ts
93.83% (-1.23% 🔻)
86.49% (-2.7% 🔻)
90.48% 98.61%
🟢
... / fetch-extension-specifications.ts
95.45% (-2.16% 🔻)
80% (-3.33% 🔻)
100%
97.3% (-2.7% 🔻)
🟡
... / notifications-system.ts
63.96% (-2.7% 🔻)
62.35% (-3.32% 🔻)
85.71% (-3.76% 🔻)
71.43% (-2.9% 🔻)
🔴
... / system.ts
44.68% (-1.99% 🔻)
31.58% (+0.33% 🔼)
66.67%
45.65% (-2.08% 🔻)

Test suite run success

2003 tests passing in 905 suites.

Report generated by 🧪jest coverage report action from 5c8a232

@@ -905,17 +905,12 @@ async function loadAppConfigurationFromState<
...configState.basicConfiguration,
}
delete file.path
const appVersionedSchema = getAppVersionedSchema(specifications)
const appVersionedSchema = getAppVersionedSchema(specifications, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should allowDynamicallySpecifiedConfigs be the default for this function? 🤔
I see we call getAppVersionedSchema in three other places and it defaults to false

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