Skip to content

feat(configuration): copy v2_0_0 schema to v3_0_0 as baseline (#1979)#1999

Merged
josecelano merged 3 commits into
torrust:developfrom
josecelano:config-copy-v2-to-v3-baseline
Jul 20, 2026
Merged

feat(configuration): copy v2_0_0 schema to v3_0_0 as baseline (#1979)#1999
josecelano merged 3 commits into
torrust:developfrom
josecelano:config-copy-v2-to-v3-baseline

Conversation

@josecelano

Copy link
Copy Markdown
Member

Summary

Subissue #1 of 9 in EPIC #1978 — Configuration Overhaul (schema v3.0.0).

This is the foundation PR: all other subissues in the EPIC depend on this being merged first.

What this PR does

  • Copies packages/configuration/src/v2_0_0/v3_0_0/ as the clean baseline for all v3 breaking changes
  • Updates all internal v2_0_0 references inside v3_0_0/ (doc links, VERSION constant, test imports, schema version strings in test fixtures)
  • Merges the crate-root logging.rs behaviour (TraceStyle, setup(), tracing_init()) into both v2_0_0/logging.rs and v3_0_0/logging.rs, making each versioned module fully self-contained
  • Adds pub mod v3_0_0 to lib.rs alongside pub mod v2_0_0
  • Adds Metadata::with_schema_version helper constructor to lib.rs
  • Adds an explicit Default impl for v3_0_0::Configuration that sets schema_version = "3.0.0"
  • Adds smoke tests: v3 parser accepts "3.0.0" configs and rejects "2.0.0" configs

What is intentionally NOT done here

Global re-exports (pub type Configuration = v2_0_0::Configuration, etc.) and default config files stay at v2 until subissue #1980 (final cleanup), when all consumers are migrated atomically. Doing it now would require touching ~30 consumer files and tangle subsequent subissues (#2#8) that are still modifying the v3 types.

AC3 (application uses v3 by default) and AC5 (config files reference "3.0.0") are explicitly deferred to #1980.

Verification

  • linter all → ✅ passed
  • cargo test --doc --workspace → ✅ passed
  • Full workspace test suite (48 suites) → ✅ 0 failures
  • Pre-commit hook passed automatically on commit

Related

Copilot AI review requested due to automatic review settings July 20, 2026 09:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR establishes the configuration schema v3.0.0 baseline by copying the existing v2.0.0 schema into a new v3_0_0 module, updating internal references to point at v3, and making versioned modules more self-contained (notably around logging) while keeping global re-exports on v2 until the final migration subissue.

Changes:

  • Introduces packages/configuration/src/v3_0_0/ as a v2-derived baseline and exposes it via pub mod v3_0_0.
  • Adds Metadata::with_schema_version and a v3_0_0::Configuration default that pins schema_version = "3.0.0", plus smoke tests for version acceptance/rejection.
  • Duplicates crate-root logging setup into both v2_0_0::logging and v3_0_0::logging for versioned self-containment.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/configuration/src/v3_0_0/udp_tracker.rs Adds v3 UDP tracker config struct + defaults.
packages/configuration/src/v3_0_0/tracker_api.rs Adds v3 HTTP API config (access tokens, TLS config placeholder) + tests.
packages/configuration/src/v3_0_0/network.rs Adds v3 network config + validated ExternalIp type.
packages/configuration/src/v3_0_0/mod.rs Adds v3 root configuration module, loader, defaults, and smoke tests.
packages/configuration/src/v3_0_0/logging.rs Adds v3 logging config and initialization helpers.
packages/configuration/src/v3_0_0/http_tracker.rs Adds v3 HTTP tracker config struct + defaults.
packages/configuration/src/v3_0_0/health_check_api.rs Adds v3 health check API bind config + defaults.
packages/configuration/src/v3_0_0/database.rs Adds v3 DB config + secret-masking helpers/tests.
packages/configuration/src/v3_0_0/core.rs Adds v3 core config wiring (announce policy, DB, net, etc.).
packages/configuration/src/v2_0_0/logging.rs Makes v2 logging module self-contained by embedding setup helpers.
packages/configuration/src/logging.rs Points crate-root logging setup at v2 logging types.
packages/configuration/src/lib.rs Exposes v3_0_0 module and adds Metadata::with_schema_version.
docs/issues/open/1979-1978-copy-configuration-schema-v2-to-v3-baseline.md Updates spec progress, marks deferred items, and records verification.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/configuration/src/v3_0_0/udp_tracker.rs Outdated
Comment thread packages/configuration/src/v3_0_0/http_tracker.rs Outdated
Comment thread packages/configuration/src/v3_0_0/core.rs Outdated
Comment thread packages/configuration/src/v3_0_0/tracker_api.rs Outdated
Comment thread packages/configuration/src/v3_0_0/tracker_api.rs
Comment thread packages/configuration/src/v3_0_0/mod.rs Outdated
Comment thread packages/configuration/src/v3_0_0/mod.rs Outdated
…t#1979)

Subissue #1 of EPIC torrust#1978 — Configuration Overhaul (schema v3.0.0).

- Copy `packages/configuration/src/v2_0_0/` to `v3_0_0/` as the
  starting point for all breaking changes
- Update all internal `v2_0_0` references in `v3_0_0/` to `v3_0_0`
  (doc links, VERSION constant, test imports, schema_version strings)
- Merge the crate-root `logging.rs` behaviour (TraceStyle, setup,
  tracing_init) into both `v2_0_0/logging.rs` and `v3_0_0/logging.rs`,
  making each versioned module fully self-contained
- Add `pub mod v3_0_0` to `lib.rs` alongside `pub mod v2_0_0`
- Add `Metadata::with_schema_version` helper constructor to `lib.rs`
- Add `v3_0_0::Configuration::Default` impl that sets schema version
  to "3.0.0" explicitly
- Add smoke tests: v3 loads "3.0.0" configs and rejects "2.0.0" configs
- Global re-exports and default config files stay at v2 until the final
  cleanup subissue torrust#1980 switches all consumers atomically

T6 (update default config files) and T7 (wire bootstrap to v3) are
deferred to torrust#1980: the bootstrap uses the global `Configuration`
re-export (= v2_0_0) and cannot be switched without migrating all
consumers at once.

All 48 test suites pass; `linter all` exits 0.

Closes torrust#1979
@josecelano
josecelano force-pushed the config-copy-v2-to-v3-baseline branch from 95d93fe to cd786f1 Compare July 20, 2026 09:44
- Fix "Weather" → "Whether" typo in doc comments for
  `tracker_usage_statistics` field in v2_0_0 and v3_0_0
  (udp_tracker.rs, http_tracker.rs, core.rs)
- Fix v3_0_0/mod.rs module doc: "Version `1`" → "Version `3`"
- Fix v3_0_0/mod.rs TSL section: replace reference to non-existent
  `ssl_enabled` flag with accurate description of `tsl_config` section
- Fix v3_0_0/tracker_api.rs: remove reference to non-existent
  `ssl_enabled` field in `tsl_config` doc comment
- Simplify `default_access_tokens()` in v3_0_0/tracker_api.rs:
  replace `[].iter().cloned().collect()` with `HashMap::new()`
@josecelano

Copy link
Copy Markdown
Member Author

All 7 Copilot review comments have been addressed in commit 2b6bc1a3:

  1. Weather → Whether (3 files): udp_tracker.rs, http_tracker.rs, core.rs — fixed in both v2_0_0 and v3_0_0
  2. ssl_enabled doc in tracker_api.rs: replaced with accurate description of tsl_config section
  3. default_access_tokens() simplification: HashMap::new() instead of iterator
  4. Module doc "Version 1" → "Version 3" in v3_0_0/mod.rs
  5. TSL section doc in v3_0_0/mod.rs: replaced ssl_enabled reference with accurate tsl_config section docs

@josecelano

Copy link
Copy Markdown
Member Author

ACK 2b6bc1a

@josecelano
josecelano merged commit e22ad27 into torrust:develop Jul 20, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants