The GitHub Actions job "Fory CI" on fory.git/main has succeeded.
Run started by GitHub user chaokunyang (triggered by chaokunyang).

Head commit for run:
8e0d5f36b2d76bcb1a8a331af9651cecc1dcc8cd / Yash Agarwal 
<[email protected]>
feat(dart): Introduce id based enum serialization (#3482)

## Why?
The Dart module, only supports ordinal enum serialization, where each
enum
value is serialized as its position index (0, 1, 2...), which breaks in
different
cases like adding or reordering values. This adds optional id based
serialization
with so that we can provide unique id to every while preserving ordinal
serialization
as the default fallback.

## What does this PR do?

- Adds @ForyEnumId(int id) for enum values
- Registers ForyEnumId in analysis type detection
- Updates enum analysis to collect IDs and emit build-time warnings for:
         - partial @ForyEnumId usage
         - duplicate IDs
- Falls back to ordinal serialization when annotations are incomplete or
duplicated
- Extends EnumSpec with an optional idToValue map
- Updates generated enum specs to include the ID map when valid
- Updates EnumSerializer to use ID-based read/write when the map is
present, otherwise keep ordinal behavior
- Adds codegen and serializer tests

## Related issues

## AI Contribution Checklist

AI Usage Disclosure
AI assistance was used to suggest tests and for better warnings in
enum_analyzer.

dart/packages/fory/lib/src/codegen/analyze/impl/struct/enum_analyzer_impl.dart
    dart/packages/fory-test/test/

- [x] I included a completed [AI Contribution
Checklist](https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs)
in this PR description and the required AI Usage Disclosure.
- [x] I can explain and defend all important changes without AI help.
- [x] I reviewed AI-assisted code changes line by line before
submission.
- [x] I ran adequate human verification and recorded evidence (checks
run locally or in CI, pass/fail summary, and confirmation I reviewed
results).
- [x] I added/updated tests and specs where required.
- [x] I validated protocol/performance impacts with evidence when
applicable.
- [x] I verified licensing and provenance compliance.

## Does this PR introduce any user-facing change?
- [x] Does this PR introduce any public API change?
`@ForyEnumId` is a new annotation users will write in their code
          `ForyEnumId` class is publicly accessible
- [ ] Does this PR introduce any binary protocol compatibility change?

## Benchmark
General struct performance remained similar because those benchmarks do
not exercise enum serialization paths.

Report URL: https://github.com/apache/fory/actions/runs/24183083461

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to