serialization-audit

Compares JSON serialization behavior across branches by auditing API requests, Elasticsearch documents, and responses.

2.5k|507|Updated Feb 7, 2014
One-click install
npx skills add https://github.com/exceptionless/Exceptionless --skill serialization-audit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: serialization-audit
Source: https://github.com/exceptionless/Exceptionless/tree/main/.agents/skills/serialization-audit
Command: npx skills add https://github.com/exceptionless/Exceptionless --skill serialization-audit

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Migrating serializers (e.g., Newtonsoft to System.Text.Json) or changing naming policies can silently break backwards compatibility in JSON APIs. This Skill detects behavioral differences by snapshotting the full pipeline—API submission, queue processing, Elasticsearch storage, and API responses—on two branches and diffing the results.

Core Features & Use Cases

  • Branch Comparison Audits: Runs a PowerShell script against a locally running Exceptionless instance on each branch, capturing request.json, elastic.json, and response.json per scenario for diffing.
  • Casing and Edge-Case Scenarios: Submits events with snake_case, camelCase, PascalCase, and mixed casing, plus special characters, numeric edge cases, null/empty values, and varied date formats.
  • Difference Categorization and Fixes: Classifies diffs by severity (casing binding failures, date parsing expansion, numeric precision) and guides writing targeted unit tests and serializer fixes.
  • Use Case: When migrating from Newtonsoft to System.Text.Json, run the audit on main and the feature branch, diff the outputs, and verify that payloads like PascalCase ReferenceId still bind correctly end-to-end.

Quick Start

Run the serialization audit on both the main and feature branches with the audit-api-surface.ps1 script, then diff the audit-output directories to find serialization differences.

Frequently Asked Questions about serialization-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test JSON serialization backwards compatibility when migrating from Newtonsoft to System.Text.Json?

Run the audit script on both the old and new branches against a locally running API, then diff the captured request, Elasticsearch, and response JSON files. Differences reveal casing binding failures, date parsing changes, and numeric precision issues that unit tests can then target.

How do I compare API serialization behavior between two git branches?

Check out each branch, start the app with aspire run, and execute audit-api-surface.ps1 with a shared AuditRunId and distinct BranchName values. Then diff the audit-output directories to see per-scenario differences in stored and returned JSON.

What JSON casing conventions does the audit test?

The audit submits events using snake_case, camelCase, PascalCase, and mixed casing payloads. The design principle is snake_case output with any-case input, so deserialization must accept all conventions while serialization emits snake_case.

What are the requirements for running the serialization audit script?

The Exceptionless API and Elasticsearch must be running locally through Aspire before executing the PowerShell script. The script posts events, polls until processing completes, and queries Elasticsearch directly for stored documents.

Why do date-only strings change format after a serializer migration?

Some converters expand date-only strings like 2026-01-15 into full DateTimeOffset values with time and offset components. The fix is to check for a time separator before calling TryGetDateTimeOffset in the ObjectToInferredTypesConverter, preserving user data types.