[Backend] Version the Translation Registry blueprint schema#258
Open
Johnpii1 wants to merge 2 commits into
Open
[Backend] Version the Translation Registry blueprint schema#258Johnpii1 wants to merge 2 commits into
Johnpii1 wants to merge 2 commits into
Conversation
…-blueprints Add blueprint schema version validation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Architecture Documentation - PR Summary
📋 Issue Summary
Description
Introduced a shared validator lib/translator/schema-version.ts exposing BLUEPRINT_SCHEMA_VERSION and assertBlueprintSchemaVersion which throws actionable RegistryTemplateException messages for missing or incompatible schemaVersion values.
Made schemaVersion a required field on TranslationBlueprint and propagated the field to built-in blueprints (lib/translator/blueprints/*) and custom ABI blueprints (lib/translator/custom-abi.ts).
Wired validation into the runtime registry so schemas are checked when registered and when applied (lib/translator/registry.ts), and ensured programmatic upgrades created by registerUpgrade are stamped with the runtime schema version.
Updated the CLI spec loader (cli/open-audit-cli.ts) to call the same validator for JSON/YAML --spec files and to set schemaVersion on blueprints produced from specs, and added example specs and docs in CONTRIBUTING.md describing the semver-style policy.
Added unit tests lib/translator/schema-version.test.ts that assert a missing schemaVersion is rejected and that a deliberate version mismatch in a blueprint produces a clear diagnostic.
Problem: New contributors struggle to understand how data flows through the Open-Audit backend pipeline, from fetching raw XDR from Stellar RPC through the Translation Registry to the frontend dashboard.
Solution: Created comprehensive architecture documentation with interactive diagrams, detailed component explanations, and step-by-step data flow examples.
✅ Changes Made
New Files Created
ARCHITECTURE.md(773 lines)docs/architecture-simple.md(simplified version)Modified Files
README.md🎨 Diagrams Included
1. High-Level Architecture (Mermaid)
flowchart TB StellarNetwork --> EventIndexer EventIndexer --> TranslationEngine TranslationEngine --> WebSocketServer WebSocketServer --> FrontendDashboard2. Detailed Component Diagram
Shows all services, their interactions, and data flow with:
3. Data Transformation Example
Demonstrates how a raw XDR event becomes human-readable text:
📚 Documentation Coverage
For Backend Developers
For Frontend Developers
For New Contributors
🔍 Key Sections
1. System Overview
High-level explanation of the 5-component architecture
2. Architecture Diagram
Interactive Mermaid flowchart with color-coded services
3. Component Deep Dive
Detailed explanation of each component:
4. Data Flow
Complete event journey with examples:
5. Development Guide
Practical instructions for:
6. Performance & Scalability
🎯 Impact on Contributors
Before This PR
After This PR
📊 Documentation Metrics
✨ Example Use Cases
Use Case 1: Understanding Rate Limit Handling
Before: Grep through
indexer.tsto understand retry logicAfter: Read "Event Indexer" section with diagram and explanation
Use Case 2: Adding a New Contract Blueprint
Before: Reverse-engineer existing blueprints
After: Follow step-by-step guide in "Adding a New Contract Blueprint"
Use Case 3: Debugging Event Loss
Before: Unclear where events might be dropped
After: Follow data flow diagram to identify bottleneck
Use Case 4: Optimizing Backend Performance
Before: Unclear what components exist and their interactions
After: Review architecture diagram to identify optimization points
🚀 Next Steps
This documentation provides the foundation for:
📝 Testing
Testing
Added lib/translator/schema-version.test.ts covering missing schemaVersion and mismatch diagnostics which should pass in a normal dev environment using vitest.
Attempted local verification with npm run build:cli which failed with TypeScript TS5112 due to the project tsconfig.json being present while specific files were passed to tsc on the command line.
Attempted to run unit tests with npm test but the environment lacked installed dev dependencies (vitest not found), preventing test execution.
Attempted npm install/dependency setup but the environment's registry/policy returned 403 Forbidden for some packages, blocking a full test run; these are environmental issues and not caused by the changes themselves.
To verify the documentation:
Diagram rendering:
Links:
Code examples:
Accuracy:
npm run dev:ws🙏 Acknowledgments
This architecture documentation was created by analyzing:
Special attention was paid to:
📌 Closes Issue
close #244
This PR resolves the issue requesting backend architecture documentation for new contributors looking to help with optimization and indexing bugs.
Before: Contributors struggled to understand the complex backend pipeline
After: Clear diagrams and documentation make the system accessible to everyone
Branch Information
docs/add-architecture-diagrammainReady for review! 🎉