Opened on 03/15/2019 at 02:08:12 AM

Closed on 04/12/2019 at 12:09:08 PM

Last modified on 07/26/2019 at 12:15:54 PM

#7371 closed change (fixed)

Generate subscriptions.json in adblockpluscore

Reported by: sebastian Assignee: tlucas
Priority: P2 Milestone:
Module: Automation Keywords:
Cc: tlucas, mjethani, greiner, hfiguiere Blocked By:
Blocking: #6977, #7338, #7360, #7425, #7459 Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

https://gitlab.com/eyeo/adblockplus/adblockpluscore/merge_requests/41

Description (last modified by mjethani)

Background

Currently, chrome/content/ui/subscriptions.xml in adblockpluscore is generated by sitescripts/subscriptions/bin/processTemplate.py in sitescripts.

For this one needed a sitescripts.ini with at least the following content:

[subscriptions]
recommendationsTemplate=subscriptions/template/recommendations.xml
repository=<subscriptionlist repository path>

, run the command

$ python -m sitescripts.subscriptions.bin.processTemplate recommendations subscriptions.xml

and finally copy the resulting subscriptions.xml to it's designated location.

This should rather be done by an npm script within adblockpluscore. Also we should rather use JSON (than XML), as it can be parsed more easily, in particular in manifest V3 background pages which no longer have access to DOMParser.

What to change

In adblockpluscore, add a script to the build/ folder and configure it as script in package.json, that generates data/subscriptions.json from the contents of https://hg.adblockplus.org/subscriptionlist, including the same metadata provided in chrome/content/ui/subscriptions.xml but in JSON format.

The script should be called as follows:

$ npm run generate-recommended-subscriptions

Integration Notes

  • The prefixes field is now an array and is named languages
  • The fields author and specialization are no longer available.
  • subscriptions.xml is no longer available, instead please use data/subscriptions.json

Attachments (0)

Change History (25)

comment:1 Changed on 03/15/2019 at 07:47:32 AM by tlucas

  • Owner set to tlucas

comment:2 Changed on 03/21/2019 at 03:53:38 PM by greiner

  • Cc greiner added

comment:3 Changed on 03/26/2019 at 01:15:37 PM by kzar

  • Blocking 7338 added

comment:4 Changed on 03/28/2019 at 09:45:39 PM by hfiguiere

  • Cc hfiguiere added

comment:5 Changed on 03/28/2019 at 10:06:43 PM by tlucas

  • Description modified (diff)

comment:6 Changed on 03/29/2019 at 12:12:29 AM by tlucas

  • Description modified (diff)

comment:7 Changed on 03/29/2019 at 12:17:19 AM by tlucas

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:8 in reply to: ↑ description ; follow-up: Changed on 03/29/2019 at 01:29:48 AM by sebastian

$ npm run generate-recommended-subscriptions <subscriptionlist repository location>

This is inconsistent wit the description above, which states that the script will put the file in data/subscriptions.json. There is no need for the path be configurable. FWIW updatepsl also hard-codes the patch ot the output file.

  • Once abpui adopted the new format, subscriptions.xml in chrome/content/ui/ should be deleted.

You can go ahead and delete chrome/content/ui/subscriptions.xml here. It won't break anything right away, as we use a hard-coded revision of adblockpluscore. Once we update the dependencies, we adapt for any breaking changes.

Last edited on 03/29/2019 at 01:29:59 AM by sebastian

comment:9 in reply to: ↑ 8 Changed on 03/29/2019 at 01:48:38 AM by tlucas

Replying to sebastian:

$ npm run generate-recommended-subscriptions <subscriptionlist repository location>

This is inconsistent wit the description above, which states that the script will put the file in data/subscriptions.json. There is no need for the path be configurable. FWIW updatepsl also hard-codes the patch ot the output file.

This is not an option to alter the output location, but to tell the script where to find the subscriptionlist repository.

  • Once abpui adopted the new format, subscriptions.xml in chrome/content/ui/ should be deleted.

You can go ahead and delete chrome/content/ui/subscriptions.xml here. It won't break anything right away, as we use a hard-coded revision of adblockpluscore. Once we update the dependencies, we adapt for any breaking changes.

Alright.

comment:10 Changed on 03/29/2019 at 12:46:32 PM by tlucas

  • Description modified (diff)

comment:11 follow-up: Changed on 03/29/2019 at 01:15:08 PM by greiner

What about mentioning in the integration notes that chrome/content/ui/subscriptions.xml has been renamed to data/subscriptions.json? It's quite an important information for anyone depending on it.

comment:12 Changed on 03/29/2019 at 01:17:59 PM by tlucas

  • Description modified (diff)

comment:13 in reply to: ↑ 11 Changed on 03/29/2019 at 01:18:46 PM by tlucas

Replying to greiner:

What about mentioning in the integration notes that chrome/content/ui/subscriptions.xml has been renamed to data/subscriptions.json? It's quite an important information for anyone depending on it.

IMHO that's already implicit in the description, but fair enough - added it.

comment:14 Changed on 03/29/2019 at 01:21:46 PM by greiner

  • Blocking 7425 added

comment:15 Changed on 03/30/2019 at 03:00:48 AM by sebastian

  • Blocking 6977 added

comment:16 Changed on 04/01/2019 at 03:17:32 PM by mjethani

As per a suggestion by Thomas in ticket:6977#comment:8, we might want to add some validation here as well.

comment:17 Changed on 04/02/2019 at 07:44:00 AM by tlucas

Let me please ask about some clarification (since i am accumulating information from #6977, this (#7371) and the Merge Request, as well as myself not being familiar with the overall topic). What i understand so far:

The suggested validation should

a) ensure that there is only one subscription of each type (but type=ads)
b) skip the validation on subscriptions having a potential new arbitrary key named recommended(=true)

[Please note: this will likely induce confusion. subscriptions.xml was already created from lists / variants of a subscription, which were marked as a complete "recommendation" (see e.g. here), meaning it is already consisting of recommendations only. So to mark a subscription as a valid nonunique type of subscription, we might want to us a different key, e.g. nonunique or arbitrary]

c) Essentially enable us to actually safely / sanely fix #6977, by the time we introduce the new subscriptions.json (i.e. when this ticket is fixed)

Are there additional assumptions mentioned nowhere so far, which should be validated?
Maybe i'm overcomplicating this, but since this is unknown territory for me (so far), would somebody please be so kind to update the ticket description so that i'm not missing anything (or contact me on other channels)? Thanks in advance!

comment:18 Changed on 04/02/2019 at 07:58:36 AM by mjethani

OK ... my bad, since #6977 is still under discussion, let's not bring that into this change here. The goal here is to port the old script to Node.js.

(I myself do not know the answers, by the way, and I do not see a point in delaying this change for something else still under discussion.)

comment:19 Changed on 04/03/2019 at 12:59:54 AM by sebastian

It seems the assumption rather is that the combination of type and language is unique (than type=ads being a special case). So if we implement any validation here, rather than introducing a new flag indicating subscriptions that must be the only one of its type (or the other way around), we rather might want to validate that for no combination of type+language there is more than one candidate.

Then again, I don't feel too strong if any validation is worth to be implemented here. We are in control of the repository subscriptions.json is compiled from, plus the script added here doesn't run automatically, but manually with its output being reviewed and tested.

comment:20 Changed on 04/03/2019 at 07:30:32 PM by sebastian

  • Description modified (diff)

comment:21 Changed on 04/12/2019 at 12:08:17 PM by abpbot

A commit referencing this issue has landed:
Issue 7371 - Create subscriptions.json via Node.js

comment:22 Changed on 04/12/2019 at 12:09:08 PM by tlucas

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:23 Changed on 04/12/2019 at 12:53:26 PM by greiner

  • Blocking 7459 added

comment:24 Changed on 04/27/2019 at 03:05:49 PM by mjethani

  • Description modified (diff)

comment:25 Changed on 07/26/2019 at 12:15:54 PM by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Done. Working as described and doesn't look to have caused any regressions with the build.

ABP 0.9.15.2339
Microsoft Edge 44.17763.1.0 / Windows 10 1809

ABP 3.5.2.2340
Chrome 49.0.2623.75 / Windows 10 1809
Chrome 75.0.3770.142 / Windows 10 1809
Opera 36.0.2130.65 / Windows 10 1809
Opera 62.0.3331.72 / Windows 10 1809
Firefox 51.0 / Windows 10 1809
Firefox 68.0 / Windows 10 1809
Firefox Mobile 68.0 / Android 7.2.2

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from tlucas.
 
Note: See TracTickets for help on using tickets.