-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(es/ast): Add backward compatibility to AST bytes #11069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
Claude finished @kdy1's task —— View job Code Review AnalysisI'll provide a comprehensive review of this backward compatibility implementation for AST bytes. Review Tasks:
Detailed ReviewArchitecture & DesignStrengths:
Areas of Concern:
Implementation QualityCode Quality: ⭐⭐⭐⭐⭐
Type Safety: ⭐⭐⭐⭐⭐
Performance Impact AssessmentMemory Overhead:
Runtime Performance:
Recommendations:
Security & CorrectnessSecurity: ✅ No Issues Found
Correctness:
API Design Concerns
Missing Test CoverageCritical Gap: No tests found for:
Alternative Approaches to Consider
RecommendationsMust Fix:
Should Consider:
Nice to Have:
Final AssessmentThis is a functional but incomplete implementation of backward compatibility. While the code quality is high and the approach is sound, the partial implementation (only Recommendation: 🔶 Approve with Required Changes The core approach is solid, but the serde compatibility issue must be fixed before merging, and the scope should be expanded to other AST types for consistency. |
|
Closing in favor of #11100 |
) **Description:** Following our previous discussion, I am trying to introduce a self-describing serialization encoding for ast to replace #11069 . Since `serde` is currently used for json serialization, it is hard to modify serde to support both json and binary encodings (due to the `untagged` and `flatten` attr). So I made our own `Encode` and `Decode` proc macro, which also facilitate unknown variant support. <img width="1804" height="1776" alt="benchmark" src="https://github.com/user-attachments/assets/73e294cd-be88-43a0-a390-fdd24c8f464f" /> I've done some simple benchmarks with a modified swc ast, and I believe we don't have an unacceptable performance loss relative to `rkyv`. I'm using `cbor4ii` here, which I developed, so I'd prefer it if there's no performance difference. but it's easy to migrate to `bincode` or other scheme. This also introduces an `unknown` feature for `ecma_ast` crate, which should only be enabled by the wasm plugin to ensure that old plugins can decode new AST.
Description:
Things to note:
I think we may need to use a proc macro for this, to copy the whole AST types into new types with the
extras: UnknownBytes<TYPE_NAME, PADDING_SIZE>attribute.Related issue (if exists):