Move logging initialization into Fastly adapter (PR 10)#610
Open
prk-Jr wants to merge 10 commits intofeature/edgezero-pr9-wire-signing-to-store-primitivesfrom
Open
Conversation
aram356
approved these changes
Apr 6, 2026
Collaborator
aram356
left a comment
There was a problem hiding this comment.
Summary
Clean, well-scoped extraction that correctly moves Fastly logging initialization into the adapter, making trusted-server-core backend-agnostic. No behavioral changes.
Non-blocking
🔧 wrench
- Unnecessary
#[allow(dead_code)]:init_logger()is called frommain.rs— the suppression is incorrect and would mask a real warning if the call is removed (logging.rs:8)
🤔 thinking
_messagevsmessage: The original used themessageparameter directly (idiomatic fern). The rename to_message+record.args()is semantically identical but gratuitous (logging.rs:18)
🌱 seedling
rsplit_oncealternative: More explicit thansplit("::").last()for extracting the final segment (logging.rs:4)- Missing test edge cases: No coverage for inputs without
::, empty strings, or trailing::(logging.rs:38)
👍 praise
- Clean separation of concerns:
log-fastlycorrectly removed from core, adapter owns its logging,pub(crate)visibility is correct - Thorough design and plan docs: Clear scope, out-of-scope boundaries, and reproducible implementation plan
- Reverted gratuitous _message rename and record.args() usage in logging.rs, returning to the idiomatic message parameter inside the fern format closure.
- Refactored target_label to use .rsplit_once("::") rather than .split("::").last(). This provides a more explicit and robust way to extract the final module segment.
- Expanded target_label test coverage to explicitly test edge cases such as inputs without :: separators, empty strings, and inputs with trailing ::.
ChristianPavilonis
approved these changes
Apr 7, 2026
aram356
requested changes
Apr 10, 2026
Collaborator
aram356
left a comment
There was a problem hiding this comment.
Summary
Clean extraction of Fastly logging initialization from trusted-server-core into trusted-server-adapter-fastly. The change is small, well-scoped, and achieves the stated goal of making core backend-agnostic for logging. CI passes.
Non-blocking
🤔 thinking
target_labelempty-result fallback:rsplit_onceon"trailing::"returns"", producing log output likeINFO [] message. Consider falling back to the full target when the extracted segment is empty. (crates/trusted-server-adapter-fastly/src/logging.rs:5)
📌 out of scope
trusted-server-corestill depends onfastlydirectly: Removinglog-fastlyis a step toward backend-agnostic core, butfastly = { workspace = true }remains in core's Cargo.toml. Worth tracking as a follow-up. (crates/trusted-server-core/Cargo.toml:25)
🌱 seedling
- Missing doc comments on
target_labelandinit_logger: Both arepub(crate)and lack///comments.init_loggeris a key startup function andtarget_labelhas non-obvious semantics — a brief doc comment would help. (crates/trusted-server-adapter-fastly/src/logging.rs:4,8)
⛏ nitpick
- Plan/implementation mismatch: Plan shows
split("::").last().unwrap_or(target)but implementation usesrsplit_once. Implementation is better, but the plan doc is now inaccurate. (docs/superpowers/plans/2026-04-02-pr10-logging-initialization.md:81)
CI Status
- integration tests: PASS
- browser integration tests: PASS
- prepare integration artifacts: PASS
docs/superpowers/plans/2026-04-02-pr10-logging-initialization.md
Outdated
Show resolved
Hide resolved
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
main.rs.log-fastlyfromtrusted-server-coreso core remains backend-agnostic and future Edgezero adapters can rely on the sharedlogfacade only.Changes
crates/trusted-server-adapter-fastly/src/logging.rscrates/trusted-server-adapter-fastly/src/main.rslogging::init_logger()and remove the inline Fastly logger implementation.crates/trusted-server-core/Cargo.tomllog-fastlydependency from core.Cargo.locklog-fastlydependency edge.docs/superpowers/specs/2026-04-02-pr10-logging-initialization-design.mddocs/superpowers/plans/2026-04-02-pr10-logging-initialization.mdCloses
Closes #491
Test plan
cargo test --workspacecargo clippy --workspace --all-targets --all-features -- -D warningscargo fmt --all -- --checkcd crates/js/lib && npx vitest runcd crates/js/lib && npm run formatcd docs && npm run formatcargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1fastly compute serveHardening note
Not applicable. This PR does not touch config-derived regex or pattern compilation.
Checklist
unwrap()in production code — useexpect("should ...")logmacros (notprintln!)