Trending

World technology news

→
Reviewing requirements in a protocol document with RFC 8174
Software Engineering · 2017
Software Engineering2017

Reviewing requirements in a protocol document with RFC 8174

The May 2017 clarification of uppercase keywords, explored with a tested scan of an interface contract.

Archive retrospective · Topic year 2017

Developer's JournalPublished: Dec 6, 20266 min read
Reading progress0%
In this article
  1. The same word can do two different jobs
  2. Applying the rule within a document
  3. A local scan of five sentences
  4. Turning a clause into an observable example
  5. Two ways that scans can mislead
  6. Using the 2017 clarification in a current review

The same word can do two different jobs

An interface document can place an implementation requirement beside an explanation for operators. It might require a reader to accept an empty list and also suggest that staff plan time for audits. Both statements can contain the same English word while serving different purposes. RFC 8174, published in May 2017, clarified the spelling in which the terms defined by RFC 2119 have their special meanings. A document that adopts BCP 14 applies those meanings to the uppercase forms. This convention can help a team find candidate requirements. The next steps are to identify the actor in each sentence and specify the input that will make its behavior observable. That work is especially valuable when two implementations were developed independently and must interoperate using the same specification.

Applying the rule within a document

An uppercase string does not acquire normative force by itself. Start with the document's statement about its use of BCP 14. Then see whether the term appears in a requirement, an example, or a discussion of another document. The RFC also says that specifications can contain normative text without these keywords. A syntax diagram or table might establish an exact sequence absent from the scan. An uppercase word in a sample might create an apparent requirement where none exists. There are therefore two jobs in a review. Read the candidates found by the tool and inspect the normative parts it could miss. An editor can record both tasks so that a future reviewer understands why certain lines were flagged and others required additional reading.

Application flowConceptual sketch · summary of the article's technical flow
Illustrative diagram: a token scan narrows the review, while the editor evaluates the contract.

A local scan of five sentences

The program below scans five fictional sentences written for an interface review. It places compound patterns first so that SHOULD NOT is returned as a unit. The lowercase planning sentence yields no candidate. The empty list and ordering clauses yield MUST and SHOULD NOT, respectively. The quoted Enter control does not match. The last fixture returns two terms in order. The assertions ran on Node.js v24.19.0. The objective is intentionally measurable: find candidate phrases that a person can inspect. The scanner cannot determine syntax, establish a requirement, or measure interface conformance. An extension for a team working in Markdown could attach parser-provided source positions to each result, keeping line numbers intact. Before excluding examples and quotations automatically, check how the specific document uses them to define behavior.

import assert from 'node:assert/strict';

const requiredClauses = [
  { name: 'ordinary word', clause: 'Operators must plan time for audits.', expect: [] },
  { name: 'normative requirement', clause: 'A reader MUST accept an empty list.', expect: ['MUST'] },
  { name: 'negative recommendation', clause: 'A reader SHOULD NOT rearrange the entries.', expect: ['SHOULD NOT'] },
  { name: 'quoted ingredient', clause: 'The UI calls the control "Enter".', expect: [] },
  { name: 'multiple terms', clause: 'The service MAY cache; it MUST NOT alter the order.', expect: ['MAY', 'MUST NOT'] }
];
const keywords = /\b(MUST NOT|SHALL NOT|SHOULD NOT|MUST|REQUIRED|SHALL|SHOULD|NOT RECOMMENDED|RECOMMENDED|MAY|OPTIONAL)\b/gu;
for (const { name, clause, expect } of requiredClauses) {
  const matches = [...clause.matchAll(keywords)].map(match => match[0]);
  assert.deepEqual(matches, expect);
  console.log(name + ': ' + (matches.join(', ') || '(review prose)'));
}

Turning a clause into an observable example

An interface review for an empty-list requirement can begin with two implementations exchanging the same representation. The producer sends a document containing an empty list. The reader accepts it and produces an empty output. If one implementation confuses that list with an absent field, add separate fixtures. An ordering recommendation can be evaluated with inputs that yield an observable sequence, and any permitted reasons to depart from the recommendation can be represented explicitly. The fixture then measures behavior beyond the presence of a particular keyword. Store it with the contract version and the change that justified it. A pair of implementations that happens to return the same output on ambiguous data provides weak evidence of interoperability. Use distinguishable items and a result whose order can be checked.

Two ways that scans can mislead

A count of flagged terms is easy to produce. Its usefulness depends on what those terms refer to. A requirement can appear in a definition and in a later explanation, where both mentions refer to the same behavior. A translated example might contain a term under discussion rather than using it to impose an obligation. In the other direction, one sentence can identify two actions that need independent checks. Relate the review to the behaviors, and later readers can understand why each test exists as the interface changes. The case conventions here apply to specifications that adopt BCP 14. A product contract in another language may define its own language for obligations. A translation also needs to preserve who acts, under which conditions, and what exceptions are allowed.

Using the 2017 clarification in a current review

RFC 8174 is the historical source. A current Node.js runtime supplies a repeatable environment for the scan and does not recreate a historical RFC publishing tool. A team can begin with changed lines, read the surrounding section, and compare it with the document's conventions. At the end, record whether the change affects accepted input, an exception, or the observable result. An editorial adjustment may leave the acceptance tests intact. A change that limits the behaviors available to an implementation deserves a corresponding review of its fixtures. This practice makes an apparently small wording edit and a decision about compatibility distinguishable in the same review. A receiving team can then see both the behavior the new version expects and the evidence used to check it.

861 reads ✎ Write a comment

Reader discussion

Discussion prompt

How would you measure this development's real-world impact?

No comments yet. Be the first to contribute.

Write a comment

Comments are real visitor contributions. Repeated, link-heavy or abusive submissions may be limited.