Replace hardcoded store name strings with constants in request signing#446
Open
ChristianPavilonis wants to merge 2 commits intomainfrom
Open
Replace hardcoded store name strings with constants in request signing#446ChristianPavilonis wants to merge 2 commits intomainfrom
ChristianPavilonis wants to merge 2 commits intomainfrom
Conversation
Scattered string literals for store names ("jwks_store", "signing_keys")
made the request signing module fragile and inconsistent with the
config-driven store IDs used by the admin endpoints.
Define JWKS_CONFIG_STORE_NAME and SIGNING_SECRET_STORE_NAME constants as
the single source of truth for edge-side store names, and document the
distinction between store names (edge reads) and store IDs (API writes).
Closes #399
aram356
reviewed
Mar 6, 2026
Collaborator
aram356
left a comment
There was a problem hiding this comment.
Summary
Clean extraction of hardcoded store name strings into module-level constants with good documentation. All CI checks pass.
Non-blocking
♻️ refactor
- Doc-link-only import masked by
#[allow(unused_imports)]:SIGNING_SECRET_STORE_NAMEimported only for an intra-doc link; use a fully-qualified path instead (rotation.rs:14)
🤔 thinking
- Test literals coincide with new constants:
rotation.rs:232and:246pass"jwks_store"/"signing_keys"as store IDs (management API), not store names (edge reads) — so they're semantically different from the constants. But the identical strings obscure that distinction. Consider using clearly distinct placeholder IDs (e.g."test-config-store-id","test-secret-store-id") or adding a comment clarifying these are management API store IDs, not edge store names.
👍 praise
- Store name vs store ID documentation: The module doc section clearly explains the two identifier concepts — this was the core confusion behind C-1 (mod.rs:6-16)
CI Status
- cargo fmt: PASS
- cargo test: PASS
- vitest: PASS
- format-docs: PASS
- format-typescript: PASS
| use crate::error::TrustedServerError; | ||
| use crate::fastly_storage::{FastlyApiClient, FastlyConfigStore}; | ||
| use crate::request_signing::JWKS_CONFIG_STORE_NAME; | ||
| #[allow(unused_imports)] |
Collaborator
There was a problem hiding this comment.
♻️ refactor — #[allow(unused_imports)] masks a doc-link-only import
SIGNING_SECRET_STORE_NAME is imported solely for the intra-doc link on line 43. The #[allow] tells readers this is dead code and invites accidental removal.
Suggestion: Drop the import and #[allow], use a fully-qualified path in the doc comment instead:
/// defined in [`JWKS_CONFIG_STORE_NAME`] and [`crate::request_signing::SIGNING_SECRET_STORE_NAME`].
| //! | ||
| //! Fastly stores have two identifiers: | ||
| //! | ||
| //! - **Store name** ([`JWKS_CONFIG_STORE_NAME`], [`SIGNING_SECRET_STORE_NAME`]): |
Collaborator
There was a problem hiding this comment.
👍 praise — The "Store names vs store IDs" doc section is excellent — this was the core confusion that made C-1 a critical finding. Great documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
JWKS_CONFIG_STORE_NAMEandSIGNING_SECRET_STORE_NAMEconstants as the single source of truth for edge-side store names, replacing 6 scattered string literalsConfigStore::openvs Fastly management API writes)KeyRotationManagerfields and constructor clarifying which identifier each holdsCloses #399
Related: #396 (production readiness audit)
Changes
crates/common/src/request_signing/mod.rscrates/common/src/request_signing/signing.rscrates/common/src/request_signing/jwks.rscrates/common/src/request_signing/rotation.rsTest plan
cargo test --workspace— all tests passcargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warnings