Repository navigation
docs: configuration reference generated from the sample file, pinned to the structs - #537
LeeroyHannigan wants to merge 34 commits into
Conversation
extenddb.sample.toml now lists every field the configuration structs read, each as one commented key line with its default and a description above it, in struct order: top-level keys, [server], [server.tls], [storage], the four [storage.<backend>] sections, [auth], [auth.cache], [limits], [logging], [import] and [export]. The [storage.sqlite] and [storage.cassandra] sections are new, throttling_enabled moves to [server], the three TLS keys and the 23 limits are present, and the production example block is removed because its keys repeated ones above.
Unit tests in extenddb-config uncomment the sample's key and header lines, parse the result and compare each section's keys and values with the struct's defaults: [server], [server.tls], [auth], [auth.cache], [limits], [logging], [import], [export], the top-level keys and the [storage] backend key. Each storage backend crate pins its own [storage.<backend>] section the same way through a shared test support module. A key the struct does not have, a key the sample lacks, or a default that differs fails the test. Serialize is derived on the extenddb-config structs and LimitsConfig; the backend configs derive it under cfg(test) only, because their connection strings and passwords stay out of any serialize path in the library build.
website/scripts/gen-config-reference.mjs parses the sample's comment convention (section header, intro block, description lines above each commented key line) and writes docs/configuration.md: a Key, Default, Description table per section with the section intro as prose. Keys whose description says they have no default show none. The --check flag regenerates to a string and exits 1 with a unified diff when the committed page differs; the documentation site workflow runs it before the build and now also triggers on changes to the sample.
The sidebar's Configuration entry is the generated docs/configuration.md. The admin guide's Configuration Reference section keeps its anchor and becomes a pointer to that page plus the two operational notes that were prose rather than key tables (PostgreSQL restores and the pool, auth cache statistics and invalidation timing); the key tables move out. The doc consistency script also accepts docs/configuration.md as the place a sample key is documented.
…d pools Descriptions now state what the server does with each key: the policy document limit key is accepted but not read, max_tables_per_account is shown on the console and not enforced, the per-table capacity limits are what DescribeLimits reports and CreateTable does not enforce, the account limits are also reported by DescribeLimits. The logging intro covers foreground mode (stderr) as well as daemon mode (syslog). The header names the keys that have no environment variable form. The PostgreSQL connection budget counts the restore lock session and the lock sentence is split in three. Dev-mode behavior of bind_addr and tls.enabled, the HOME-unset defaults of run_dir and the TLS paths, and the auth cache startup checks are stated. Key names in prose are code spans, cross references are links, and the Cassandra exception to the unknown-field refusal is named.
… its sources The generator appends the sample's value to a no-default key's description as an example, drops the sentence that repeated the Default column, points the page's edit link at extenddb.sample.toml, refuses a key line with a trailing comment, and passes Markdown links through from the sample. The page and the admin guide state which keys have no environment variable form and agree on precedence. Code spans in the Key and Default columns may break inside a word at phone widths.
The pin takes the struct's field names from a JSON serialization, where a None field is null rather than absent, and requires each name in the sample section; the value comparison skips only the named example keys, whose numeric examples must be integers. MongoDB connection_string and Cassandra contact_points are example keys. The root section set is pinned to the AppConfig tables, the Cassandra section is checked for stray sub-tables, and a test asserts that the keys whose description carries the no-default marker are exactly the example keys plus the keys with no struct default.
At 390 px the configuration page's reference tables were up to 582 px wide because key names, quoted defaults and example assignments are single unbreakable words. With overflow-wrap: anywhere on code spans in table cells under 600 px, all 14 tables fit the 358 px content column.
…s unknown keys The sample file, the generator's intro paragraph, the generated page and the admin guide said the list keys and the SQLite and Cassandra numeric keys were file only, and that `[storage.cassandra]` was the one section that accepted unknown keys. Both limitations are removed by #546, which this branch now assumes. The four places state the list form (`EXTENDDB__IMPORT__PATHS="/data/in,/data/shared"`, items trimmed, empty items dropped, an item containing a comma written as an array) and that every section refuses an unknown key with the key named. `docs/configuration.md` is regenerated; `--check` passes.
b832527 to
e2169dd
Compare
511d42a to
7612ce3
Compare
crates/storage-sqlite/src/lib.rs: the base added the password_hash_store module; this branch added the sample pin test modules. The merge keeps both module lists. extenddb.sample.toml: the base added the [backup] section and counted one claim connection per running backup or restore job in the PostgreSQL connection budget. This branch rewrote the file so that every key appears once with its default under a description, and the page docs/configuration.md is generated from it. The merge keeps this branch's file, with a [backup] section in the same form between [logging] and [import]: the seven keys of BackupConfig in struct order, each with its default, and spool_path marked as having no default. The [storage.postgres] budget and the pool_size description count the claim connections and give the 64 connections the defaults need, and the pool_size description names the raise to 2 * max_concurrent_jobs + 10. The region description says that CreateBackup is refused under a region outside [a-z0-9-], and the SQLite pool_size description says that a CreateBackup over the snapshot bound is refused without waiting, as the code on the base does. docs/manuals/05-admin-guide.md: the base edited the region row, the auth cache max_entries row and added the [backup] table to the configuration reference tables. This branch replaced the tables with a pointer to the Configuration page. The merge keeps the pointer; the base's facts are in the sample file, which the page is generated from. The connection budget paragraph the base wrote points at the Configuration page where it pointed at the removed table. crates/config/src/backup.rs: BackupConfig derives Serialize, which the sample pin tests read field names and defaults through. crates/config/src/sample_toml_tests.rs: the root section list and the no-default key list include backup and backup.spool_path, and a test pins the [backup] section to BackupConfig. docs/configuration.md: regenerated from the sample.
demohan
left a comment
There was a problem hiding this comment.
The defaults on the page are the defaults the server uses. Loaded through the server's config loader on all four backends, the sample with every default-valued key uncommented gives the same values as a file holding only the backend section, apart from the three ~/ paths, which every reader expands. The sample copied as extenddb.toml starts on all four backends with a connection string where one is needed, and the head SQLite and PostgreSQL binaries report healthy on it. An independent parse of the generated page matches the sample: 81 keys and 19 sections, in the same order and with the same defaults. Scalar environment overrides, precedence, serve --port, the startup refusals and pool raises checked, and settings set for the three runtime settings behave as written.
The pin tests catch a missing required or optional field, a changed default, a renamed or unknown key, a string where an integer belongs, and a removed "No default." marker: each of 10 controls fails and names the key, as do the four check:config controls. fmt, both clippy commands and the 1.91.1 MSRV check are clean, the site builds with strict links (0 broken across 80 pages and 5,571 internal links), and CI is green.
I will approve once the environment text matches this branch, the pin tests reach the three field kinds below, the console doc set carries the page, and the MongoDB pool lines give the driver's default.
docs/build-docs.py:64
The console and PDF doc set has no configuration.md. The admin guide drops its key tables (97 rows to 64) and links to ../configuration.md, which the console cannot serve. Adding the page to this list would keep the console guide complete.
| # EXTENDDB__STORAGE__POSTGRES__CONNECTION_STRING="postgresql://..." | ||
| # EXTENDDB__AUTH__ENCRYPTION__KEY_FILE=/etc/extenddb/kek | ||
| # EXTENDDB__AUTH__ENCRYPTION__REQUIRE_LOCKED_MEMORY=true | ||
| # Every key accepts this form. A list key (import.paths, export.paths, |
There was a problem hiding this comment.
This text describes #546, which is open and not in this branch. At this head, twice each on SQLite and PostgreSQL:
EXTENDDB__IMPORT__PATHS=/data/in,/data/sharedexits 1 withinvalid type: string ..., expected a sequence, and an empty value gives the same error.EXTENDDB__STORAGE__SQLITE__POOL_SIZE=8exits 1 withinvalid type: string "8", expected u32.- On Cassandra,
CONTACT_POINTSgivesexpected a sequenceandMAX_CONNECTIONSgivesexpected u32.
The sentences 7612ce3 replaced were true here. Landing this after #546, or keeping them until it merges, would fix it. The same text is generated into docs/configuration.md:10 (gen-config-reference.mjs:153) and is in 05-admin-guide.md:117.
There was a problem hiding this comment.
Fixed in f4a77be. The sample header, the generator's paragraph (so the generated page) and the admin guide say again that scalar keys take the environment form. The list keys and the numeric keys of [storage.sqlite] and [storage.cassandra] are file only. Those are the sentences 7612ce3 replaced. The body's "Depends on" section is gone. #546 carries the list-form text when it lands.
| # `extenddb init` auto-discovers this directory if it exists. | ||
| # These keys sit at the top level and must appear before the first [section] | ||
| # header of the file. A top-level key placed after a header lands inside that | ||
| # section, and every section refuses to start the server with "unknown field" |
There was a problem hiding this comment.
[storage] ignores unknown keys, so a top-level key placed after [storage] is dropped and the server starts: docs_dir and bogus_key = 1 there each start and listen, twice each. The same key after [server] is refused. [storage.cassandra] also accepts bogus_key at this head. #546 keeps [storage] ignoring unknown keys, so this sentence needs [storage] named as the exception either way.
There was a problem hiding this comment.
Fixed in 8205510. The text names [storage], [storage.cassandra] and the sections of the other backends as the exceptions. [storage] reads only backend and the section of the binary's own backend, and drops any other key without an error (StorageConfig::deserialize, crates/config/src/lib.rs:225-273). A binary does not read the sections of the other backends. [storage.cassandra] ignores a key it does not know. The [storage] behaviour itself is #1505. When #546 lands, its text drops [storage.cassandra] from the exception.
| use extenddb_core::limits::LimitsConfig; | ||
|
|
||
| #[test] | ||
| fn top_level_keys_are_the_optional_app_config_fields() { |
There was a problem hiding this comment.
The two root tests compare the sample with hard-coded lists, not with AppConfig, and field_names (sample_toml_support.rs:113) skips struct-valued fields. With each of these added and no sample line, all 14 tests pass:
- a new top-level
Optionfield onAppConfig; - a new section;
- a new nested-struct field on
ServerConfigorAuthConfig.
Deriving the root keys and sections from the struct, and descending into nested structs, would make the body's claim hold for every field.
There was a problem hiding this comment.
Fixed in f14bb58. struct_fields::<T>() reads the field list a derived Deserialize passes to deserialize_struct, through a Deserializer that records it and stops. It needs no value of the struct, so it covers AppConfig. The root test compares the sample's top-level keys and sections with AppConfig's fields and checks that the sections are its eight struct-valued fields. pin takes its field set from the same source. A struct-valued field without a sub-table in the sample fails as "field of the struct, missing from the sample". Your three controls each fail one test now with the field named: a new Option field on AppConfig, a new section, a nested struct on ServerConfig. The two positive controls (a changed default_port, a removed # port line) still fail.
| # authorization traffic; size for their combined | ||
| # concurrency. | ||
|
|
||
| # Maximum concurrent connections for data operations. Unset means 50. No |
There was a problem hiding this comment.
max_connections and max_catalog_connections do not fall back to 50 and 20 when unset. max_connections_override() passes None through (storage-mongodb/src/lib.rs:121), and apply_max_pool_size leaves the driver's default of 10 in place (:514). Under 80 threads of load, mongod peaked at 26 connections with both keys unset and at 65 with 50 and 20 written out, twice each. The PR body's Decisions section states the same fallback.
There was a problem hiding this comment.
Fixed in 8205510. The two descriptions say that an unset key leaves the driver's pool size. That is the connection string's maxPoolSize when it has one, else the driver's default of 10 per server. They say that the example is a production value and that neither key has a default of its own. The body's Decisions sentence and the MongoDB pin test's comment say the same. The unwrap_or(50) and unwrap_or(20) getters, which no server path calls, are #1503.
| split across lines is harder to read than a sideways scroll. The | ||
| description column keeps a floor so it stays readable while the table | ||
| scrolls inside its own box. */ | ||
| article table td:nth-child(1) code, |
There was a problem hiding this comment.
These rules apply to every article table on the site. At 390 px, the admin guide's Encryption Key table grows from 525 to 1062 px, the TTL table in the differences page from 613 to 923 px, and the upgrade manual's Catalog Status table from 604 to 789 px, so two tables that fitted now scroll. Scoping them to html.docs-doc-id-configuration would keep them to the generated page.
There was a problem hiding this comment.
Fixed in b241f48. The three selectors carry html.docs-doc-id-configuration, the class Docusaurus puts on the generated page's <html>, so the rules reach that page's tables and no other. The comment above them says so. In the strict site build the class is on configuration/index.html and on no other page.
| # Remove that `extenddb-store.json`; the next start writes a new one (a new | ||
| # store id) and adopts the backups under the root. Every `extenddb backup` | ||
| # command refuses an in-memory database. | ||
| # path = "extenddb.sqlite" |
There was a problem hiding this comment.
In a sqlite-memory build the path default is :memory:, not extenddb.sqlite.
There was a problem hiding this comment.
| # — size this to match expected concurrency. | ||
|
|
||
| # Maximum concurrent connections in each of the two data-operation pools. | ||
| # Minimum 10: smaller values are raised to 10 with a startup warning, and a |
There was a problem hiding this comment.
The jobs rule always raises the pools first, to at least 12, so the minimum of 10 never applies: pool_size = 5 with one job is raised to 12, and no "minimum of 10" line is logged.
There was a problem hiding this comment.
Fixed in 8205510. pool_size now reads: "A value under 2 * [backup] max_concurrent_jobs + 10 (18 with the default of 4 jobs, 12 at the least) is raised to that at startup with a warning naming both numbers." catalog_pool_size: "Raised to the same 2 * max_concurrent_jobs + 10 floor with a warning." The minimum of 10 is gone from both. The clamp that cannot fire on the serve path is #1506.
| # `limits.max_import_file_bytes`, which carries the 10 GB default. No default. | ||
| # max_import_bytes = 10737418240 | ||
|
|
||
| # Deprecated: a single root for both import and export. It fills whichever of |
There was a problem hiding this comment.
The code turns on whether the [import] and [export] path lists are empty, not whether the sections are present, and this sample carries both headers uncommented.
There was a problem hiding this comment.
Fixed in 8205510. The description follows EffectivePaths::resolve (crates/server/src/import_export_paths.rs:47-80): the key fills whichever of the [import] and [export] path lists is empty. With both lists filled it does nothing. With one filled it supplies the other. With both empty, the sections as the file ships them, it makes the import and export roots the same directory.
| /// user information, which `open` refuses but a log of the configuration | ||
| /// written before `open` would otherwise carry. | ||
| #[derive(Clone, PartialEq, Eq, Deserialize)] | ||
| #[derive(Clone, PartialEq, Eq, Deserialize, Serialize)] |
There was a problem hiding this comment.
S3StoreConfig now derives Serialize in the library build, which would emit the endpoint user information its Debug strips. Nothing serializes it at this head; limiting the derive to the test build would keep it that way.
There was a problem hiding this comment.
Fixed in 3f9c43d. The four store types derive Serialize behind a serialize feature of extenddb-backup-store that only the [dev-dependencies] of extenddb-config turn on, and BackupConfig derives it under cfg(test), as the backend configuration structs do. The library build has no Serialize on a type that can carry an endpoint's user information. cargo check of both crates without the feature passes, and the pin tests pass with it. A cfg(test) derive alone did not work here, because the pins live in the tests of extenddb-config, not of the store crate.
| @@ -100,7 +100,7 @@ if [ -f extenddb.sample.toml ]; then | |||
| for key in $SAMPLE_KEYS; do | |||
There was a problem hiding this comment.
The config-key check now searches a page generated from the sample it enumerates, so it cannot fail.
There was a problem hiding this comment.
Fixed in f61164c. Check 2 is gone. The generator writes the page from the sample's key lines, so with the page current every grep succeeded by construction. No workflow runs the script. The other checks keep their numbers. npm run check:config in the docs-site workflow fails when the page and the sample differ, and the pin tests fail when the sample and the structs differ. The body's sentence about the check says so.
The sample header, the generator's intro paragraph and the admin guide said that every key has an environment form. They said that a list key takes a comma-delimited string. That is #546's change, which this branch does not contain: at this head `EXTENDDB__IMPORT__PATHS=/data/in,/data/shared` fails with `expected a sequence` and `EXTENDDB__STORAGE__SQLITE__POOL_SIZE=8` with `expected u32`. The three places now say that scalar keys take the environment form. The list keys and the numeric keys of `[storage.sqlite]` and `[storage.cassandra]` are file only. Those are the sentences 7612ce3 replaced. `npm run gen:config` regenerates `docs/configuration.md`. #546 updates the text when it lands.
Each description below said something the code at its use site does not do. The sample now says what the code does, and `npm run gen:config` regenerates `docs/configuration.md`. - Top-level keys: `[storage]` reads only `backend` and the section of the binary's own backend, and drops any other key without an error (`StorageConfig::deserialize`). A binary does not read the sections of the other backends. `[storage.cassandra]` ignores a key it does not know. The text names all of them as the exceptions to the "unknown field" refusal. - `import_export_root`: the code tests whether the `[import]` and `[export]` path lists are empty, not whether the sections are present (`EffectivePaths::resolve`), and this file ships both sections with empty lists. - `server.bind_addr`: `EXTENDDB_DEV_ALLOW_ANY_BIND=1`, which the dev image sets, lifts the loopback refusal of a dev-mode build. - `storage.postgres.pool_size` and `catalog_pool_size`: the jobs rule raises both pools to 2 * `max_concurrent_jobs` + 10 first (at least 12), so the clamp to 10 never applies on the serve path. - `storage.sqlite.path`: a `sqlite-memory` build defaults to ":memory:". - `storage.mongodb.max_connections` and `max_catalog_connections`: unset, the server passes `None` through and the driver's pool size applies (the connection string's `maxPoolSize`, else 10). Nothing falls back to 50 or 20. The examples are production values. The MongoDB pin test's comment says the same. - `auth.cache`: the startup refusals include `ttl_seconds = 0`. - `limits.max_expression_depth`: AND and OR do not add depth. A parenthesized group, a NOT and a `size` operand each add one level. The same limit bounds an UpdateExpression, where a parenthesized value and a function call each add one level.
…efaults The pin tests read the struct's field names from a JSON serialization of a value, which drops every struct-valued field. The two root tests compared the sample with literal lists. A new `Option` field on `AppConfig`, a new section, or a new nested struct on `ServerConfig` passed all 14 tests with no sample line. `struct_fields::<T>()` now reads the field list a derived `Deserialize` passes to `deserialize_struct`, through a `Deserializer` that records it and stops. It needs no value of the struct, so the root test pins `AppConfig` too. The sample's top-level keys and sections equal its fields, and the sections are its eight struct-valued fields. A struct-valued field without a sub-table in the sample fails as "field of the struct, missing from the sample". The derive's list also holds `#[serde(alias)]` names, so `pin` cannot pass for a struct with an alias. No pinned struct has one, and the doc comment of `struct_fields` says so. `pin` compared values with `T::default()`. While the section is present, the server's value for a missing key is the serde default, and the two can differ. `default_tls_enabled` changed to `false` passed, because `TlsConfig::default()` writes `true`. `pin` now builds the expected value by deserializing a table that holds only the example keys. Serde then fills every other field as it does for a missing key. When a file leaves a whole section out, the server uses `T::default()` instead, through the parent field's `#[serde(default)]`. `pin_with_default` compares the struct's `Default` for the ten sections a file can leave out: `server`, `server.tls`, `auth`, `auth.cache`, `auth.encryption`, `limits`, `logging`, `backup`, `import` and `export`. The storage sections do not use it, because a missing `[storage.<backend>]` is an error. The `expected` parameter is gone from the 17 call sites, 13 in `extenddb-config` and one in each backend crate. The PostgreSQL test pins the `catalog_pool_size` example to `max_catalog_connections()` of a section without the key, the fallback the description states. The SQLite test checks that a `memory` build gives `:memory:` for a missing `path` and compares the path's type only in that build. This deletes `field_names` and with it the `serde_json` dev-dependency of `extenddb-config`. `storage_section_names_only_the_backend` uses `table_keys` instead of a copy of its loop.
…the generator The Rust test accepted any description containing "no default", while the generator tested `\bno default\b`: a description ending "No defaults." passed the Rust set test and the generator showed the example value as the default. Both now read the same two sentences at the end of the description, "No default." and "No default of its own.", in either letter case. A description that writes anything else is neither, and the Rust set test names the key. The two "Required; no default." lines of the sample use the sentence form. The generated page does not change.
…d a feature a34d001 derived `Serialize` on `BackupStoreKind`, `BackupStoreConfig`, `FilesystemStoreConfig` and `S3StoreConfig` in the library build, for the pin tests of `extenddb-config`. `S3StoreConfig` can carry an endpoint's user information, which its `Debug` strips, and a serialize path in the library build would emit it. The derives now sit behind a `serialize` feature of `extenddb-backup-store` that only the `[dev-dependencies]` of `extenddb-config` turn on, and `BackupConfig` derives `Serialize` under `cfg(test)`, as the backend configuration structs do. `cargo check` of both crates without the feature passes, and the 13 pin tests pass with it.
…ies by construction Check 2 of `tests/cli/test-doc-consistency.sh` took every key of `extenddb.sample.toml` and searched for it in the manuals, the install page and, since c498768, `docs/configuration.md`. The generator writes that page from the same key lines, so with the page current the check cannot fail. No workflow runs the script. This removes the check. The other checks keep their numbers. `npm run check:config` in the docs-site workflow fails when the page and the sample differ, and the pin tests fail when the sample and the structs differ.
The admin guide's key tables are gone and its Configuration Reference section points at `../configuration.md`, but `DOCUMENTS` in `docs/build-docs.py` did not list that page. The console serves only the slugs of the manifest the script writes, so the console's admin guide had no key reference. The page is entry 20, slug `configuration`, category `reference`, after Backup and Restore. `python3 docs/build-docs.py --list` shows it.
…page The three rules of the 600 px block keep key names and defaults on one line and hold the description column at 14rem. They selected every article table on the site. On the admin guide's Encryption Key table the command in column 1 stopped wrapping and the prose in column 3 got the floor. A table that fitted the viewport now scrolled. The selectors carry the `html.docs-doc-id-configuration` class Docusaurus puts on the generated page, so the rules reach that page's tables and no other.
`gen-config-reference.mjs --check` carried a 55-line line-diff implementation to print a unified diff of the committed page against the regenerated one. The committed file is in git, so `npm run gen:config` followed by `git diff docs/configuration.md` shows the same change. `--check` now prints the one-line instruction and exits 1 when the page is out of date. When the page is current it exits 0 with the match line.
#530's branch at 469669e carries #523's af9567b, #491's 49b856f and main up to 9e457a3. No file conflicted. Main's commits in this merge add no field to a struct that the sample documents, so the sample needs no new line. #1173 lower-cases the Cassandra keyspace_prefix that a config file gives, and its default, extenddb, is already lower case. The generator check passes: docs/configuration.md matches the sample. On the merged tree, the 13 sample tests of extenddb-config and the sample test of each of the four backend crates pass. The SQLite test also passes with the memory feature.
#523's branch adds a link from docs/install-from-source.md to manuals/05-admin-guide.md#backupstore, and the merge of #530's branch carries it here. This branch replaced the admin guide's key tables, [backup.store] among them, with the Configuration page, so that anchor is gone. The strict site build then fails with a broken anchor on /install-from-source/. The link now opens the admin guide's backup store section, whose store identity paragraph explains the "owned by another catalog" report. The links of 14-backup-and-restore.md and 07-upgrade-manual.md open the same section. With the change the strict site build passes.
|
Thanks for the review. The four conditions are in:
Each thread has a reply with its commit. The body is rewritten in the template with the counts at the head. Four issues track the pre-existing behaviour behind three of the threads and behind the console ask of the review. #1503: the 50 and 20 getters no server path calls. #1504: cross-document links in the console docs. #1505: |
The package job failed at 00e67c4. `devtools/check-crate-packages` refuses a dev-dependency on a workspace crate that has a version or a workspace key, because cargo then keeps it in the published manifest. f14bb58 declared extenddb-backup-store with `workspace = true` and the serialize feature, for the sample pin tests. The dev-dependency now names the crate by path, with the same feature. `cargo package --workspace --no-verify --locked` and `devtools/check-crate-packages` pass, and the 13 sample tests of extenddb-config pass. Cargo.lock does not change.
demohan
left a comment
There was a problem hiding this comment.
The items from the earlier review are resolved at 3befe33.
- On a SQLite build of this head, the scalar keys the page lists take effect from the environment,
IMPORT__PATHSandEXPORT__PATHSstop withexpected a sequenceandSQLITE__POOL_SIZE=8withexpected u32, and on PostgreSQLPOSTGRES__POOL_SIZE=8overrides the file, as the environment text now says. A stray key after[storage]starts the server, the same key after[server]or in[storage.sqlite]is refused, andttl_seconds = 0stops from the file and from the environment. - The pin tests reach the three field kinds: a new top-level
Option, a new section, a nested struct onServerConfigandAuthConfig, a new PostgreSQLOptionand a stray Cassandra sample key each fail a test naming the field, as do the serde default and fallback changes and the "No defaults." marker. In mongodb 3.8.0, the version inCargo.lock,DEFAULT_MAX_POOL_SIZEis 10 per server pool, andapply_max_pool_sizesetsmaxPoolSizeonly when the key is set, for the data and catalog clients, as the pool lines say. build-docs.pylists the configuration page and a server withdocs_dirserves/console/docs/configuration. The narrow-screen rules are scoped to that page, the PostgreSQL pool floor and the expression depth limits answer as written, fmt, clippy and the 1.91.1 check are clean on the six crates, and the strict site build passes.
The Integration, MongoDB and Cassandra runs at this head were cancelled, so they have no result yet; wasm fails as it does on main.
Changes since the last review
Nine commits on top of
dd6303315answer demohan's review of 24 Nov. Two more merge #530's branch and correct one of its links. Each thread has a reply that names its commit.f4a77bef8e: the environment text describes this branch again (scalar keys only) in the sample header, the generator, the generated page and the admin guide. The "Depends on" section is gone from this body.8205510c78: eight sample descriptions corrected against the code. They cover the[storage]exception,import_export_root,bind_addr, the PostgreSQL pool floor, the SQLite memory build, the MongoDB pool keys, thettl_seconds = 0refusal and expression depth.f14bb58731: the pin tests read the field list from each struct's derivedDeserialize. They compare values with serde's default for a missing key, and with the struct'sDefaultfor the ten sections a file can leave out. The root test pinsAppConfigtoo.e0b28d4e38: one rule for the "No default." marker in the tests and the generator.3f9c43d00f:Serializeon the backup store types behind a feature that only the tests turn on.f61164cb97: the sample key check oftests/cli/test-doc-consistency.shis gone.7685ebce27: the Configuration page joins the console and PDF doc set.b241f48b1a: the narrow-screen table rules apply to the Configuration page only.be988522ad: the generator's--checkprints one line instead of its own diff.b66caf7e68: merges docs: architecture dash sweep and one feature status owner #530's branch at469669e59, which carries docs: one install page per path, first requests page, container upgrades #523's and docs: add the documentation site #491's branches andmainup to9e457a349. No file conflicted. Main's commits add no field to a configuration struct, so the sample needs no new line.00e67c4866: the backup store link ofdocs/install-from-source.md, a page from docs: one install page per path, first requests page, container upgrades #523's branch, opens the admin guide's backup store section. It pointed at the#backupstoreanchor that this PR removes, and the strict site build failed on it.3befe333ba: theextenddb-backup-storedev-dependency ofextenddb-confignames the crate by path. The package job failed at00e67c4866, becausedevtools/check-crate-packagesrefuses a dev-dependency on a workspace crate with a workspace key.What
Fourth change in the documentation site series, on top of #530. Two hand-maintained places documented the configuration keys, and they disagreed with each other and with the code. The Configuration Reference table in the administration guide had a
[storage.sqlite]section and no MongoDB or Cassandra sections.extenddb.sample.tomlhad[storage.mongodb], no SQLite or Cassandra section, andthrottling_enabled(a[server]key) filed under[auth.cache]. Neither listed the 23[limits]keys.The sample file is the one description of every key.
extenddb.sample.tomlcarries every field of every configuration struct exactly once, in struct order: 3 top-level keys and 78 keys in 18 sections. Each key is a commented# key = defaultline under its description. Against the base branch's sample, 32 keys are new. Among them are the 7 keys of[storage.cassandra]and 21 of the 23[limits]keys. Two keys move to the section of their struct:throttling_enabledfrom[auth.cache]to[server], andmax_import_bytesfrom[export]to the top level. It is still the template an operator copies.Tests pin the sample to the structs. A test module in
extenddb-configand one in each of the four storage backend crates uncomment the sample and parse it. Each checks its sections against their structs. The field list comes from the struct's derivedDeserialize:struct_fields::<T>()records what the derive passes todeserialize_struct. SoOptionfields and struct-valued fields count, and the test needs no value of the struct. The backup format tests ofextenddb-corehave the same probe (FieldsProbeincrates/core/src/backup_format/golden_tests.rs). It sits in a private test module, so the configuration tests cannot use it. Sharing it means changing that file, which #1377 changes and the three open PRs stacked on it (#1381, #1418 and #1437) carry. The root test pins the top-level keys and sections toAppConfigthe same way. Every sample key must exist in the struct (deny_unknown_fields). Every value must equal the value serde gives the field when the key is missing.pinreads that value by deserializing a table that holds only the example keys.pin_with_defaultalso compares each value with the struct'sDefaultfor the ten sections that a file can leave out. The server uses that value when the whole section is missing. When the sample writes a field as a sub-table, such asstorein[backup], the pin of that sub-table checks it.18 keys show example values instead of defaults. They are the keys whose description ends with "No default." or "No default of its own.", and a test asserts that set. The pin tests type-check 14 of them and do not pin their values:
server.throttling_enabled,auth.encryption.key_file,backup.spool_path,backup.store.filesystem.path,backup.store.s3.bucket,backup.store.s3.region,backup.store.s3.endpoint,storage.postgres.catalog_pool_size,storage.mongodb.connection_string,storage.mongodb.max_connections,storage.mongodb.max_catalog_connections,storage.cassandra.contact_points,storage.cassandra.usernameandstorage.cassandra.password. The PostgreSQL test pins thecatalog_pool_sizeexample to the fallback the getter gives when the key is unset. The tests check the other four,storage.backend,docs_dir,import_export_rootandmax_import_bytes, by name only.The configuration structs derive
Serializewhere the tests need it. On the four backend configuration structs and onBackupConfigthe derive is undercfg(test). On the four backup store types it is behind aserializefeature ofextenddb-backup-storethat only the dev-dependencies ofextenddb-configturn on.S3StoreConfigcan carry an endpoint's user information, and the library build keeps no serialize path for it.A generator builds the page.
website/scripts/gen-config-reference.mjsreads the sample and writesdocs/configuration.md. The page has one table per section (Key, Default, Description), with examples appended for keys without a default. Markdown links pass through from the sample comments, and the edit link points at the sample.npm run check:configregenerates the page and exits 1 when the committed page differs. It runs in the docs-site workflow before the build. The generator reads the sample's comment convention a second time, beside the Rust test support. A Rust test cannot run the generator without node, so both parsers stay. They share the marker rule: the description's last sentence is "No default." or "No default of its own.". The Reference sidebar's Configuration entry opens the new page.docs/build-docs.pylists it as document 20, so the console and the PDF set carry it. The administration guide's section is a pointer plus the prose about PostgreSQL connection budgets that was never a key table.Descriptions follow the code. Reading every key's use site found four keys whose descriptions stated intent rather than behavior. The server accepts
limits.max_policy_document_bytesand never reads it: the limit is a 6,144-byte literal in the policy parser. The console settings page showslimits.max_tables_per_account, and nothing enforces it. DescribeLimits reportsper_table_max_rcuandper_table_max_wcu, and CreateTable and UpdateTable do not enforce them. The page says so. Also corrected:--foreground, not always to syslog.max_concurrent_jobs+ 10 to that size.[auth.cache]startup validation rejects a zerottl_seconds, a soft or negative TTL above the hard TTL, and a zeromax_entries.server.tls.enabled. It refuses a non-loopback bind address unlessEXTENDDB_DEV_ALLOW_ANY_BIND=1is set, as the dev image sets it.[storage]reads onlybackendand the section of the binary's own backend, and drops any other key without an error. A binary does not read the sections of the other backends.[storage.cassandra]ignores a key it does not know.import_export_rootfills whichever of the two path lists is empty.sqlite-memorybuild defaultspathto:memory:.--portis the onlyserveflag that overrides a key.The gaps behind those corrections, and the console's links between documents, are separate issues, not part of this change: #1503, #1504, #1505 and #1506.
Why
Refs #494. This PR merges into #530's branch, and GitHub closes an issue only on a merge into
main, so this merge closes nothing. #494 stays open until the stack reachesmain.Decisions taken
The Default column shows the value the server uses for a missing key and nothing else. Some keys get their effective value from a fallback at the use site.
catalog_pool_sizefalls back topool_size. The MongoDB pool keys fall back to the driver's pool size, the connection string'smaxPoolSizeor else 10. Those keys show "none", with the fallback stated in the description, because the column is what the tests pin.Narrow screens: on the Configuration page, key names and defaults stay on one line and the table scrolls inside its own box. The description column stays at 14rem or wider. Breaking key names mid-word fitted the viewport and rendered
max_partition_key_size_byteson ten lines. The rules carry thehtml.docs-doc-id-configurationclass, so the tables of other pages keep their widths.tests/cli/test-doc-consistency.shloses its Check 2 (each sample key named in the manuals). The generated page lists every key by construction, no workflow runs the script, andnpm run check:configfails when the page is stale.Merging
The stack below this PR is #491 (
feat/docs-site, basemain), #523 (feat/docs-install-pages) and #530 (feat/docs-content-sweep, this PR's base). Each merges its base forward after its own review round.b66caf7e68merges #530's branch at469669e59, so this head contains #523's branch ataf9567b6dand #491's branch at49b856f58.00e67c4866changes line 564 ofdocs/install-from-source.md, a page that #523 adds: the line linked to the admin guide anchor that this PR removes. A later edit of that line on #523's branch conflicts with this commit.git merge-treereports no conflict for this head withmain(5252eda31). #530's branch also merges withmainwithout a conflict.The merge brought #491's changes to
website/src/css/custom.css: the navbar background and filter, the code block padding, and two removals. #491 removesdisplay: table; width: 100%from the table rule anddisplay: block; overflow-x: autofrom the 600 px block. This PR's three scoped rules stay at the end of the 600 px block. #491's change restores Infima's own table box, so every table scrolls at every width. This PR's rules keep key names whole on the Configuration page. Inwebsite/sidebars.tsthe merge added #491's three benchmark pages under Component designs and its RFC entry under RFCs. This PR adds the Configuration entry under Reference.Open PRs that touch
extenddb.sample.tomlor the configuration structs, by the overlap check: #546, #874, #741, #635, #1352, #1154, #318, #140, #558, #571 and #987. #558 and #571 addlimits.max_expression_operatorsand #987 addsstorage.postgres.create_only_puts, and none of them adds a sample line. Once this PR is in, a PR that adds a configuration key must add its sample line in this convention and regenerate the page withnpm run gen:config. The convention is one# key = defaultline under a description, with "No default." for a key without one. The pin tests andnpm run check:configrefuse anything else. #546 adds no key but edits the sample header andcrates/config/src/lib.rs. It conflicts with this PR in those two files, incrates/storage-cassandra/src/config.rsand indocs/manuals/05-admin-guide.md. Whichever merges second takes the other's lines. For #546 that means writing the list form of the environment text into the four places this PR restored.Testing done
At
00e67c4866, on the 1.97.0 toolchain CI uses, withCARGO_BUILD_JOBS=2:extenddb-configand thesample_tomltest of each of the four backend crates pass (cargo test -p <crate> --lib sample_toml). The SQLite test also passes with--features memory.cargo fmt --all -- --checkexits 0.cargo clippy --all-targets -- -D warningson the six touched crates gives no warning with CI'stest-hooksfeatures, withextenddb-engine/backup-test-hooks, and with no features.cargo clippy --all-targets -- -W clippy::pedanticon the six crates reports no warning on a line this PR adds.cargo +1.91.1 check --all-targetson the same six crates passes.extenddb-configsample tests fail. Three added fields with no sample line each fail one test naming the field: anOption<String>onAppConfig, a new section onAppConfig, and a nested struct onServerConfig.default_tls_enabledreturningfalsefails withenabled: sample has true, a missing key gives false.TlsConfig::default()withenabled: falsefails naming[server.tls (section left out)].default_portchanged to 18444 and the# portline removed each fail namingport. A description ending "No defaults." fails the marker test namingdocs_dir, and the generator then shows its example as the default. Acatalog_pool_sizeexample of 25 fails the PostgreSQL test. Amemorybuild default ofmem.sqlitefails the SQLite test. A marker sentence without its period fails the marker test andcheck:config.cargo check -p extenddb-config -p extenddb-backup-storewithout theserializefeature passes.npm run check:configreports a match, and exits 1 with the instruction when the sample changes. The strict site build passes with no broken link or anchor.html.docs-doc-id-configurationis on the Configuration page and on no other.python3 docs/build-docs.py --listshows document 20, and the HTML fragment of the page renders.At
3befe333ba,cargo package --workspace --no-verify --lockedanddevtools/check-crate-packagespass, as the package job runs them. The 13 sample tests ofextenddb-configpass again.CI at
dd6303315, the head the review saw: 60 checks passed.Publish to GitHub Pagesdid not run, because it runs only outside pull requests. Four entries from cancelled duplicate runs show as failed on that head.Against the base branch, the PR touches these files of more than 600 lines. Each one had more than 600 lines before this change:
docs/manuals/05-admin-guide.md, 1,612 to 1,507 lines.crates/storage-postgres/src/lib.rs, 1,060 to 1,065.crates/storage-mongodb/src/lib.rs, 872 to 877.crates/storage-cassandra/src/lib.rs, 656 to 661.crates/config/src/lib.rs, 608 to 613. Five lines each, for the test module declarations.crates/backup-store/src/config.rs, 668 to 672: the feature-gated derives.crates/config/src/backup.rs, 1,032 to 1,033: thecfg(test)derive.docs/manuals/14-backup-and-restore.md, 1,217 to 1,218,docs/manuals/07-upgrade-manual.md, 1,501, anddocs/install-from-source.md, 611: links.extenddb.sample.tomlgrows from 287 to 767 lines. It stays one file, because it is the template an operator copies and the source of the generated page. The whole change is +54 -12 lines of Rust production code and manifests, and +607 -16 of tests. The sample, docs, site and workflow are +1194 -355.Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
Breaking changes
None.
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.