Skip to content

Commit

Permalink
introduce the 2023.1 process document and allow a 1-month transition …
Browse files Browse the repository at this point in the history
…period (#1784)
  • Loading branch information
deniak authored Nov 6, 2023
1 parent 317a038 commit 0b7aef7
Show file tree
Hide file tree
Showing 28 changed files with 176 additions and 142 deletions.
12 changes: 6 additions & 6 deletions lib/l10n-en_GB.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,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-20230612/#dfn-wide-review'",
"Wrong wide review link for Candidate Recommendation, link should be 'https://www.w3.org/2023/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 @@ -259,10 +259,10 @@ export const messages = {
'The governing process statement has been found multiple times.',
'sotd.process-document.not-found':
'The document must mention the governing process: ${process}',
'sotd.process-document.wrong-link':
'The link to the process rules specified in the document is erroneous.',
'sotd.process-document.wrong-process':
"The document doesn't specify the right governing process: ${process}.",
'sotd.process-document.previous-allowed':
'The process document (${process}) you are using is deprecated.',
'sotd.process-document.previous-not-allowed':
'The process document (${process}) you are using is no longer allowed.',
// sotd/ac-review
'sotd.ac-review.found':
'Found a link to an online questionnaire: ${link}. Does this link provide access to the review form?',
Expand All @@ -279,7 +279,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-20230612/#allow-new-features',
'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',
'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
70 changes: 35 additions & 35 deletions lib/rules.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/rules/sotd/new-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function check(sr, done) {
);
const linkTxt = 'new features';
const linkHref =
'https://www.w3.org/2023/Process-20230612/#allow-new-features';
'https://www.w3.org/2023/Process-20231103/#allow-new-features';

if (sotd && sr.norm(sotd.textContent).match(warning)) {
const foundLink = Array.prototype.some.call(
Expand Down
64 changes: 40 additions & 24 deletions lib/rules/sotd/process-document.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,63 @@ export const { name } = self;
*/
export function check(sr, done) {
const sotd = sr.getSotDSection();
const docDate = sr.getDocumentDate();
const BOILERPLATE_PREFIX = 'This document is governed by the ';
const BOILERPLATE_SUFFIX = ' W3C Process Document.';
let proc = '12 June 2023';
let procUri = 'https://www.w3.org/2023/Process-20230612/';
if (docDate < new Date('2023-07-01')) {
proc = '2 November 2021';
procUri = 'https://www.w3.org/2021/Process-20211102/';
}
const newProc = '03 November 2023';
const newProcUri = 'https://www.w3.org/2023/Process-20231103/';
const previousProc = '12 June 2023';
const previousProcUri = 'https://www.w3.org/2023/Process-20230612/';
let previousAllowed;

const boilerplate = BOILERPLATE_PREFIX + newProc + BOILERPLATE_SUFFIX;
const previousBoilerplate =
BOILERPLATE_PREFIX + previousProc + BOILERPLATE_SUFFIX;

const boilerplate = BOILERPLATE_PREFIX + proc + BOILERPLATE_SUFFIX;
// 1 month transition period
sr.transition({
from: new Date('2023-11-02'),
to: new Date('2023-12-03'),
doBefore() {},
doMeanwhile() {
previousAllowed = true;
},
doAfter() {
previousAllowed = false;
},
});

if (sotd) {
let found = false;
const regex = new RegExp(
`${BOILERPLATE_PREFIX}.+${BOILERPLATE_SUFFIX}`
);
sotd.querySelectorAll('p').forEach(p => {
const link = p.querySelector('a');
if (
sr.norm(p.textContent) === boilerplate &&
p.querySelector('a') &&
p.querySelector('a').getAttribute('href') === procUri
link &&
link.getAttribute('href') === newProcUri
) {
if (found) sr.error(self, 'multiple-times', { process: proc });
if (found)
sr.error(self, 'multiple-times', { process: newProc });
else {
found = true;
}
} else if (
sr.norm(p.textContent) !== boilerplate &&
regex.test(p.textContent)
sr.norm(p.textContent) === previousBoilerplate &&
link &&
link.getAttribute('href') === previousProcUri
) {
sr.error(self, 'wrong-process', { process: proc });
} else if (
sr.norm(p.textContent) === boilerplate &&
p.querySelector('a') &&
p.querySelector('a').getAttribute('href') !== procUri
) {
sr.error(self, 'wrong-link');
if (previousAllowed) {
sr.warning(self, 'previous-allowed', {
process: previousProc,
});
found = true;
} else {
sr.error(self, 'previous-not-allowed', {
process: previousProc,
});
}
}
});
if (!found) sr.error(self, 'not-found', { process: proc });
if (!found) sr.error(self, 'not-found', { process: newProc });
}
done();
}
47 changes: 36 additions & 11 deletions lib/rules/sotd/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,29 @@ export async function check(sr, done) {

const sotdLinks = sotd.querySelectorAll('a[href]');

let baseURL;
// 1 month transition period
sr.transition({
from: new Date('2023-11-02'),
to: new Date('2023-12-03'),
doBefore() {
baseURL = /^https:\/\/www.w3.org\/2023\/Process-20230612\//;
},
doMeanwhile() {
baseURL =
/^https:\/\/www.w3.org\/2023\/Process-2023(0612|1103)\//;
},
doAfter() {
baseURL = /^https:\/\/www.w3.org\/2023\/Process-20231103\//;
},
});

// Check track link
const urlExpected =
'https://www.w3.org/2023/Process-20230612/#recs-and-notes';
const urlExpected = new RegExp(`${baseURL.source}#recs-and-notes$`);
const trackEle = Array.prototype.filter.call(sotdLinks, ele =>
sr.norm(ele.textContent).match(`${sr.config.track} track`)
)[0];
if (trackEle && trackEle.href !== urlExpected) {
if (trackEle && !urlExpected.test(trackEle.href)) {
sr.error(self, 'url-not-match', {
url: urlExpected,
text: `${sr.config.track} track`,
Expand Down Expand Up @@ -71,37 +87,46 @@ export async function check(sr, done) {
sr.config.status === 'REC' ? sr.getRecMetadata({}) : null;
// check if 'candidate amendments' or 'proposed amendments' link in same paragraph is valid.
if (recType && JSON.stringify(recType) !== '{}') {
const BASE_URL = 'https://www.w3.org/2023/Process-20230612/';
let urlExpected;
let textExpected;
// for proposed amendments, proposed additions, proposed corrections.
if (recType.pSubChanges && recType.pNewFeatures) {
urlExpected = `${BASE_URL}#proposed-amendments`;
urlExpected = new RegExp(
`${baseURL.source}#proposed-amendments`
);
textExpected = /proposed amendment(s)?/;
} else if (recType.pSubChanges) {
urlExpected = `${BASE_URL}#proposed-corrections`;
urlExpected = new RegExp(
`${baseURL.source}#proposed-corrections`
);
textExpected = /proposed correction(s)?/;
} else if (recType.pNewFeatures) {
urlExpected = `${BASE_URL}#proposed-addition`;
urlExpected = new RegExp(`${baseURL.source}#proposed-addition`);
textExpected = /proposed addition(s)?/;
}

// for candidate amendments, candidate additions, candidate corrections.
if (recType.cSubChanges && recType.cNewFeatures) {
urlExpected = `${BASE_URL}#candidate-amendments`;
urlExpected = new RegExp(
`${baseURL.source}#candidate-amendments`
);
textExpected = /candidate amendments(s)?/;
} else if (recType.cSubChanges) {
urlExpected = `${BASE_URL}#candidate-correction`;
urlExpected = new RegExp(
`${baseURL.source}#candidate-correction`
);
textExpected = /candidate correction(s)?/;
} else if (recType.cNewFeatures) {
urlExpected = `${BASE_URL}#candidate-addition`;
urlExpected = new RegExp(
`${baseURL.source}#candidate-addition`
);
textExpected = /candidate addition(s)?/;
}
const linkFound = Array.prototype.some.call(
paragraph.querySelectorAll('a'),
ele => {
if (sr.norm(ele.textContent).match(textExpected)) {
if (ele.href !== urlExpected) {
if (!urlExpected.test(ele.href)) {
sr.error(self, 'url-not-match', {
url: urlExpected,
text: textExpected,
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/sotd/stability.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function check(sr, done) {
if (!review) sr.error(self, 'no-cr-review');
else if (
review.href !==
'https://www.w3.org/2023/Process-20230612/#dfn-wide-review'
'https://www.w3.org/2023/Process-20231103/#dfn-wide-review'
)
sr.error(self, 'wrong-cr-review-link');
}
Expand Down
7 changes: 0 additions & 7 deletions test/data/TR/TRBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ export const rules = {
data: 'noProcess',
errors: ['sotd.process-document.not-found'],
},
{
data: 'wrongLink',
errors: [
'sotd.process-document.wrong-link',
'sotd.process-document.not-found',
],
},
{
data: 'duplicatedProcess',
errors: ['sotd.process-document.multiple-times'],
Expand Down
2 changes: 1 addition & 1 deletion test/doc-views/TR/Recommendation/REC.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default {
showProposedAdd: true,
},
processHTML:
'12 June 2023 <abbr title="World Wide Web Consortium">W3C</abbr> Process Document',
'03 November 2023 <abbr title="World Wide Web Consortium">W3C</abbr> Process Document',
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions test/doc-views/TR/TRBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function buildCommonViewData(base) {
sotd: {
...base.sotd,
processLink:
'https://www.w3.org/wrong/link/2023/Process-20230612/',
'https://www.w3.org/wrong/link/2023/Process-20231103/',
},
},
duplicatedProcess: {
Expand Down Expand Up @@ -151,7 +151,7 @@ export function buildCommonViewData(base) {
sotd: {
...base.sotd,
trackLink:
'https://www.w3.org/2023/Process-20230612/#wrong-url',
'https://www.w3.org/2023/Process-20231103/#wrong-url',
},
},
noHomepageLink: {
Expand Down
6 changes: 3 additions & 3 deletions test/doc-views/layout/spec.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
</p>
{{#if sotd.rec.showProposedAdd}}
<p>
It includes <a href="https://www.w3.org/2023/Process-20230612/#proposed-addition">proposed addition</a>, introducing new features since the Previous Recommendation.
It includes <a href="https://www.w3.org/2023/Process-20231103/#proposed-addition">proposed addition</a>, introducing new features since the Previous Recommendation.
</p>
{{/if}}
{{#if sotd.rec.showAddition}}
Expand Down Expand Up @@ -235,11 +235,11 @@
{{> patent-policy}}

<p>
This document <span class="handlebars-data">{{sotd.processTextPrefix}}</span>{{! is governed by the}} <a id="w3c_process_revision" href="{{sotd.processLink}}"><span class="handlebars-data">{{{sotd.processHTML}}}{{! 12 June 2023 W3C Process Document }}</span></a>.
This document <span class="handlebars-data">{{sotd.processTextPrefix}}</span>{{! is governed by the}} <a id="w3c_process_revision" href="{{sotd.processLink}}"><span class="handlebars-data">{{{sotd.processHTML}}}{{! 03 November 2023 W3C Process Document }}</span></a>.
</p>
{{#if sotd.duplicateProcess}}
<p>
This document <span class="handlebars-data">{{sotd.processTextPrefix}}</span>{{! is governed by the}} <a id="w3c_process_revision" href="{{sotd.processLink}}"><span class="handlebars-data">{{{sotd.processHTML}}}{{! 12 June 2023 W3C Process Document }}</span></a>.
This document <span class="handlebars-data">{{sotd.processTextPrefix}}</span>{{! is governed by the}} <a id="w3c_process_revision" href="{{sotd.processLink}}"><span class="handlebars-data">{{{sotd.processHTML}}}{{! 03 November 2023 W3C Process Document }}</span></a>.
</p>
{{/if}}
{{#if sotd.newFeatures.show}}
Expand Down
4 changes: 2 additions & 2 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-20230612/#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/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.
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 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-20230612/#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/2023/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
8 changes: 4 additions & 4 deletions test/doc-views/specBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export const data = {
group: 'Internationalization Working Group',

WGLink: 'https://www.w3.org/groups/wg/i18n-core/',
trackLink: 'https://www.w3.org/2023/Process-20230612/#recs-and-notes',
trackLink: 'https://www.w3.org/2023/Process-20231103/#recs-and-notes',
extra1: '',
noEndorsementHTML:
'does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members',
Expand All @@ -147,7 +147,7 @@ export const data = {
discText: 'intended to advance or to be maintained',
wideReviewText: 'wide review',
wideReviewLink:
'https://www.w3.org/2023/Process-20230612/#dfn-wide-review',
'https://www.w3.org/2023/Process-20231103/#dfn-wide-review',
recConsensusText: 'after extensive consensus-building',

licensingText: 'royalty-free licensing',
Expand Down Expand Up @@ -181,9 +181,9 @@ export const data = {

duplicateProcess: false,
processTextPrefix: 'is governed by the',
processLink: 'https://www.w3.org/2023/Process-20230612/',
processLink: 'https://www.w3.org/2023/Process-20231103/',
processHTML:
'12 June 2023 <abbr title="World Wide Web Consortium">W3C</abbr> Process Document',
'03 November 2023 <abbr title="World Wide Web Consortium">W3C</abbr> Process Document',
newFeatures: {
show: false,
text: 'Future updates to this Recommendation may incorporate new features.',
Expand Down
Loading

0 comments on commit 0b7aef7

Please sign in to comment.