feat(unstable): implement custom inspect for Deno.AtomicOperation #30077
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
Adds a custom inspect method to
AtomicOperation
to provide a readable string representation of the queued operations (checks, mutations, enqueues). This improves developer experience when debugging atomic operations by showing the internal state in a human-readable format.The implementation adds a custom
[Symbol.for("Deno.customInspect")]
method that formats the operations into a structured string showing:Related Issues
Fixes #21034
The issue requested better debugging/logging support for the
AtomicOperation
class to help developers understand what operations are queued in an atomic transaction.Changes
[Symbol.for("Deno.customInspect")]
method toAtomicOperation
classtests/unit/kv_test.ts
Testing
All tests verify the expected human-readable inspection strings match the actual output from
Deno.inspect()
.Checklist
cargo test
passes./tools/format.js
passes without changing files./tools/lint.js
passesAtomicOperation
s #21034Release Notes