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 1, 2026 23:29
|
Thank you for your interest in contributing to OpenShell, @udsy19. This project uses a vouch system for first-time contributors. Before submitting a pull request, you need to be vouched by a maintainer. To get vouched:
See CONTRIBUTING.md for details. |
|
Thank you for your submission! We ask that you sign our Developer Certificate of Origin before we can accept your contribution. You can sign the DCO by adding a comment below using this text: I have read the DCO document and I hereby sign the DCO. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the DCO Assistant Lite bot. |
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_history(crates/openshell-cli/src/run.rs) formats each entry'sevent_timewithformat_timestamp_ms(crates/openshell-cli/src/commands/common.rs):But
event_timeis an absolutegoogle.protobuf.Timestamp(epoch ms, viaproto_timestamp_ms→timestamp_to_millis), not an elapsed duration — sodaysis ~19,675 and every entry prints garbage like19675d 22:13.format_timestamp_mswas the only helper in the crate that treated an absolute timestamp as a duration; the TUI'sformat_timestampand the CLI'sformat_epoch_ms/format_optional_epoch_msall correctly render epoch-ms asYYYY-MM-DD HH:MM[:SS], and this was its sole caller.Fix
Render the absolute timestamp with the existing
format_optional_epoch_ms(same helperprovider.rsuses for event times), which also preserves the-placeholder for a missing/zero timestamp. The mis-implementedformat_timestamp_mshelper is removed (no remaining references).Tests
Added a 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) == "-". Verified withcargo test -p openshell-cli --lib(fails on the old helper with19675d 22:13, passes after).