DocumentWDP-STRUCTURE
Version0.1.0-draft
StatusDraft
CategoryInformational
Last Updated2026-01-11

Specification Structure Overview

A conceptual overview of the WDP diagnostic code structure. For normative requirements, refer to the individual specification documents.

Notation Conventions#

This specification uses the following notation conventions throughout:

SymbolMeaningExample
โ†’Transformation or mappingE.Auth.Token.001 โ†’ V6a0B
โ†Annotation or commentโ”‚ โ† Part 1: Severity
โ”‚ โ””โ”€Hierarchy/tree structureComponent hierarchy diagrams
โ”Œ โ”€ โ”Box-drawing for diagramsStructure overview boxes
...Continuation/ellipsis001, 002, ... 999
*Wildcard in patternsE.Auth.* (all Auth errors)
[X]Placeholder for value X[SEVERITY.COMPONENT.PRIMARY.SEQUENCE]
โœ… / โŒRecommended / Not recommendedUsage guidance
MUST, SHOULD, MAYRFC 2119 keywordsNormative requirements

Conformance

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

Note: This document is non-normative. Normative requirements are defined in the individual specification parts.

Protocol Overview#

The Waddling Diagnostic Protocol (WDP) is a structured, cross-language diagnostic coding system that provides both semantic structured codes and compact reference identifiers.

Problem Statement

Diagnostic systems face competing requirements for semantic richness and transmission efficiency:

  • Fully descriptive diagnostic messages provide operational context but impose overhead for storage and transmission.
  • Opaque numeric or short-form codes achieve efficiency but require external documentation for interpretation.

Protocol Approach

WDP addresses these requirements through dual representation. The same diagnostic MAY be expressed in two forms with deterministic bidirectional mapping:

Structured Code (E.Auth.Token.001): A hierarchical, dot-delimited format that encodes semantic information. The format is parsable by automated systems and readable by human operators. Systems MAY route, filter, and aggregate diagnostics based on the hierarchical structure.

Compact ID (V6a0B): A fixed-length, Base62-encoded hash derived from the structured code. The format is optimized for transmission efficiency, storage keys, and cross-system reference. The Compact ID is opaque; interpretation requires catalog lookup.

The 5-Part Structure#

Every WDP diagnostic code MUST consist of five parts:

Severity.Component.Primary.Sequence -> CompactID
    ^        ^        ^        ^           ^                
 Part 1   Part 2   Part 3   Part 4      Part 5

Structure Breakdown:

Parts 1-4: Structured Code    |    Part 5: Compact ID
(Semantic, hierarchical,      |    (Efficient reference,
 parsable, actionable)        |     opaque handle, lookup key)

Complete Example

E.Auth.Token.001 -> V6a0B
^   ^    ^    ^       ^                                     
Part 4Part 5: Compact ID (5-char hash)

Both representations identify the same error:

  • Structured code: E.Auth.Token.001 โ€” semantic identity (parsable, routable, filterable)
  • Compact ID: V6a0B โ€” efficient reference (wire-friendly, lookup key, fingerprint)

The Five Parts Explained#

Part 1: Severity#

Single character indicating urgency and type

CodeMeaningUse Case
EErrorOperation failed, needs attention
WWarningPotential issue, operation continues
CCriticalSystem-critical failure
BBlockedOperation waiting/blocked
SSuccessOperation succeeded
KCompletedLong-running task finished
IInfoInformational message
TTraceDebug/trace information
HHelpUser assistance needed

Examples: E (Error), W (Warning), S (Success)

See: 1-SEVERITY for complete specification

Part 2: Component#

System module or domain (PascalCase, max 16 characters)

The Component identifies which part of the system produced the diagnostic.

MAY represent:

  • Physical subsystem: Database, Network, FileSystem, Cache
  • Logical module: Auth, Validation, BusinessLogic, Parser
  • Service boundary: UserService, OrderService, PaymentGateway
  • Architectural layer: Api, Domain, Infrastructure

Examples: Auth, Database, TokenValidator, ServiceRegistry

See: 2-COMPONENT for complete specification

Part 3: Primary#

Failure domain within component (PascalCase, max 16 characters)

The Primary field narrows down the specific area within the Component.

Relationship:

Component.Primary
    โ†“        โ†“
Auth.Token           - Token-related authentication errors
Auth.Session         - Session-related authentication errors
Auth.Permission      - Permission-related authentication errors

Database.Connection  - Database connection errors
Database.Query       - Database query errors
Database.Transaction - Database transaction errors

Examples: Token, Connection, Syntax, Parse, Validation

See: 3-PRIMARY for complete specification

Part 4: Sequence#

Specific event identifier

The Sequence uniquely identifies a specific diagnostic within the Component.Primary namespace.

Format:

  • Numeric (canonical): 001, 002, 003, ..., 999
  • Named (alias): MISSING, EXPIRED, etc.

Model:

Canonical Identity: 001, 018, 003 (numeric)
       โ†•
Associated Name: MISSING, EXPIRED (semantic)
       โ†•
Display: MAY show either or both
       โ†•
Hash: MUST be computed from numeric

Examples: 001, 042, 999

See: 4-SEQUENCE for complete specification

Part 5: Compact ID (Hash)#

5-character hash derived from parts 1-4

The Compact ID is a short, deterministic hash of the structured code.

Generation:

Structured Code:  E.Auth.Token.001
       โ†“
Normalize:        E.AUTH.TOKEN.001 (uppercase)
       โ†“
Hash (xxHash3):  [64-bit integer]
       โ†“
Encode (Base62):  V6a0B

Properties:

  • 5 characters: Compact for communication (users MAY report "error V6a0B")
  • Deterministic: Same input MUST always produce the same hash
  • Collision-resistant: 916 million possible values (62^5)
  • Cross-language: Same hash MUST be produced across all conforming implementations

See: 5-COMPACT-IDS for complete specification

How the Parts Work Together#

Hierarchical Organization

Severity
  โ””โ”€ Component (e.g., Auth)
      โ”œโ”€ Primary (e.g., Token)
      โ”‚   โ”œโ”€ Sequence 001 (MISSING)
      โ”‚   โ”œโ”€ Sequence 018 (EXPIRED)
      โ”‚   โ””โ”€ Sequence 003 (INVALID)
      โ”‚
      โ”œโ”€ Primary (e.g., Session)
      โ”‚   โ”œโ”€ Sequence 001 (MISSING)
      โ”‚   โ””โ”€ Sequence 013 (CLOSED)
      โ”‚
      โ””โ”€ Primary (e.g., Permission)
          โ””โ”€ Sequence 008 (DENIED)

Error Space

Each Component.Primary combination has 999 possible sequences (001-999).

E.Auth.Token.*           - 999 possible token-related errors
E.Auth.Session.*         - 999 possible session-related errors
E.Database.Connection.*  - 999 possible connection-related errors

Total space: (Components ร— Primaries ร— 999) = effectively unlimited

Dual Representation#

WDP defines two representations for the same diagnostic code. This section specifies the characteristics and appropriate usage of each representation.

Structured Code (Parts 1-4)

Format: SEVERITY.COMPONENT.PRIMARY.SEQUENCE

Example: E.Auth.Token.001

The structured code provides semantic identity through a hierarchical, dot-delimited format.

Characteristics

PropertyDescription
ParsableThe dot-delimited format enables programmatic decomposition into constituent parts
RoutableSystems MAY use component or primary fields to route diagnostics to appropriate handlers
FilterableWildcard patterns (e.g., E.Auth.*) enable efficient filtering and aggregation
ActionableSeverity and component fields enable automated escalation and routing policies
Self-describingThe hierarchical structure conveys semantic meaning without external lookup

Recommended Usage

Implementations SHOULD use structured codes in the following contexts:

  • Log output where searchability and readability are required
  • Monitoring and observability systems requiring filtering by component or severity
  • Routing and dispatch logic that acts on diagnostic hierarchy
  • Documentation and code comments
  • Debugging and troubleshooting workflows

Compact ID (Part 5)

Format: [0-9A-Za-z]{5}

Example: V6a0B

The Compact ID provides an efficient, fixed-length reference derived from the structured code through deterministic hashing.

Characteristics

PropertyDescription
Fixed-lengthExactly 5 characters, regardless of structured code length
Transmission-efficientReduced payload size (5 bytes vs 15-30+ bytes for structured codes)
DeterministicIdentical structured codes MUST produce identical Compact IDs
OpaqueThe Compact ID does not encode semantic information; lookup is required for interpretation
UniversalThe same Compact ID identifies the same diagnostic across all conforming systems

Recommended Usage

Implementations SHOULD use Compact IDs in the following contexts:

  • API responses where bandwidth efficiency is required
  • Database primary keys and foreign key references
  • Network transmission in constrained environments (IoT, mobile)
  • User-facing error references for support workflows
  • Cross-system correlation of diagnostics

Combined Usage

Implementations MAY transmit or store both representations simultaneously. This approach provides flexibility for systems with diverse consumption requirements.

Log Entry Example:

[2024-01-15 10:30:00] ERROR E.Auth.Token.001 [V6a0B]: Token missing

The structured code enables filtering and human interpretation; the Compact ID enables cross-system search.

API Response Example:

Json
{
  "error": {
    "code": "E.Auth.Token.001",
    "compact_id": "V6a0B",
    "message": "Token missing from Authorization header",
    "timestamp": "2024-01-15T10:30:00Z"
  }
}

Monitoring System Example:

Filter by component: E.Auth.*
Group by primary: E.Auth.Token.*, E.Auth.Session.*
Search by Compact ID: V6a0B

User Support Workflow:

User reports: "error V6a0B"
Support lookup: V6a0B โ†’ E.Auth.Token.001 (MISSING)
Resolution: "Authentication token required"

Persistent Storage Considerations

When storing diagnostic codes in persistent storage systems, implementations SHOULD store both the decomposed structured code fields and the Compact ID. This approach enables both analytical queries on the hierarchical structure and efficient key-based lookups.

Schema Design

The following schema illustrates the RECOMMENDED approach for relational databases:

Sql
CREATE TABLE diagnostic_log (
    id            BIGINT PRIMARY KEY,
    compact_id    CHAR(5) NOT NULL,
    severity      CHAR(1) NOT NULL,
    component     VARCHAR(16) NOT NULL,
    primary_field VARCHAR(16) NOT NULL,
    sequence      SMALLINT NOT NULL,
    timestamp     TIMESTAMP NOT NULL
);

CREATE INDEX idx_compact_id ON diagnostic_log (compact_id);
CREATE INDEX idx_severity ON diagnostic_log (severity);
CREATE INDEX idx_component ON diagnostic_log (component);
CREATE INDEX idx_component_primary ON diagnostic_log (component, primary_field);

Query Patterns

Analytical queries utilize indexed structured fields:

Sql
-- Retrieve all critical diagnostics
SELECT * FROM diagnostic_log WHERE severity = 'C';

-- Retrieve diagnostics by component
SELECT * FROM diagnostic_log WHERE component = 'Auth';

-- Retrieve diagnostics by component and primary
SELECT * FROM diagnostic_log 
  WHERE component = 'Auth' AND primary_field = 'Token';

-- Aggregate by component
SELECT component, COUNT(*) FROM diagnostic_log GROUP BY component;

Reference lookups utilize the Compact ID:

Sql
-- Direct lookup by Compact ID
SELECT * FROM diagnostic_log WHERE compact_id = 'V6a0B';

-- Join using Compact ID as foreign key
SELECT d.*, u.email FROM diagnostic_log d
  JOIN users u ON u.last_error_id = d.compact_id;

Rationale

The decomposed structured fields enable efficient analytical queries through database indexing. Query planners MAY utilize indexes on severity, component, or primary fields to optimize filtering, grouping, and aggregation operations.

The Compact ID provides a fixed-length, collision-resistant key suitable for primary key usage, foreign key references, and cross-table joins.

Usage Patterns#

The following patterns demonstrate RECOMMENDED approaches for different use cases.

Pattern 1: Simple Logging

[ERROR] E.Auth.Token.001: Authentication failed

Structured code only. Human-readable and self-documenting.

Pattern 2: Compact API

Json
{"error": "V6a0B"}

Compact ID only. Client resolves details via catalog lookup.

Pattern 3: Full Context

[ERROR] E.Auth.Token.001 (V6a0B): Authentication failed

Both representations. Provides semantic meaning and searchable hash.

Pattern 4: Structured Logging

Json
{
  "severity": "error",
  "code": "E.Auth.Token.001",
  "compact_id": "V6a0B",
  "component": "Auth",
  "primary": "Token",
  "sequence": 1,
  "message": "Token missing"
}

Full decomposition for structured logging systems. RECOMMENDED for observability platforms.

Design Rationale#

This section provides informative discussion of the architectural benefits achieved through the WDP design.

Dual Representation Benefits

The dual representation model addresses distinct requirements through complementary formats:

RequirementRepresentationProperties
Semantic identityStructured codeHierarchical, parsable, self-describing
Efficient referenceCompact IDFixed-length, opaque, transmission-efficient

Structured codes provide semantic topology that enables programmatic routing, filtering, and aggregation. The hierarchical format is interpretable by both human operators and automated systems.

Compact IDs provide efficient, opaque references suitable for storage keys, foreign key relationships, and bandwidth-constrained transmission. The deterministic derivation ensures bidirectional mapping between representations.

Hierarchical Organization Benefits

The structured code format enables hierarchical operations through pattern matching:

OperationPatternDescription
Route by componentAuth.*Direct diagnostics to component-specific handlers
Filter by severityC.*.*.*Select all critical-severity diagnostics
Group by primaryE.Auth.Token.*Aggregate diagnostics within a failure domain
Query by convention*.*.*.001Select diagnostics matching semantic conventions
Direct lookupV6a0BRetrieve specific diagnostic by Compact ID

This hierarchical structure benefits both human operators (through readability) and automated systems (through programmatic decomposition).

Cross-Language Compatibility

The same structured code MUST produce the same compact ID across all conforming implementations:

Rust:       E.Auth.Token.001 -> V6a0B
Python:     E.Auth.Token.001 -> V6a0B
TypeScript: E.Auth.Token.001 -> V6a0B

This property is REQUIRED by the deterministic hash algorithm specified in 5-COMPACT-IDS.

Graceful Degradation

Structured codes provide partial interpretability when catalog lookup is unavailable:

RepresentationWithout CatalogInterpretability
E.Auth.Token.001InterpretableSeverity, component, and primary fields convey semantic meaning
V6a0BOpaqueRequires catalog lookup for interpretation

This property provides operational resilience in degraded conditions. Implementations SHOULD prefer structured codes in contexts where catalog availability cannot be guaranteed.

Flexible Adoption

WDP supports multiple adoption strategies:

System TypeRECOMMENDED Approach
Simple systemsStructured code only
Advanced systemsFull 5-part structure
Bandwidth-constrainedCompact ID + catalog
Legacy integrationMap to/from existing codes

Implementations MAY adopt any strategy appropriate to their requirements.

Internationalization (i18n)#

Canonical Form

All diagnostic codes have a canonical English form that MUST be used for hash computation:

[E.Auth.Token.001] -> V6a0B

Localized Aliases

Display MAY be localized, but the hash MUST remain universal:

English:  [E.Auth.Token.001] -> V6a0B
Arabic:   [ุฎ.ุงู„ู…ุตุงุฏู‚ุฉ.ุงู„ุฑู…ุฒ.001] -> V6a0B
Japanese: [E.่ช่จผ.ใƒˆใƒผใ‚ฏใƒณ.001] -> V6a0B
Chinese:  [E.่ฎค่ฏ.ไปค็‰Œ.001] -> V6a0B
Key Insight

The hash MUST be computed from the canonical English form, but all localized aliases map to the same hash.

Hash input:  E.AUTH.TOKEN.001 (canonical English, uppercase)
Hash output: V6a0B (identical for all languages)

Users see localized display
Systems use universal hash

See: 8-I18N for complete internationalization specification

Frequently Asked Questions#

This section provides clarification on common questions. These answers are INFORMATIVE.

10.1 Representation Requirements

Do implementations need to use all 5 parts?

No. Implementations MAY use structured code only OR compact ID only, depending on requirements. Both representations identify the same diagnostic. The choice depends on the use case (see Usage Patterns above).

10.2 Custom Fields

Can implementations add custom fields beyond the 5 parts?

Yes. The 5-part structure defines the protocol core for interoperability. Implementations MAY add custom metadata fields. See 12-METADATA for the metadata extension specification.

10.3 Sequence Capacity

What if a Component.Primary requires more than 999 sequences?

This typically indicates the Component.Primary scope is too broad. The RECOMMENDED approach is to split into more specific categories. For example, Parser.Syntax.*, Parser.Semantic.*, and Parser.Lexical.* instead of a single Parser.Error.*.

10.4 Named Sequences

Are named sequences required?

No. Numeric sequences (001-999) constitute the canonical identity and MUST be used for hash computation. However, every sequence number MUST have a documented semantic meaning in at least one authoritative source (catalog entry, specification document, or source code definition).

Named aliases (such as EXPIRED or MISSING) are OPTIONAL. Implementations MAY define named constants in code, or MAY document sequence meanings exclusively in catalog entries without corresponding code constants.

Composition Guidance: Sequence names SHOULD be sufficiently generic to compose semantically with multiple Primary values. For example, the sequence name EXPIRED (rather than TOKEN_EXPIRED) enables meaningful composition across Primary domains: Token.EXPIRED, Session.EXPIRED, Certificate.EXPIRED. The Primary field identifies the subject; the Sequence field identifies the condition or state.

See 6-SEQUENCE-CONVENTIONS for naming conventions.

10.5 Component Types

Can components represent logical modules, not just physical subsystems?

Yes. Components MAY represent:

  • Physical subsystems (Database, Network)
  • Logical modules (Auth, Validation)
  • Service boundaries (UserService, PaymentGateway)
  • Architectural layers (Api, Domain)

See 2-COMPONENT for complete guidance.

Stability and Evolution#

For version 0.1.0-draft, the specification parts are classified by stability level:

Stable (Breaking changes unlikely)

These parts define the core protocol and are considered stable:

PartDocumentStabilityNotes
11-SEVERITYStableSeverity codes (E, W, C, I, H) are fixed
22-COMPONENTStableComponent field format is fixed
33-PRIMARYStablePrimary field format is fixed
44-SEQUENCEStableSequence format (001-999) is fixed
55-COMPACT-IDSStablexxHash3 + Base62 encoding is fixed

Provisional (May evolve with feedback)

These parts are well-designed but may evolve based on implementation experience:

PartDocumentStabilityNotes
77-NAMESPACESProvisionalNamespace hash format is stable; boundary semantics may refine
88-I18NProvisionalCore model stable; locale fallback rules may evolve
99-CATALOGSProvisionalCatalog concept stable; format details may evolve
9a9a-CATALOG-FORMATCatalog JSON schema may add optional fields; version field enables migration
9b9b-WIRE-PROTOCOLProvisionalWire format stable; content negotiation may be added
9c9c-IMPLEMENTATIONProvisionalExamples may expand; patterns are recommendations
1111-SECURITYProvisionalSecurity model stable; specific requirements may strengthen
1212-METADATAProvisionalSchema structure stable; optional fields may be added

Informative (Non-normative guidance)

These parts provide recommendations and may change freely:

PartDocumentStabilityNotes
66-SEQUENCE-CONVENTIONSInformativeConventions are suggestions only
1010-PRESENTATIONInformativeVisual guidelines are recommendations

Evolution Principles

  1. Backward Compatibility: Stable parts SHALL NOT introduce breaking changes without a major version increment
  2. Catalog Versioning: The version field in catalogs enables graceful migration
  3. Optional Extension: New features SHALL be added as optional fields where possible
  4. Deprecation Policy: Features SHALL be deprecated before removal, with at least one minor version warning

Specification Documents#

For detailed implementation specifications, see the following normative and informative documents.

12.1 Core Specification (Parts 1-5)

These documents define the REQUIRED elements of WDP.

PartDocumentDescription
11-SEVERITYSeverity level definitions
22-COMPONENTComponent field specification
33-PRIMARYPrimary field specification
44-SEQUENCESequence field specification
55-COMPACT-IDSCompact ID hash generation

12.2 Extended Specification (Parts 6-12)

These documents define OPTIONAL extensions and implementation guidance.

PartDocumentDescription
66-SEQUENCE-CONVENTIONSSequence naming conventions (Informative)
77-NAMESPACESNamespace and error boundaries
88-I18NInternationalization support
99-CATALOGSCatalog system overview
9a9a-CATALOG-FORMATCatalog file format
9b9b-WIRE-PROTOCOLWire protocol specification
9c9c-IMPLEMENTATIONImplementation guide
1010-PRESENTATIONVisual presentation guidelines (Informative)
1111-SECURITYSecurity considerations
1212-METADATAMetadata schema

12.3 Supporting Documents

DocumentDescription
README.mdProject overview and quick start
CONTRIBUTING.mdContribution guidelines

Appendix A. Quick Reference#

E.Auth.Token.001 -> V6a0B
^   ^    ^    ^       ^                                     
PaPart Part 4: EPart 5: Hash

Appendix B. Normative References#

  • [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
  • [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, May 2017.

Copyright ยฉ 2025 Ashutosh Mahala
Licensed under CC BY 4.0