Rendering and failures

The three rules that exercise the TextRenderer and the FailureClassifier with real inputs — plain text, the canonical sample, an arbitrary throwable and an arbitrary value.

Two of the required ports can be tested without a platform, so the kit drives them with inputs and reads the output.

text.plain_text_survives

Checks TextRenderer::render('Hello, world') returns exactly Hello, world.

Fails with "Hello, world" rendered as "Hello, world\n".

Why most of what the core says carries no markup, and a renderer that trims, escapes, wraps or decorates plain text changes every message in ten languages.

Fix make a body with no tags the identity, byte for byte. Decode entities only where a tag was; an HTML platform passes them through.

text.canonical_sample_renders

Checks rendering the canonical sample

<b>Bold</b> <i>italic</i> <u>underline</u> <s>struck</s> <a href="https://example.test">link</a> <code>code</code> <pre>pre</pre> <blockquote>quote</blockquote>

returns a non-empty string that still contains each of the eight words Bold, italic, underline, struck, link, code, pre, quote.

Fails with the canonical sample rendered to nothing, or words lost in rendering: underline, quote.

Why whatever the platform cannot show, the text inside a tag must survive; a renderer that drops the element loses meaning.

Fix map each of the eight tags to the platform's formatting or to the bare words (TextRenderer). Never strip an element with its content.

failures.classifies_anything

Checks FailureClassifier::classify() returns a DeliveryFailure for a RuntimeException and for the string conformance probe, and does not throw for either.

Fails with the classifier: a throwable did not classify to a DeliveryFailure, or the guard's threw TypeError: … when the classifier only accepts its own client's exception type.

Why every send, grant and probe ends in the classifier, with whatever the platform client produced: a decoded body, a response object, an exception, sometimes a string. A classifier that only understands its own client's exceptions throws inside the core's error path, where nothing catches it.

Fix accept mixed, match what you recognise, and fall back to Transient for any throwable you do not and Other for any value you do not, each with the input's text in detail.

Real inputs beat mocks

The kit uses a real exception and a real string on purpose. Test your classifier the same way, with the platform's real error bodies pasted from its documentation, one row per kind.

How is this guide?

On this page

Subscriby is a product designed by you — for you.

No boardroom full of executives deciding what we ships next. Our roadmap always shaped by you with your feedback.

Share feedback or a request