readmeio / rdme

ReadMe's official command-line interface (CLI) and GitHub Action 🌊

Home Page:https://docs.readme.com/main/docs/rdme

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

createdAt is not correct when forking versions

vegaro opened this issue · comments

It looks like when creating a new version, the createdAt is copied from the forked version, so since a forked_from version is required, all versions have the same createdAt. This is what I get when calling GET versions:

[{"version"=>"1.0", "version_clean"=>"1.0.0", "codename"=>"", "is_stable"=>true, "is_beta"=>false, "is_hidden"=>false, "is_deprecated"=>false, "_id"=>"6478b73533c1c91fc6af2c7b", "createdAt"=>"2023-06-01T15:20:21.406Z"}, {"version"=>"5.0", "version_clean"=>"5.0.0", "codename"=>"", "is_stable"=>false, "is_beta"=>false, "is_hidden"=>true, "is_deprecated"=>false, "_id"=>"6478b764323c5414a272ebbb", "createdAt"=>"2023-06-01T15:20:21.406Z", "forked_from"=>"6478b73533c1c91fc6af2c7b"}, {"version"=>"5.0.1", "version_clean"=>"5.0.1", "codename"=>"", "is_stable"=>false, "is_beta"=>false, "is_hidden"=>true, "is_deprecated"=>false, "_id"=>"648347a6214986005f6f59a4", "createdAt"=>"2023-06-01T15:20:21.406Z", "forked_from"=>"6478b764323c5414a272ebbb"}, {"version"=>"5.1", "version_clean"=>"5.1.0", "codename"=>"", "is_stable"=>false, "is_beta"=>false, "is_hidden"=>false, "is_deprecated"=>false, "_id"=>"648347ca9e42140043eeec50", "createdAt"=>"2023-06-01T15:20:21.406Z", "forked_from"=>"6478b73533c1c91fc6af2c7b"}]

I need to programmatically get the latest version to determine which version to fork from and I was using the createdAt attribute to determine which one is the latest, but it looks like createdAt is always the same for all.

Thanks for spotting this @vegaro! This is an issue with our API. I have a fix up1 but it won't hit production for another day or two, I'll update this ticket once it's live.

Footnotes

  1. The fix should address any forked versions going forward, but unfortunately there's no way to retroactively apply this fix to previously forked versions.

Thanks for the heads up! We ended up using version comparison to determine the latest one 😃

Oh great 😅 in any case, it was a rare edge bug that nobody noticed before so thanks for pointing it out! The fix is live now so going to close this out.