Skip to content

docs: configuration reference generated from the sample file, pinned to the structs - #537

Open
LeeroyHannigan wants to merge 34 commits into
feat/docs-content-sweepfrom
feat/docs-config-reference
Open

LeeroyHannigan wants to merge 34 commits into
feat/docs-content-sweepfrom
feat/docs-config-reference

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Changes since the last review

Nine commits on top of dd6303315 answer 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, the ttl_seconds = 0 refusal and expression depth.
  • f14bb58731: the pin tests read the field list from each struct's derived Deserialize. They compare values with serde's default for a missing key, and with the struct's Default for the ten sections a file can leave out. The root test pins AppConfig too.
  • e0b28d4e38: one rule for the "No default." marker in the tests and the generator.
  • 3f9c43d00f: Serialize on the backup store types behind a feature that only the tests turn on.
  • f61164cb97: the sample key check of tests/cli/test-doc-consistency.sh is 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 --check prints one line instead of its own diff.
  • b66caf7e68: merges docs: architecture dash sweep and one feature status owner #530's branch at 469669e59, which carries docs: one install page per path, first requests page, container upgrades #523's and docs: add the documentation site #491's branches and main up to 9e457a349. 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 of docs/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 #backupstore anchor that this PR removes, and the strict site build failed on it.
  • 3befe333ba: the extenddb-backup-store dev-dependency of extenddb-config names the crate by path. The package job failed at 00e67c4866, because devtools/check-crate-packages refuses 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.toml had [storage.mongodb], no SQLite or Cassandra section, and throttling_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.toml carries 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 = default line 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_enabled from [auth.cache] to [server], and max_import_bytes from [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-config and 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 derived Deserialize: struct_fields::<T>() records what the derive passes to deserialize_struct. So Option fields and struct-valued fields count, and the test needs no value of the struct. The backup format tests of extenddb-core have the same probe (FieldsProbe in crates/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 to AppConfig the 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. pin reads that value by deserializing a table that holds only the example keys. pin_with_default also compares each value with the struct's Default for 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 as store in [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.username and storage.cassandra.password. The PostgreSQL test pins the catalog_pool_size example to the fallback the getter gives when the key is unset. The tests check the other four, storage.backend, docs_dir, import_export_root and max_import_bytes, by name only.

The configuration structs derive Serialize where the tests need it. On the four backend configuration structs and on BackupConfig the derive is under cfg(test). On the four backup store types it is behind a serialize feature of extenddb-backup-store that only the dev-dependencies of extenddb-config turn on. S3StoreConfig can 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.mjs reads the sample and writes docs/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:config regenerates 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.py lists 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_bytes and never reads it: the limit is a 6,144-byte literal in the policy parser. The console settings page shows limits.max_tables_per_account, and nothing enforces it. DescribeLimits reports per_table_max_rcu and per_table_max_wcu, and CreateTable and UpdateTable do not enforce them. The page says so. Also corrected:

  • Logging goes to stderr under --foreground, not always to syslog.
  • Environment variable overrides work for scalar keys and not for list keys or the numeric keys of the SQLite and Cassandra sections. Their structs do not opt into string coercion.
  • The PostgreSQL connection budget counts the claim connection of each running backup or restore job. At startup the server raises a PostgreSQL pool smaller than 2 * max_concurrent_jobs + 10 to that size.
  • [auth.cache] startup validation rejects a zero ttl_seconds, a soft or negative TTL above the hard TTL, and a zero max_entries.
  • A dev-mode build ignores server.tls.enabled. It refuses a non-loopback bind address unless EXTENDDB_DEV_ALLOW_ANY_BIND=1 is set, as the dev image sets it.
  • [storage] reads only backend and 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.
  • The MongoDB pool keys leave the driver's pool size when unset.
  • import_export_root fills whichever of the two path lists is empty.
  • A sqlite-memory build defaults path to :memory:.
  • AND and OR do not add expression depth.
  • --port is the only serve flag 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 reaches main.

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_size falls back to pool_size. The MongoDB pool keys fall back to the driver's pool size, the connection string's maxPoolSize or 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_bytes on ten lines. The rules carry the html.docs-doc-id-configuration class, so the tables of other pages keep their widths.

tests/cli/test-doc-consistency.sh loses its Check 2 (each sample key named in the manuals). The generated page lists every key by construction, no workflow runs the script, and npm run check:config fails when the page is stale.

Merging

The stack below this PR is #491 (feat/docs-site, base main), #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. b66caf7e68 merges #530's branch at 469669e59, so this head contains #523's branch at af9567b6d and #491's branch at 49b856f58. 00e67c4866 changes line 564 of docs/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-tree reports no conflict for this head with main (5252eda31). #530's branch also merges with main without 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 removes display: table; width: 100% from the table rule and display: block; overflow-x: auto from 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. In website/sidebars.ts the 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.toml or the configuration structs, by the overlap check: #546, #874, #741, #635, #1352, #1154, #318, #140, #558, #571 and #987. #558 and #571 add limits.max_expression_operators and #987 adds storage.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 with npm run gen:config. The convention is one # key = default line under a description, with "No default." for a key without one. The pin tests and npm run check:config refuse anything else. #546 adds no key but edits the sample header and crates/config/src/lib.rs. It conflicts with this PR in those two files, in crates/storage-cassandra/src/config.rs and in docs/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, with CARGO_BUILD_JOBS=2:

  • The 13 sample tests of extenddb-config and the sample_toml test 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 -- --check exits 0. cargo clippy --all-targets -- -D warnings on the six touched crates gives no warning with CI's test-hooks features, with extenddb-engine/backup-test-hooks, and with no features. cargo clippy --all-targets -- -W clippy::pedantic on the six crates reports no warning on a line this PR adds. cargo +1.91.1 check --all-targets on the same six crates passes.
  • Mutation controls: with the base branch's sample, all 13 extenddb-config sample tests fail. Three added fields with no sample line each fail one test naming the field: an Option<String> on AppConfig, a new section on AppConfig, and a nested struct on ServerConfig. default_tls_enabled returning false fails with enabled: sample has true, a missing key gives false. TlsConfig::default() with enabled: false fails naming [server.tls (section left out)]. default_port changed to 18444 and the # port line removed each fail naming port. A description ending "No defaults." fails the marker test naming docs_dir, and the generator then shows its example as the default. A catalog_pool_size example of 25 fails the PostgreSQL test. A memory build default of mem.sqlite fails the SQLite test. A marker sentence without its period fails the marker test and check:config.
  • cargo check -p extenddb-config -p extenddb-backup-store without the serialize feature passes.
  • npm run check:config reports 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-configuration is on the Configuration page and on no other.
  • python3 docs/build-docs.py --list shows document 20, and the HTML fragment of the page renders.

At 3befe333ba, cargo package --workspace --no-verify --locked and devtools/check-crate-packages pass, as the package job runs them. The 13 sample tests of extenddb-config pass again.

CI at dd6303315, the head the review saw: 60 checks passed. Publish to GitHub Pages did 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: the cfg(test) derive.
  • docs/manuals/14-backup-and-restore.md, 1,217 to 1,218, docs/manuals/07-upgrade-manual.md, 1,501, and docs/install-from-source.md, 611: links.

extenddb.sample.toml grows 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

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, 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.

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.
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 demohan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Comment thread extenddb.sample.toml Outdated
# 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,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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/shared exits 1 with invalid type: string ..., expected a sequence, and an empty value gives the same error.
  • EXTENDDB__STORAGE__SQLITE__POOL_SIZE=8 exits 1 with invalid type: string "8", expected u32.
  • On Cassandra, CONTACT_POINTS gives expected a sequence and MAX_CONNECTIONS gives expected 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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread extenddb.sample.toml Outdated
# `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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread crates/config/src/sample_toml_tests.rs Outdated
use extenddb_core::limits::LimitsConfig;

#[test]
fn top_level_keys_are_the_optional_app_config_fields() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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 Option field on AppConfig;
  • a new section;
  • a new nested-struct field on ServerConfig or AuthConfig.

Deriving the root keys and sections from the struct, and descending into nested structs, would make the body's claim hold for every field.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread extenddb.sample.toml Outdated
# authorization traffic; size for their combined
# concurrency.

# Maximum concurrent connections for data operations. Unset means 50. No

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread website/src/css/custom.css Outdated
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,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread extenddb.sample.toml
# 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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In a sqlite-memory build the path default is :memory:, not extenddb.sqlite.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 8205510. The path description starts: "Database file. The default shown is the file build's. A sqlite-memory build defaults to ":memory:"." The SQLite pin test checks that a memory build gives :memory: for a missing path and compares the path's type only in that build (f14bb58).

Comment thread extenddb.sample.toml Outdated
# — 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread extenddb.sample.toml
# `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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread crates/backup-store/src/config.rs Outdated
/// 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)]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread tests/cli/test-doc-consistency.sh Outdated
@@ -100,7 +100,7 @@ if [ -f extenddb.sample.toml ]; then
for key in $SAMPLE_KEYS; do

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The config-key check now searches a page generated from the sample it enumerates, so it cannot fail.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. The four conditions are in:

  • Environment text: f4a77be restores the sentences 7612ce3 replaced in the sample header, the generator paragraph, the generated page and the admin guide. The "Depends on" section is gone from the body. fix(config): environment overrides for every backend key; Cassandra refuses unknown keys #546 carries the list-form text when it lands.
  • The three field kinds: f14bb58 reads the field list from each struct's derived Deserialize (struct_fields::<T>()) and pins AppConfig's top-level keys and sections to its fields. It compares values with serde's default for a missing key, and with T::default() for the ten sections a file can leave out. Your three controls each fail one test with the field named, and a changed default_tls_enabled fails too.
  • The console doc set: 7685ebc adds docs/configuration.md to DOCUMENTS in docs/build-docs.py as entry 20, slug configuration. The console and the PDF set now carry the page the admin guide points at.
  • The MongoDB pool lines: 8205510 says an unset key leaves the driver's pool size, the connection string's maxPoolSize or else 10. The examples are production values. The body's Decisions sentence says the same.

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: [storage] drops unknown keys. #1506: the clamp to 10 that cannot fire on the serve path.

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 demohan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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__PATHS and EXPORT__PATHS stop with expected a sequence and SQLITE__POOL_SIZE=8 with expected u32, and on PostgreSQL POSTGRES__POOL_SIZE=8 overrides 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, and ttl_seconds = 0 stops 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 on ServerConfig and AuthConfig, a new PostgreSQL Option and 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 in Cargo.lock, DEFAULT_MAX_POOL_SIZE is 10 per server pool, and apply_max_pool_size sets maxPoolSize only when the key is set, for the data and catalog clients, as the pool lines say.
  • build-docs.py lists the configuration page and a server with docs_dir serves /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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation v1 Needed for the 1.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants