push-nrwyxtxvlsqn #2

Merged
eric merged 6 commits from push-nrwyxtxvlsqn into main 2026-11-08 12:20:10 +01:00
Owner
No description provided.
Refactor `.crate-kit` scripts by moving shared logic into dedicated library files to improve modularity. Update project dependencies to newer versions, including `dirs`, `aes-gcm`, `sha2`, `base64`, `tokio`, and `utoipa`. Refactor encryption logic in `src/encryption.rs` to use a sealing mechanism based on machine UUIDs.

- Move `filtre_instable` from `.crate-kit/scripts/api-level.sh` to `.crate-kit/scripts/common.sh`
- Relocate `index_path`, `latest_published`, `lock_entries`, `req_accepts`, and `req_for` from `.crate-kit/scripts/deps-check.sh` to the new `.crate-kit/scripts/deps-lib.sh`
- Add `.crate-kit/scripts/deps-check-external.sh` with functions `bad`, `declarations`, `rewrite_req`, and `floor_for` for external dependency checks
- Update `.crate-kit/VERSION` from 0.1.7 to 0.1.9
- Update `.crate-kit/dev-patch.mk` to include external dependency checks in `deps-check` and `deps-bump` targets
- Update dependencies in `Cargo.toml`: `dirs` to 7.0, `aes-gcm`/`sha2` to 0.11, `base64` to 0.23, `tokio` to 1.54, `utoipa` to 6.0 with `axum_extras`
- Refactor `src/encryption.rs`: add `key_from_uuid`, `seal`, and `open`; modify `derive_key`, `encrypt_password`, and `decrypt_password`; add tests for known answers
Improve documentation across the crate, standardize error handling with a new `Permission` variant, and introduce a `TODO.md` file to track future maintenance tasks including API breakage risks and dependency updates.

- Add `src/TODO.md` to categorize issues into API breakages and non-breaking changes, noting migration from `serde_yaml` 0.9 and documentation language consistency
- Update `src/error.rs` to add `Permission { message: String }` variant to `PmoConfigError` and update `Result` type alias
- Modify `src/config.rs` to handle missing files as new configurations in `load` and improve error handling in `get_managed_dir`
- Add TODO comments in `src/encryption.rs` regarding deprecated `wmic` on Windows and nonce derivation logic
- Update `src/openapi.rs` to set API version to "0.1.0" and describe the REST API purpose in French
- Document `src/spec.rs` prefix validation at load time and mark `key_salt`/`nonce_salt` for internal visibility
- Note inconsistencies in `src/typed.rs` regarding number handling and null key treatment in `get_number_or_set`
- Add TODOs in `src/global.rs` for integration tests and suggest `try_get_config` to avoid panics
- Update `src/lib.rs` to highlight missing documentation for public modules and warn about `missing_docs`
Refactor environment override logic into a dedicated function and improve
type handling for integer defaults. Add `tower` as a dev-dependency to
support new test infrastructure in `src/api.rs`.

- Move `apply_env_overrides` from `src/config.rs` to the new `env_overrides`
  function, updating `load` to use it and modifying `get_value` to merge
  overrides with cloned data.
- Update `get_number_or_set` in `src/typed.rs` to write integer defaults as
  integers when appropriate, adding a test for this behavior.
- Add `tower` dependency to `Cargo.toml` and update `tokio` version; modify
  `src/api.rs` to use `serde_json::to_value` and add new router/test functions.
- Add tests in `src/config_tests.rs` for environment overrides and empty
  sections, and update documentation for `merge_yaml` defaults.
Replace the deprecated `serde_yaml` crate with `serde_yaml_ng` across the codebase. Simplify the configuration update API by removing intermediate request/response structs, returning 204 No Content directly, and fixing error handling for permissions.

- Update Cargo.toml, Cargo.lock, and README.md to use `serde_yaml_ng` (v0.10.0) instead of `serde_yaml`.
- Refactor `src/config.rs`: switch YAML serialization/deserialization to `serde_yaml_ng`, simplify `config_dir` to return `&str`, and add `resolve_config_dir`.
- Simplify `src/api.rs`: remove `UpdateConfigRequest` and `UpdateConfigResponse`; update `update_config_value` to return `StatusCode` directly; fix `into_response` for `Permission` errors.
- Update `src/error.rs`: remove `PmoConfigError::Permission` variant, switch error imports to `serde_yaml_ng`, and mark `PmoConfigError` as `#[non_exhaustive]`.
- Update `src/openapi.rs`: remove `UpdateConfigRequest` and `UpdateConfigResponse` from OpenAPI schemas.
- Refactor `src/spec.rs`: add `is_valid_prefix` for runtime validation, remove `validate`, and update documentation regarding prefix checks.
- Update tests in `src/config_tests.rs` and `src/typed.rs` to use `serde_yaml_ng` imports and assertions.
Update Makefile to use --all-features for tests and docs, remove obsolete TODOs, and align encryption tests with a new oracle using MONAPP.

- .crate-kit/crate.mk: Add `--all-features` to `debug`, `test-doc`, `doc`, and `doc-build` commands.
- TODO.md: Remove three TODO comments regarding tokio dependencies, test behavior, and README compilation.
- src/encryption.rs: Update `test_known_answers_*` tests to use `AppSpec::new("MONAPP", "")`; update `KNOWN_ANSWERS` ciphertexts; clarify that vectors are generated by an independent oracle with a fixed UUID.
feat: release pmoconfig 0.2.0 with REST API and typed config support
All checks were successful
Release / release (push) Successful in 1m23s
406221cf57
Introduce a new `api` feature exposing a REST interface for configuration management, while refactoring the core library to use a tree-based storage model with strict typing. The crate now enforces machine-bound encryption, provides atomic file operations, and exposes detailed error contexts for debugging.

- Add `api` feature exposing `GET /api/config`, `GET /api/config/{path}`, and `POST /api/config` routes via Axum, with documentation in `src/openapi.rs` and `api/0.2.0.json`.
- Refactor configuration storage into `src/tree.rs`, moving `env_overrides` from `src/config.rs` and implementing key lowercasing, null removal, and merge logic.
- Update `src/config.rs` to use the new tree model, adding atomic save operations and environment override handling via `effective` and `lock`.
- Introduce typed readers in `src/typed.rs` (`get_integer`, `get_bool_or_set`) that treat absent values as `None` and enforce type safety during reads.
- Enhance error handling in `src/error.rs` with specific variants for YAML, JSON, and encryption errors, using French messages and context-aware IO errors.
- Implement machine-bound encryption in `src/encryption.rs`, checking `/etc/machine-id` and requiring `encrypted:` prefixes for decryption.
- Update global configuration management in `src/global.rs` with `try_get_config` to handle initialization order safely and prevent duplicate specs.
- Add comprehensive tests in `tests/global.rs` and `src/config_tests.rs` for atomic saves, null handling, and single-process configuration loading.
- Bump version to 0.2.0 in `Cargo.toml`, `.crate-kit/VERSION`, and `ReleaseNotes/version-0.1.1.md`.
- Update `README.md` to reflect new API routes, `init_in` usage, and environment override behavior.
eric merged commit e575e5983c into main 2026-11-08 12:20:10 +01:00
eric deleted branch push-nrwyxtxvlsqn 2026-11-08 12:20:13 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pmo/pmoconfig!2
No description provided.