-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace Diff-Name with resource name #2
Conversation
See the discussion here: AdguardTeam/FiltersCompiler#192 (comment) Updated the spec according to the discussion: 1. Diff-Name is replaced with a resource name specified as a part of Diff-Path 2. Optional timestamp added to the diff directive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the examples, there are some differences:
In examples 1-2, versions of filters 1.0.0 and 1.0.1 do not have an empty line at the end, while version 1.0.2 does.
In example 3, all filters have an empty line at the end.
@ameshkov Is this done intentionally?
@105th yes, that was done intentionally so that we could check that the implementation is able to handle the case where there's no new line in the end of file. |
From my experience so far, the Now regarding The |
Well, removing timestamp is not a problem. Generally, I think that the Regarding your approach with encoding additional information in
Tbh, I don't really understand the need to avoid storing and, what's more important, generating it on the client-side. When you generate it on the client-side, you are 100% sure that it's correct. Many things can go wrong on the server, you'll need to take possible unexpected input into account (the simplest example would be having date in the future). Finally, it ties your own hands: you'll have to generate patches exactly this way and you won't be able to change anything on the server-side once you deploy this version to the users (eventually, you will, but doing it without hurting users requires time and effort). |
All that said, what do you think about standardizing I think the fact that there's no place on the Internet that defines what kind of fields can be actually used by maintainers does not help. And it's rather easy to fix just by providing the universally supported guidelines (which we all kind of already do, but never wrote it down). |
It's difficult to discuss with "in theory" scenarios, so let's just be very specific about what's going through my mind. Here is the code that avoid fetching unnecessarily: https://github.com/gorhill/uBlock/blob/1.53.3rc0/src/js/diff-updater.js#L237-L241 That code derives patch time creation from patch name, then add I think you are arguing that the patch creation time should be associated and stored with each asset to patch, and that the patch creation time is provided in
This already happened and it's really not an issue, it's pretty simple client-side, at the first unexpected outcome for any required step, diff-updater does nothing and in the end all fall back to the usual auto-update with |
Absolutely, that's why Now that I am thinking about it I got another idea, we could make the patch itself the source of all necessary information. Something like this:
I had two points actually: My first point is that it's safer to generate the last-updated timestamp on the client-side because of the possible mistakes that could happen on the server-side. Talking about your code, two scenarios:
Is that all a major issue? Not at all, I'd say that it's a matter of preference, but with a client-side generated timestamp you're protected from these scenarios.
|
What happens the first time you fetch a list? How do you know when to make a hopefully successful fetch for a patch? You have the Clearly where we diverge is you have issue with encoding that information in the name, whereas I do not see this as an issue: if it's in the spec, why worry about changing this in the future? What could ever happen that this becomes a burden? If the spec says this is the way, then whoever want to properly implement diff-updating their list will have to just follow the spec or use available tools that does all this for them. |
Good questions. It just bothers me that both the expiration period and the timestamp are properties of the patch file and they should be the same in every list that refers to that patch file. Let me put aside personal preference and analyze advantages and disadvantages, please correct me if I am wrong anywhere. One important detail: if we start encoding information in the file name, I think we should encode the expiration period there too. As I said, I think it's a property of the patch file, just like the timestamp, so it'd be strange to store one here and one there.
All in all, I'd say that the disadvantage is not that serious since there's still a way to upgrade the spec and avoid issues. Here's what I propose then:
UPD I read this and realized that I basically repeat what you proposed. Minutes since epoch is also okay I guess. |
It's me nitpicking, personally I prefer the expire value to come after the creation time, it reads more naturally in my opinion: this patch was created on
Could even be chunk of 5, 10 or 15, i.e. whatever resolution is most certainly the minimum ever needed. This would shorten a bit the string. Resolution could be even left to the patch emitter:
Where both
Whereas implicitly in minutes this would be:
|
Please check the updated spec. @gorhill I've incorporated most of what we talked about. Notable changes:
|
Co-authored-by: Dmitry Seregin <[email protected]>
Co-authored-by: Dmitry Seregin <[email protected]>
Co-authored-by: Dmitry Seregin <[email protected]>
See the discussion here: AdguardTeam/FiltersCompiler#192 (comment)
Updated the spec according to the discussion: