Conversation
The sandbox rule-history view rendered each entry's event_time with format_timestamp_ms, which divided the epoch milliseconds by 86_400_000 to produce a days component. Because event_time is an absolute google.protobuf.Timestamp, that days component was days-since-1970, so every entry printed a nonsensical count such as "19675d 22:13" instead of a wall-clock date. Drop the buggy helper and format the timestamp with the existing format_optional_epoch_ms, matching how provider history and other absolute-time columns are rendered (and preserving the "-" placeholder for a missing/zero timestamp). Signed-off-by: Udaya Tejas <udayatejas2004@gmail.com>
udsy19
requested review from
a team,
derekwaynecarr,
mrunalp and
sjenning
as code owners
October 2, 2026 15:15
|
All contributors have signed the DCO ✍️ ✅ |
Contributor
Author
|
I have read the DCO document and I hereby sign the DCO. |
This branch has not been deployed
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
In the sandbox Rule History view, each entry's time renders as a days-since-1970 count (e.g.
19675d 22:13) instead of a wall-clock date.Root cause
sandbox_draft_historyformatsevent_timewithformat_timestamp_ms(crates/openshell-cli/src/commands/common.rs), which computesdays = secs / 86400and prints{days}d {hours:02}:{mins:02}. Butevent_timeis an absolutegoogle.protobuf.Timestamp(epoch ms), not an elapsed duration, sodaysis ~19,675.format_timestamp_mswas the only helper treating an absolute timestamp as a duration; the TUI'sformat_timestampand the CLI'sformat_epoch_ms/format_optional_epoch_msall render epoch-ms asYYYY-MM-DD HH:MM[:SS], and this was its sole caller.Fix
Render with the existing
format_optional_epoch_ms(asprovider.rsdoes for event times), preserving the-placeholder for a missing/zero timestamp. The mis-implementedformat_timestamp_mshelper is removed (no remaining references).Tests
Regression test in
common.rs:format_optional_epoch_ms(1_700_000_000_000) == "2023-11-14 22:13:20"andformat_optional_epoch_ms(0) == "-".cargo test -p openshell-cli: 88 passed.