From candidate to standard: when a rule earns mandatory status

Examine a neutral CLI rule using two synthetic consumers and a counterexample. Define acceptance boundaries, reasons to defer or reject, compatibility, and maintenance costs.

A counterexample makes the boundaries of a rule visible.
A counterexample makes the boundaries of a rule visible.

A rule is easy to write after the first successful design. Explaining why it should become mandatory for other consumers is harder. One convenient example demonstrates a possibility. A standard takes on a longer commitment: defining boundaries, maintaining compatibility, and explaining exceptions after the original author has forgotten the circumstances.

We will examine a neutral candidate: how a CLI command returns a result to another program. We will define two imaginary consumers—a scheduled catalog export and a readiness check—and a counterexample involving an event stream. Every contract and decision below belongs to a teaching model. They demonstrate an evaluation method, not a completed pilot or the adoption of a standard in the existing platform.

A candidate must leave room for objections

“All CLI output must always be JSON” sounds consistent. Yet it immediately combines a short query, a long event stream, a human prompt, and a failure message. Before requiring uniformity, we need to identify the incompatibility we are removing.

Our candidate addresses a concrete problem: a consuming program should not have to guess where progress output ends and the result begins in stdout. If it searches for the first brace or removes lines based on particular words, any diagnostic change may alter its behavior.

A candidate record therefore needs a subject, proposed guarantee, consumers, and a way to challenge it. “Everyone does it this way” cannot replace these fields. A useful counterexample does not obstruct acceptance: it can show that the valuable part of the rule needs a narrower scope.

PEP 1 distinguishes an accepted proposal from a completed implementation. That distinction matters here: deciding on a direction does not prove that consumers already follow it. We are not importing Python’s entire governance process into a small project.

Start with a narrow contract

Instead of a general slogan, define this candidate: a finite, non-interactive command explicitly invoked with --format=json emits exactly one JSON document on stdout after successful completion; diagnostics and progress go to stderr.

Our teaching version adds a few boundaries. The encoding is UTF-8. The root value is an object with an integer schema_version=1. Success means that the process exits with code 0. A consumer may collect bytes before the process ends, but must not accept them as a completed result. Before use, it validates the entire document and the contract of that particular command.

This shape is our choice. RFC 8259 defines a JSON text in terms of one serialized value; requiring an object with a version field is an additional condition of this exercise. It does not follow automatically from calling the format JSON.

The rule does not define every error code, a retry policy, or a machine-readable failure schema. After a nonzero exit, the consumer must not accept stdout as a successful result, even if syntactically valid JSON happens to remain there. Further failure classification requires a separate contract.

Nor does the rule prescribe a serialization library, class name, or buffering technique. Its subject is an observable boundary between commands. Section 6 of RFC 2119 ties strong requirements to interoperability needs rather than arbitrarily imposing an implementation method.

The first consumer: a scheduled export

Imagine a task that periodically retrieves a catalog and prepares its next local snapshot. We define this successful document for it:

{
  "schema_version": 1,
  "items": [
    {"id": "note-7", "title": "A small garden"}
  ]
}

This is a contract example, not a copy of terminal output. A progress message such as Export prepared belongs on stderr. It may help an operator, but does not become another catalog item.

While the process runs, the consumer drains stdout and stderr concurrently with time and size bounds. After code 0, it validates the whole JSON document, the supported version, and the shape of items. Only then may it replace its previous snapshot. A truncated document, unknown version, or nonzero exit must not turn a previously valid catalog into an empty one.

The benefit is easy to state: changing the progress wording does not require changing the catalog parser. The costs are concrete too. The producer must control every write to stdout. The consumer must bound response time and size, validate the schema, and retain the previous result until the new one is accepted. A successful JSON parse alone does not establish that every item is correct.

What would a real pilot need to demonstrate? Separate capture of stdout and stderr, a complete valid catalog, rejection of a truncated result, and preservation of the previous snapshot. These conditions are supplied for analysis in this exercise; there are no measured export results.

The second consumer: a short readiness check

A different consumer periodically asks whether a teaching service is ready. Its successful document is much smaller:

{
  "schema_version": 1,
  "status": "ready"
}

This consumer does not accumulate a catalog or replace a snapshot. It makes a brief decision within a bounded time. Nevertheless, it needs the same boundary: no progress message may be mixed with the machine result.

An empty stderr does not itself mean readiness. A nonempty stderr does not necessarily mean failure either: a command may leave a diagnostic note and still complete successfully. Under our contract, acceptance requires code 0, a supported version, and status=ready.

A timeout, nonzero code, or unsupported schema means that the consumer has not obtained confirmation of readiness. Whether to mark the service unavailable, retry, or issue a separate warning is another product decision. The two successful documents above provide no basis for inventing a universal error classification.

The second example is valuable because of its differences. It has a different data shape, lifecycle, and consequence of failure. If both consumers were copies of one script, their count would add little confidence about the rule’s boundaries.

The counterexample: a command whose stream does not end

Now consider an event-watching command. It may run for a long time, emitting records individually. Two consecutive lines might look like this:

{"event":"note-added","id":"note-7"}
{"event":"note-updated","id":"note-7"}

JSON Lines describes a format in which each line is a separate JSON value. Those two lines are not one JSON document under the finite-command contract. Requiring the consumer to wait for the whole stream to finish would prevent it from processing events while the command runs.

This is a real applicability boundary, not an excuse for accidental progress output on stdout. A streaming mode needs a separately named format and rules for completion, interruption, ordering, and redelivery. It cannot quietly call itself --format=json if that option already promises one completed document.

An interactive command would likewise need a separate contract for human questions and answers. The narrow rule should not gain an exception for “any other output whenever convenient.” Such an exception would destroy the property the rule was created to provide.

Three distinct decisions instead of one vote

Within the teaching analysis, we can accept the useful part, defer the uncertain extension, and reject the excessive generalization. The labels below are decisions inside the model, not changes to the status of working standards.

Decision subject Label Rationale What is still needed
One stdout document for a successful finite --format=json command accepted in the model Two different consumers need the same clean machine boundary; the counterexample is outside the scope Actual consumer checks, a contract owner, and a compatibility plan before real adoption
A shared schema for every error and exit code defer Two successful calls do not explain network, configuration, and business failures Separate failure cases, consumer consequences, and a versioning decision
“Every CLI always emits one JSON document” reject An indefinite stream has a different consumption unit and completion point Preserve the rejection rationale; do not reintroduce the claim under a new name without new grounds

defer must identify specific missing knowledge. “We will finish it later” does not explain what would unblock the decision. For errors, that might mean timeout, invalid-input, and partially completed operation examples, with an explanation of how each consumer distinguishes them.

Preserving reject is useful too. Otherwise, the next session will propose a universal format again and repeat a contradiction already examined. And accepted requires a precise scope: without it, the next developer may extend the conclusion to a streaming mode.

Account for maintenance and bound exceptions

A rule does not become free to maintain once written down. The narrow JSON contract creates work in at least three places:

Area Maintenance that must be provided Consequence if absent
Result producer stdout/stderr checks, a stable schema version, completion and interruption examples A new diagnostic print may break a consumer
Each consumer Acceptance of exit status and the full document, schema validation, its own time/size limits Syntactically valid or partial output may be accepted as complete data
Rule owner A registry of supported modes, contract changes, and exception review A local workaround gradually becomes an unwritten general rule

This assessment does not need invented hours of savings. It needs to identify who maintains these parts, where the checks live, and which change would trigger a review. If nobody is prepared to maintain the contract after its first implementation, the candidate does not yet have enough support to become mandatory.

An existing text mode should not be silently rewritten because of a new standard. An explicitly selected JSON mode can be added, with consumers moved under a separate migration plan. PEP 387 relates incompatible changes to their benefit and the cost of breaking existing behavior. A product needs its own migration plan; Python’s timeframes and procedures are not copied here.

An exception should name the specific mode, reason, owner, and review event. For example, a legacy command temporarily retains its old output until the synthetic consumer workshop-catalog-import has migrated. After migration, the exception is closed or explicitly reconsidered. Streaming JSON Lines is instead a separate scope with its own contract, not an indefinite permit to violate JSON mode.

The point at which status can change

Real adoption needs a reproducible body of reasons: exact wording and version, the covered commands, different consumer cases, a preserved counterexample, actual checks, migration costs, and bounded exceptions. It must also be clear who can make the decision and who will maintain it afterward.

Strong words cannot replace those grounds. RFC 8174 clarifies the special meaning of uppercase normative keywords in the relevant context. Merely writing MUST in an arbitrary note confirms neither proper authority nor implementation of the rule.

Our exercise already explains which part is worth accepting, what should wait, and why the broader claim should be rejected. For a working standard, the next step would be actual consumer evidence and an explicit decision by its owner. After adoption, a format change, new consumer type, or wider scope should trigger another review. The rule draws its strength from a clear boundary and a maintained rationale, not from the document’s age.

  1. Repository governance Rules that survive the next development session
  2. Vendors & Packages A package’s public contract extends beyond method signatures
  3. Repository governance An architecture decision on one page: preserving the reason without bureaucracy

A project by the author · Weather Solution200

After reading, a look outside.

Temperature, rain and wind in your city. Check the forecast and plan the hours ahead.

Check the forecast
Next article