Update linkset model with spec metadata#1900
Conversation
4a63ceb to
b5d2b3d
Compare
|
I think we need more opinion/clarification on this. Users (as is the case with grosser) may not know that they need to use metadata for links to be set. Putting a flash message on the web page is not among the nicest of migration strategies. |
|
Do we want to convert I assume when people learn about the metadata, they add all metadata fields instead of selectively choosing one or two fields. This is total speculation, but possibly verifiable. We could change all our handling to treat - version.metadata["documentation_uri"].presence || linkset&.docs&.presence
+ if version.metadata.present?
+ version.metadata["documentation_uri"].presence
+ else
+ linkset&.docs&.presence
+ end
|
kbrock
left a comment
There was a problem hiding this comment.
This looks nice as is.
Would be nice to not hardcode changelog in there.
Also, I guess I lean more towards getting rid of linkset rather than updating it.
But I haven't run the numbers yet to know adoption.
| def update_attributes_from_gem_specification!(spec) | ||
| update!(home: spec.homepage) | ||
| Links::LINKS.except("changelog", "download").each do |short, long| | ||
| self.attributes = { short => spec.metadata[long] } |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| self.attributes = { short => spec.metadata[long] } | ||
| end | ||
|
|
||
| self.home = spec.homepage if spec.homepage |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
|
Sorry, I'm being verbose on this PR. Also, sorry for changing my mind. The At first pass, I really liked the idea of updating Short termonly use - # version.medata.field || linkset.field
- version.metadata.field ? version.metadata.field : linkset.field
+ version.metadata ? version.metadata.field : linkset.field long termWhen we do decide to drop - # version.medata.field || linkset.field
- version.metadata.field ? version.metadata.field : linkset.field
+ (version.metadata || latest_version.metadata).fieldThe decision to drop |
A user setting
I would like to meet this expectation and not impose any expectation on users. We tend to consider versions and its data immutable once pushed to our server, showing legacy linkset values on older versions indefinitely is fine. |
Ugh. Very nice point. I guess once we removed the edit form for I like being conservative here. Most(?) gems are maintained by volunteers. So reducing work on them is preferable. But it is nice to have an end goal. Even if it is a multi year and possibly unrealistic plan. Have you run numbers to see how many gems are at play here? Have that many gems transitioned over to metadata? Do that many gems still rely upon the links table for current version urls? I'll have to download a recent copy of the database and get some numbers. It would probably add a better context to my aspirations. Maybe it is time to send out PRs to repos to request adding urls to gemspec metadata. I think @andrew did this from a script a little while ago. |
5% of gems which were updated in last year has used this (source). We are due a blog explaining rational for this feature.
linkset table has data we can't replace. I would argue our site is better for the fallback than using latest version. A good number of gems will never see latest version release just fixing links. We are due a blog post explaining this feature. |
|
For Ruby Toolbox I use gem's references to their GitHub repos to make the link and display github stats accordingly, so the availability of a github reference on the gemspec / rubygems.org API is very important for Ruby Toolbox's data quality. Today I wrote a little guide for project maintainers from the Toolbox's perspective, and I tried to emphasize to maintainers that having this in place is very relevant. During my research for this I realized that URLs web UI is not available anymore and the metadata way is the way to go. From what I've seen when speaking to maintainers in recent years I think that spec metadata links are still rather unknown (which seems to be backed up by the numbers mentioned by @sonalkr132 above) and rarely used, so it would be really great to have some blog post / additional guides to get the word out to gem maintainers that this is how it's supposed to be done now (even rails does not use them) Because of this, please do not drop legacy links if there are no existing links in the metadata, it would break the Ruby Toolbox's github linking for many gems :) However I believe it's fair to assume that if a gem has links in the metadata the legacy data can be ignored, I can't really think of maintainers being aware of this metadata links feature and then deciding to keep some things here and some things there :) |
|
... another approach could be to only drop a link when it is explicitly set to |
We are changing metadata links to all or nothing type. Having removed the edit form, there was no way update sidebar links to remove values shown from linkset. When user sets any of metadata uri attributes, it is safe to assume they are migrating away from linkset.
b5d2b3d to
bbbbfbd
Compare
I have updated my PR to do this. So yes, removal of metadata will take version release too and one would have to set at least one metadata uri attribute. I also wrote this. @kbrock please feel free to suggest changes to it. |
This screws half the number of gems who adopted URI attributes and it includes quite popular gems. I guess we should exclude |
closes #301 by using new logic from rubygems/rubygems.org#1900
We fall back to linkset when spec metadata is absent
(
version.metadata["documentation_uri"].presence || linkset&.docs&.presence).It keeps aside links populated for gems which don't see version updates.
This also meant that gem releases which have not set these links in spec
metadata, will also fallback to old linkset data. Intended behaviour
for not setting these links (for gem releases henceforth) should be that
we do not show the unset/empty links.
Closes: #1899
cc: @kbrock