Skip to content

Add Release published timestamp field to .proto#187

Merged
ericmj merged 1 commit into
hexpm:mainfrom
elfenlaid:package-published-at-timestamp
May 18, 2026
Merged

Add Release published timestamp field to .proto#187
ericmj merged 1 commit into
hexpm:mainfrom
elfenlaid:package-published-at-timestamp

Conversation

@elfenlaid
Copy link
Copy Markdown
Contributor

Part of hexpm/hex#1113

Specifically hexpm/hex#1113 (comment)


The idea is to replicate what hexpm shows for package release published timestamps in its web interface https://github.com/hexpm/hexpm/blob/78e8f9665992de71b22571c7d09fb738fffdd5f3/lib/hexpm_web/templates/package/versions.html.eex#L7

This published_at field is then going to be used to display a package release published dates in mix hex.outdated and for package cooldown checks described in this proposal https://gist.github.com/ericmj/16488f164ca2045e12f0f79a73c45031


// Based on google.protobuf.Timestamp
// https://github.com/protocolbuffers/protobuf/blob/v3.15.8/src/google/protobuf/timestamp.proto#L136:L147
message Timestamp {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exact same type lives in the neighbour file

optional Timestamp updated_at = 3;
}
// Based on google.protobuf.Timestamp
// https://github.com/protocolbuffers/protobuf/blob/v3.15.8/src/google/protobuf/timestamp.proto#L136:L147
message Timestamp {
required int64 seconds = 1;
required int32 nanos = 2;

Yet, I've decided against sharing this type as I think it would be easier to replace it with a native protobuf Timestamp available in the third version of protobuf.

Comment thread src/hex_pb_package.erl
-type '$msg'() :: 'Package'() | 'Release'() | 'RetirementStatus'() | 'SecurityAdvisory'() | 'Dependency'() | 'Timestamp'().
-export_type(['$msg_name'/0, '$msg'/0]).

-if(?OTP_RELEASE >= 24).
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear reviewers, please pay attention to this diff.

I'm not sure why these checks are dropped and it's possibly an error.

I believe it's related to gdb_opts from

hex_core/rebar.config

Lines 7 to 17 in 22992eb

{gpb_opts, [
{i, "proto"},
{o_erl, "src"},
{o_hrl, "src"},
{verify, always},
{strings_as_binaries, true},
{maps, true},
{maps_unset_optional, omitted},
{report_warnings, true},
{target_erlang_version, 17}
]}.
or to my Erlang version: Erlang/OTP 27 [erts-15.2.7.4]

@ericmj ericmj merged commit 5882d22 into hexpm:main May 18, 2026
10 checks passed
@ericmj
Copy link
Copy Markdown
Member

ericmj commented May 18, 2026

Thank you! 💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants