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:
| Symbol | Meaning | Example |
|---|---|---|
โ | Transformation or mapping | E.Auth.Token.001 โ V6a0B |
โ | Annotation or comment | โ โ Part 1: Severity |
โ โโ | Hierarchy/tree structure | Component hierarchy diagrams |
โ โ โ | Box-drawing for diagrams | Structure overview boxes |
... | Continuation/ellipsis | 001, 002, ... 999 |
* | Wildcard in patterns | E.Auth.* (all Auth errors) |
[X] | Placeholder for value X | [SEVERITY.COMPONENT.PRIMARY.SEQUENCE] |
โ
/ โ | Recommended / Not recommended | Usage guidance |
| MUST, SHOULD, MAY | RFC 2119 keywords | Normative 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 5Structure 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
| Code | Meaning | Use Case |
|---|---|---|
| E | Error | Operation failed, needs attention |
| W | Warning | Potential issue, operation continues |
| C | Critical | System-critical failure |
| B | Blocked | Operation waiting/blocked |
| S | Success | Operation succeeded |
| K | Completed | Long-running task finished |
| I | Info | Informational message |
| T | Trace | Debug/trace information |
| H | Help | User 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 errorsExamples: 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 numericExamples: 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): V6a0BProperties:
- 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 unlimitedDual 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
| Property | Description |
|---|---|
| Parsable | The dot-delimited format enables programmatic decomposition into constituent parts |
| Routable | Systems MAY use component or primary fields to route diagnostics to appropriate handlers |
| Filterable | Wildcard patterns (e.g., E.Auth.*) enable efficient filtering and aggregation |
| Actionable | Severity and component fields enable automated escalation and routing policies |
| Self-describing | The 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
| Property | Description |
|---|---|
| Fixed-length | Exactly 5 characters, regardless of structured code length |
| Transmission-efficient | Reduced payload size (5 bytes vs 15-30+ bytes for structured codes) |
| Deterministic | Identical structured codes MUST produce identical Compact IDs |
| Opaque | The Compact ID does not encode semantic information; lookup is required for interpretation |
| Universal | The 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 missingThe structured code enables filtering and human interpretation; the Compact ID enables cross-system search.
API Response Example:
{
"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: V6a0BUser 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:
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:
-- 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:
-- 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 failedStructured code only. Human-readable and self-documenting.
Pattern 2: Compact API
{"error": "V6a0B"}Compact ID only. Client resolves details via catalog lookup.
Pattern 3: Full Context
[ERROR] E.Auth.Token.001 (V6a0B): Authentication failedBoth representations. Provides semantic meaning and searchable hash.
Pattern 4: Structured Logging
{
"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:
| Requirement | Representation | Properties |
|---|---|---|
| Semantic identity | Structured code | Hierarchical, parsable, self-describing |
| Efficient reference | Compact ID | Fixed-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:
| Operation | Pattern | Description |
|---|---|---|
| Route by component | Auth.* | Direct diagnostics to component-specific handlers |
| Filter by severity | C.*.*.* | Select all critical-severity diagnostics |
| Group by primary | E.Auth.Token.* | Aggregate diagnostics within a failure domain |
| Query by convention | *.*.*.001 | Select diagnostics matching semantic conventions |
| Direct lookup | V6a0B | Retrieve 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 -> V6a0BThis 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:
| Representation | Without Catalog | Interpretability |
|---|---|---|
E.Auth.Token.001 | Interpretable | Severity, component, and primary fields convey semantic meaning |
V6a0B | Opaque | Requires 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 Type | RECOMMENDED Approach |
|---|---|
| Simple systems | Structured code only |
| Advanced systems | Full 5-part structure |
| Bandwidth-constrained | Compact ID + catalog |
| Legacy integration | Map 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] -> V6a0BLocalized 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] -> V6a0BThe 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 hashSee: 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:
| Part | Document | Stability | Notes |
|---|---|---|---|
| 1 | 1-SEVERITY | Stable | Severity codes (E, W, C, I, H) are fixed |
| 2 | 2-COMPONENT | Stable | Component field format is fixed |
| 3 | 3-PRIMARY | Stable | Primary field format is fixed |
| 4 | 4-SEQUENCE | Stable | Sequence format (001-999) is fixed |
| 5 | 5-COMPACT-IDS | Stable | xxHash3 + Base62 encoding is fixed |
Provisional (May evolve with feedback)
These parts are well-designed but may evolve based on implementation experience:
| Part | Document | Stability | Notes |
|---|---|---|---|
| 7 | 7-NAMESPACES | Provisional | Namespace hash format is stable; boundary semantics may refine |
| 8 | 8-I18N | Provisional | Core model stable; locale fallback rules may evolve |
| 9 | 9-CATALOGS | Provisional | Catalog concept stable; format details may evolve |
| 9a | 9a-CATALOG-FORMAT | Catalog JSON schema may add optional fields; version field enables migration | |
| 9b | 9b-WIRE-PROTOCOL | Provisional | Wire format stable; content negotiation may be added |
| 9c | 9c-IMPLEMENTATION | Provisional | Examples may expand; patterns are recommendations |
| 11 | 11-SECURITY | Provisional | Security model stable; specific requirements may strengthen |
| 12 | 12-METADATA | Provisional | Schema structure stable; optional fields may be added |
Informative (Non-normative guidance)
These parts provide recommendations and may change freely:
| Part | Document | Stability | Notes |
|---|---|---|---|
| 6 | 6-SEQUENCE-CONVENTIONS | Informative | Conventions are suggestions only |
| 10 | 10-PRESENTATION | Informative | Visual guidelines are recommendations |
Evolution Principles
- Backward Compatibility: Stable parts SHALL NOT introduce breaking changes without a major version increment
- Catalog Versioning: The
versionfield in catalogs enables graceful migration - Optional Extension: New features SHALL be added as optional fields where possible
- 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.
| Part | Document | Description |
|---|---|---|
| 1 | 1-SEVERITY | Severity level definitions |
| 2 | 2-COMPONENT | Component field specification |
| 3 | 3-PRIMARY | Primary field specification |
| 4 | 4-SEQUENCE | Sequence field specification |
| 5 | 5-COMPACT-IDS | Compact ID hash generation |
12.2 Extended Specification (Parts 6-12)
These documents define OPTIONAL extensions and implementation guidance.
| Part | Document | Description |
|---|---|---|
| 6 | 6-SEQUENCE-CONVENTIONS | Sequence naming conventions (Informative) |
| 7 | 7-NAMESPACES | Namespace and error boundaries |
| 8 | 8-I18N | Internationalization support |
| 9 | 9-CATALOGS | Catalog system overview |
| 9a | 9a-CATALOG-FORMAT | Catalog file format |
| 9b | 9b-WIRE-PROTOCOL | Wire protocol specification |
| 9c | 9c-IMPLEMENTATION | Implementation guide |
| 10 | 10-PRESENTATION | Visual presentation guidelines (Informative) |
| 11 | 11-SECURITY | Security considerations |
| 12 | 12-METADATA | Metadata schema |
12.3 Supporting Documents
| Document | Description |
|---|---|
| README.md | Project overview and quick start |
| CONTRIBUTING.md | Contribution guidelines |
Appendix A. Quick Reference#
E.Auth.Token.001 -> V6a0B
^ ^ ^ ^ ^
PaPart Part 4: EPart 5: HashAppendix 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.