Skip to content

Commit

Permalink
Process document and patent policy links updates (#1838)
Browse files Browse the repository at this point in the history
* allow old and new process document links. If the old link is detected, returns the new link in the metadata

* allow old and new process document links

* replace PP link

* process document link update

* test fix

* allow new PP link

* update PP2020 link

* update PP2020 link

* update tests to use the latest PP 2020 link

* allow old PP link
  • Loading branch information
deniak authored Jun 17, 2024
1 parent 861f743 commit 59860c8
Show file tree
Hide file tree
Showing 33 changed files with 205 additions and 182 deletions.
4 changes: 2 additions & 2 deletions lib/l10n-en_GB.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const messages = {
'sotd.stability.no-cr-review':
'No wide review link for Candidate Recommendation',
'sotd.stability.wrong-cr-review-link':
"Wrong wide review link for Candidate Recommendation, link should be 'https://www.w3.org/2023/Process-20231103/#dfn-wide-review'",
"Wrong wide review link for Candidate Recommendation, link should be 'https://www.w3.org/policies/process/20231103/#dfn-wide-review'",
'sotd.stability.no-licensing-link':
"Wrong royalty-free licensing link for CR and REC, link should be ${licensingLink} with text '${licensingText}'",
// sotd/review-end
Expand Down Expand Up @@ -281,7 +281,7 @@ export const messages = {
'Deliverer not found. An attribute <code>data-deliverer</code> must be in the SotD',
// sotd/new-features
'sotd.new-features.no-link':
'The paragraph on future updates to the recommendation should include a link to the new features: https://www.w3.org/2023/Process-20231103/#allow-new-features',
'The paragraph on future updates to the recommendation should include a link to the new features: https://www.w3.org/policies/process/20231103/#allow-new-features',
'sotd.new-features.no-warning':
"<strong style='font-size: 20px;'>If it is the intention to incorporate new features in future updates of the Recommendation, please make sure to identify the document as intending to allow new features.</strong>",
// structure/canonical
Expand Down
80 changes: 40 additions & 40 deletions lib/rules.json

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions lib/rules/metadata/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ export function check(sr, done) {
const processDocument = sr.jsDocument.querySelector(
'a#w3c_process_revision'
);
if (!processDocument || !processDocument.getAttribute('href')) {
const processDocumentHref =
processDocument && processDocument.getAttribute('href');
if (!processDocumentHref) {
return done();
}
return done({ process: processDocument.getAttribute('href') });
const process =
processDocumentHref === 'https://www.w3.org/2023/Process-20231103/'
? 'https://www.w3.org/policies/process/20231103/'
: processDocumentHref;
return done({ process });
}
8 changes: 6 additions & 2 deletions lib/rules/sotd/new-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ export function check(sr, done) {
`Future updates to this ${docType} may incorporate new features.`
);
const linkTxt = 'new features';
const linkHref =
const linkHrefOld =
'https://www.w3.org/2023/Process-20231103/#allow-new-features';
const linkHrefNew =
'https://www.w3.org/policies/process/20231103/#allow-new-features';

if (sotd && sr.norm(sotd.textContent).match(warning)) {
const foundLink = Array.prototype.some.call(
sotd.querySelectorAll('a'),
a => sr.norm(a.textContent) === linkTxt && a.href === linkHref
a =>
sr.norm(a.textContent) === linkTxt &&
[linkHrefNew, linkHrefOld].includes(a.href)
);
if (!foundLink) {
sr.error(self, 'no-link');
Expand Down
44 changes: 20 additions & 24 deletions lib/rules/sotd/pp.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const self = {
};

const ppLink = 'https://www.w3.org/Consortium/Patent-Policy/';
const ppLinkNew = 'https://www.w3.org/policies/patent-policy/';
const pp2020 = 'https://www.w3.org/Consortium/Patent-Policy-20200915/';
const pp2020New = 'https://www.w3.org/policies/patent-policy/20200915/';
const pp2017 = 'https://www.w3.org/Consortium/Patent-Policy-20170801/';

/**
Expand All @@ -22,8 +24,7 @@ function buildWanted(groups, sr, ppLink) {
const isPP2017 = ppLink === pp2017;
const isRecTrack = config.track === 'Recommendation';

let ppText = '( 15 September 2020)?';
if (isPP2017) ppText = ' 1 August 2017';
const ppText = isPP2017 ? ' 1 August 2017' : '( 15 September 2020)?';

wanted = `This document was produced by ${
groups.length === 2 ? 'groups ' : 'a group '
Expand Down Expand Up @@ -68,12 +69,12 @@ function buildWanted(groups, sr, ppLink) {
* @param sr
* @param isIGDeliverable
*/
function findPP(candidates, sr, isIGDeliverable) {
function findPP(candidates, sr, ppLink) {
let pp = null;
const delivererGroups = sr.getDelivererNames();
if (delivererGroups.length > 1) sr.warning(self, 'joint-publication');

const wanted = buildWanted(delivererGroups, sr, isIGDeliverable);
const wanted = buildWanted(delivererGroups, sr, ppLink);
const expected = wanted.text;
Array.prototype.some.call(candidates, p => {
const text = sr.norm(p.textContent);
Expand Down Expand Up @@ -117,31 +118,33 @@ export async function check(sr, done) {
const sotd = sr.getSotDSection();
const isRecTrack = sr.config.track === 'Recommendation';

let patent = sr.config.patentPolicy;
if (sr.config.patentPolicy === 'pp2020') {
patent = pp2020;
} else if (sr.config.patentPolicy === 'pp2004') {
patent = pp2017;
const isPP2017 = sr.config.patentPolicy === 'pp2004';
const isPP2020 = sr.config.patentPolicy === 'pp2020';
let possiblePP = [];
if (isPP2020) {
possiblePP = [ppLink, ppLinkNew, pp2020, pp2020New];
} else if (isPP2017) {
possiblePP = [pp2017];
}
// If is joint publication and no pp is set, use latest pp
if (!publishedByWgOnly && patentPolicies.every(pp => pp === undefined)) {
patent = pp2020;
possiblePP = [ppLinkNew, ppLink, pp2020New, pp2020];
}
// Make sure the pp version is consistent between the UI or the one defined in the charter.
if (
publishedByWgOnly &&
patentPolicies[0] &&
patentPolicies[0] !== patent
!possiblePP.includes(patentPolicies[0])
) {
sr.error(self, 'wrong-pp-from-charter', {
pp_charter: patentPolicies[0],
pp_config: patent,
pp_config: isPP2017 ? 'pp2017' : 'pp2020',
});
return done();
}

if (sotd) {
if (!patent) {
if (!Array.isArray(possiblePP) || !possiblePP.length) {
sr.error(self, 'undefined');
return done();
}
Expand All @@ -156,13 +159,6 @@ export async function check(sr, done) {
return done();
}

let possiblePP = [];
if (patent === pp2020) {
possiblePP = [ppLink, pp2020];
} else if (patent === pp2017) {
possiblePP = [pp2017];
}

let found2017 = false;
let found2020 = false;
let foundPublicList = false;
Expand All @@ -172,7 +168,7 @@ export async function check(sr, done) {
const href = a.getAttribute('href');
const text = sr.norm(a.textContent);
if (
patent === pp2020 &&
isPP2020 &&
possiblePP.includes(href) &&
/(15 September 2020 )?W3C Patent Policy/.test(text)
) {
Expand All @@ -181,7 +177,7 @@ export async function check(sr, done) {
}

if (
patent === pp2017 &&
isPP2017 &&
possiblePP.includes(href) &&
/1 August 2017 W3C Patent Policy/.test(text)
) {
Expand Down Expand Up @@ -214,8 +210,8 @@ export async function check(sr, done) {
}
});

if (patent === pp2017 && !found2017) sr.error(self, 'no-pp2017');
else if (patent === pp2020 && !found2020) sr.error(self, 'no-pp2020');
if (isPP2017 && !found2017) sr.error(self, 'no-pp2017');
else if (!isPP2017 && !found2020) sr.error(self, 'no-pp2020');
if (!foundPublicList && isRecTrack) sr.error(self, 'no-disclosures');
if (
(sr.config.track === 'Recommendation' ||
Expand Down
7 changes: 5 additions & 2 deletions lib/rules/sotd/process-document.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export function check(sr, done) {
const BOILERPLATE_PREFIX = 'This document is governed by the ';
const BOILERPLATE_SUFFIX = ' W3C Process Document.';
const newProc = '03 November 2023';
const newProcUri = 'https://www.w3.org/2023/Process-20231103/';
const newProcOldUri = 'https://www.w3.org/2023/Process-20231103/';
const newProcNewUri = 'https://www.w3.org/policies/process/20231103/';
const previousProc = '12 June 2023';
const previousProcUri = 'https://www.w3.org/2023/Process-20230612/';
let previousAllowed;
Expand Down Expand Up @@ -44,7 +45,9 @@ export function check(sr, done) {
if (
sr.norm(p.textContent) === boilerplate &&
link &&
link.getAttribute('href') === newProcUri
[newProcOldUri, newProcNewUri].includes(
link.getAttribute('href')
)
) {
if (found)
sr.error(self, 'multiple-times', { process: newProc });
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/sotd/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export async function check(sr, done) {
/^https:\/\/www.w3.org\/2023\/Process-2023(0612|1103)\//;
},
doAfter() {
baseURL = /^https:\/\/www.w3.org\/2023\/Process-20231103\//;
baseURL =
/^https:\/\/www.w3.org\/(2023\/Process-|policies\/process\/)20231103\//;
},
});

Expand Down
12 changes: 8 additions & 4 deletions lib/rules/sotd/stability.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ export async function check(sr, done) {
);
if (!review) sr.error(self, 'no-cr-review');
else if (
review.href !==
'https://www.w3.org/2023/Process-20231103/#dfn-wide-review'
![
'https://www.w3.org/2023/Process-20231103/#dfn-wide-review',
'https://www.w3.org/policies/process/20231103/#dfn-wide-review',
].includes(review.href)
)
sr.error(self, 'wrong-cr-review-link');
}
Expand All @@ -120,16 +122,18 @@ export async function check(sr, done) {
const licensingText = 'royalty-free licensing';
const licensingLink =
'https://www.w3.org/Consortium/Patent-Policy/#sec-Requirements';
const licensingLinkNew =
'https://www.w3.org/policies/patent-policy/#sec-Requirements';
const licensingFound = Array.prototype.some.call(
links,
link =>
sr.norm(link.textContent) === licensingText &&
link.href === licensingLink
[licensingLink, licensingLinkNew].includes(link.href)
);
if (!licensingFound)
sr.error(self, 'no-licensing-link', {
licensingText,
licensingLink,
licensingLinkNew,
});
}
}
Expand Down
18 changes: 12 additions & 6 deletions lib/rules/sotd/submission.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@ export function check(sr, done) {
}

// check the links
const w3cProcess = 'https://www.w3.org/Consortium/Process';
const w3cProcessOld = 'https://www.w3.org/Consortium/Process';
const w3cProcessNew = 'https://www.w3.org/policies/process/';
const w3cMembership =
'https://www.w3.org/Consortium/Prospectus/Joining';
const w3cPP =
const w3cPPOld =
'https://www.w3.org/Consortium/Patent-Policy/#sec-submissions';
const w3cPPNew =
'https://www.w3.org/policies/patent-policy/#sec-submissions';
const w3cSubm = 'https://www.w3.org/submissions/';
let foundW3CProcess = false;
let foundW3CMembership = false;
Expand All @@ -67,7 +70,10 @@ export function check(sr, done) {
st.querySelectorAll('a[href]').forEach(a => {
const href = a.getAttribute('href');
const text = sr.norm(a.textContent);
if (href === w3cProcess && text === 'W3C Process') {
if (
[w3cProcessNew, w3cProcessOld].includes(href) &&
text === 'W3C Process'
) {
foundW3CProcess = true;
return;
}
Expand All @@ -76,7 +82,7 @@ export function check(sr, done) {
return;
}
if (
href === w3cPP &&
[w3cPPNew, w3cPPOld].includes(href) &&
text === 'section 3.3 of the W3C Patent Policy'
) {
foundPP = true;
Expand Down Expand Up @@ -105,7 +111,7 @@ export function check(sr, done) {
});
if (!foundW3CProcess)
sr.error(self, 'link-text', {
href: w3cProcess,
href: w3cProcessNew,
text: 'W3C Process',
});
if (!foundW3CMembership)
Expand All @@ -115,7 +121,7 @@ export function check(sr, done) {
});
if (!foundPP)
sr.error(self, 'link-text', {
href: w3cPP,
href: w3cPPNew,
text: 'section 3.3 of the W3C Patent Policy',
});
if (!foundSubm)
Expand Down
6 changes: 4 additions & 2 deletions public/js/specberus.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,10 @@ jQuery.extend({
) {
patentPolicy = 'pp2004';
} else if (
data.metadata.patentPolicy ===
'https://www.w3.org/Consortium/Patent-Policy-20200915/'
[
'https://www.w3.org/policies/patent-policy/20200915/',
'https://www.w3.org/Consortium/Patent-Policy-20200915/',
].includes(data.metadata.patentPolicy)
) {
patentPolicy = 'pp2020';
}
Expand Down
2 changes: 1 addition & 1 deletion test/doc-views/SUBM/MEM-SUBM.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default {
...good.sotd,
submission: {
...good.sotd.submission,
processLink: 'https://fake-url/Consortium/Process',
processLink: 'https://fake-url/policies/process/',
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion test/doc-views/TR/Recommendation/recommendationBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const buildRecStability = base => ({
sotd: {
...base.sotd,
licensingLink:
'https://www.w3.org/Consortium/Patent-Policy/#sec-Requirements-fake',
'https://www.w3.org/policies/patent-policy/#sec-Requirements-fake',
},
},
});
Expand Down
8 changes: 4 additions & 4 deletions test/doc-views/TR/TRBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function buildCommonViewData(base) {
sotd: {
...base.sotd,
trackLink:
'https://www.w3.org/2023/Process-20231103/#wrong-url',
'https://www.w3.org/policies/process/20231103/#wrong-url',
},
},
noHomepageLink: {
Expand Down Expand Up @@ -205,7 +205,7 @@ export function buildCommonViewData(base) {
...base,
sotd: {
...base.sotd,
ppLink: 'https://www.w3.org/Consortium/Patent-Policy/fake',
ppLink: 'https://www.w3.org/policies/patent-policy/fake',
},
},
noDisclosures: {
Expand All @@ -220,15 +220,15 @@ export function buildCommonViewData(base) {
sotd: {
...base.sotd,
essentialLink:
'https://www.w3.org/Consortium/Patent-Policy/#def-essential-fake',
'https://www.w3.org/policies/patent-policy/#def-essential-fake',
},
},
noSection6: {
...base,
sotd: {
...base.sotd,
disclosureLink:
'https://www.w3.org/Consortium/Patent-Policy/#sec-Disclosure-fake',
'https://www.w3.org/policies/patent-policy/#sec-Disclosure-fake',
},
},
jointPublication: {
Expand Down
2 changes: 1 addition & 1 deletion test/doc-views/layout/spec.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
</p>
{{#if sotd.rec.showProposedAdd}}
<p>
It includes <a href="https://www.w3.org/2023/Process-20231103/#proposed-addition">proposed addition</a>, introducing new features since the Previous Recommendation.
It includes <a href="https://www.w3.org/policies/process/20231103/#proposed-addition">proposed addition</a>, introducing new features since the Previous Recommendation.
</p>
{{/if}}
{{#if sotd.rec.showAddition}}
Expand Down
6 changes: 3 additions & 3 deletions test/doc-views/partials/stability.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
DISC: Publication as a Discontinued Draft implies that this document is no longer intended to advance or to be maintained. It is inappropriate to cite this document as other than abandoned work.
CR: Publication as a Candidate Recommendation does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. A Candidate Recommendation Snapshot has received <a href="https://www.w3.org/2023/Process-20231103/#dfn-wide-review">wide review</a>, is intended to gather implementation experience, and has commitments from Working Group members to <a href="https://www.w3.org/Consortium/Patent-Policy/#sec-Requirements">royalty-free licensing</a> for implementations.
CR: Publication as a Candidate Recommendation does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. A Candidate Recommendation Snapshot has received <a href="https://www.w3.org/policies/process/20231103/#dfn-wide-review">wide review</a>, is intended to gather implementation experience, and has commitments from Working Group members to <a href="https://www.w3.org/policies/patent-policy/#sec-Requirements">royalty-free licensing</a> for implementations.
CRD: Publication as a Candidate Recommendation does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. A Candidate Recommendation Draft integrates changes from the previous Candidate Recommendation that the Working Group intends to include in a subsequent Candidate Recommendation Snapshot.
+
Expand All @@ -33,7 +33,7 @@
PR: Publication as a Proposed Recommendation does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
REC: A W3C Recommendation is a specification that, after extensive consensus-building, is endorsed by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members, and has commitments from Working Group members to <a href="https://www.w3.org/Consortium/Patent-Policy/#sec-Requirements">royalty-free licensing</a> for implementations.
REC: A W3C Recommendation is a specification that, after extensive consensus-building, is endorsed by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members, and has commitments from Working Group members to <a href="https://www.w3.org/policies/patent-policy/#sec-Requirements">royalty-free licensing</a> for implementations.
--}}

{{#config.notEndorsed}}
Expand Down Expand Up @@ -72,7 +72,7 @@
DRY: Publication as a Draft Registry does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
CRY: Publication as a Candidate Registry Snapshot does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. A Candidate Registry Snapshot has received <a href="https://www.w3.org/2023/Process-20231103/#dfn-wide-review">wide review</a>.
CRY: Publication as a Candidate Registry Snapshot does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. A Candidate Registry Snapshot has received <a href="https://www.w3.org/policies/process/20231103/#dfn-wide-review">wide review</a>.
CRYD: Publication as a Candidate Registry Draft does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. A Candidate Registry Draft integrates changes from the previous Candidate Registry that the Working Group intends to include in a subsequent Candidate Registry Snapshot.
Expand Down
Loading

0 comments on commit 59860c8

Please sign in to comment.