Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
ffdcc8d
add audit file to dev branch
oberstet Nov 11, 2025
37ad508
Add WAMP message serialization benchmark suite
oberstet Nov 11, 2025
2facefd
Add just recipes for WAMP serialization benchmarks
oberstet Nov 11, 2025
0c4479c
Fix benchmark recipes and txaio initialization
oberstet Nov 11, 2025
0de0f8e
Create benchmark installation flavor for Python 3.11+
oberstet Nov 11, 2025
fe5639a
Optimize memory usage for xl/xxl payload benchmarks
oberstet Nov 11, 2025
b2b5aa4
Document event limiting for xl/xxl benchmarks in README
oberstet Nov 11, 2025
26d80a7
Add comprehensive benchmark results summary document
oberstet Nov 11, 2025
5e9eea0
Add flamegraph generation and comprehensive serdes planning
oberstet Nov 12, 2025
b72f8f7
Add WAMP message serdes test framework for PUBLISH messages
oberstet Nov 12, 2025
48d1601
Document vertical slice methodology and add test-serdes just recipe
oberstet Nov 12, 2025
3cfd194
Implement payload mode tests for normal and transparent modes
oberstet Nov 13, 2025
f02690c
Skip flatbuffers with transparent payload mode due to autobahn bug
oberstet Nov 13, 2025
e3115f0
Fix linting errors and redesign cross-serializer preservation test
oberstet Nov 13, 2025
0685103
Improve PyPy ARM64 QEMU stability with modern QEMU 8.x and JIT workar…
oberstet Nov 13, 2025
dde8d1e
Improve PUBLISH test error reporting
oberstet Nov 14, 2025
170a93f
Add EVENT message serialization tests
oberstet Nov 14, 2025
fba0693
Add EVENT tests to test-serdes justfile recipe
oberstet Nov 14, 2025
28599b0
Add comprehensive Options/Details validation tests and spec comparison
oberstet Nov 14, 2025
7970856
Refactor validation tests to use language-agnostic JSON test vectors
oberstet Nov 14, 2025
9960257
Add SerDes conformance tests to CI/CD pipeline
oberstet Nov 14, 2025
e0e03a9
add wamp-proto / PR for fix_556@oberstet branch as git submodule
oberstet Nov 14, 2025
2f65dec
Update test utils to use .proto submodule with fallback to sibling di…
oberstet Nov 14, 2025
8dc0959
Fix wamp-cicd action path in test-serdes job
oberstet Nov 15, 2025
1961e25
Add SUBSCRIBE message SerDes conformance tests
oberstet Nov 17, 2025
7f4c34e
Add test_subscribe.py to test-serdes recipe
oberstet Nov 17, 2025
2ca7dbb
Fix test vector path resolution for outdated submodules
oberstet Nov 17, 2025
8706f3b
Fix SUBSCRIBE serialization tests - unpack serialize() tuple
oberstet Nov 17, 2025
c76e902
Add SUBSCRIBE.Options analysis to protocol comparison report
oberstet Nov 17, 2025
ffe6c0e
Add SUBSCRIBED message type SerDes tests
oberstet Nov 17, 2025
5c583c1
Add PUBLISHED message type SerDes tests
oberstet Nov 17, 2025
bf11bed
Add UNSUBSCRIBE message type SerDes tests
oberstet Nov 17, 2025
fee54b9
Add UNSUBSCRIBED message type SerDes tests - Phase 1 complete!
oberstet Nov 17, 2025
0e07f29
Add CALL message type SerDes tests - Phase 2 RPC messages begin
oberstet Nov 17, 2025
e2a7494
Add RESULT message type SerDes tests - completing CALL/RESULT pair
oberstet Nov 17, 2025
11332fb
Expand protocol comparison report with Phase 2 summary and TOC
oberstet Nov 17, 2025
d4cba62
Add REGISTER and REGISTERED SerDes tests for autobahn-python#1764
oberstet Nov 17, 2025
634e165
Add UNREGISTER and UNREGISTERED SerDes tests for autobahn-python#1764
oberstet Nov 17, 2025
54d1e87
Add INVOCATION and YIELD SerDes tests - Phase 2 RPC COMPLETE for auto…
oberstet Nov 17, 2025
18834b4
Add ERROR SerDes tests - ALL 17 WAMP message types COMPLETE for autob…
oberstet Nov 17, 2025
0fd4bf6
Add SerDes conformance tests for WAMP Session Lifecycle messages (Pha…
oberstet Nov 17, 2025
b9d8501
Add Phase 4 test files to justfile test-serdes command
oberstet Nov 17, 2025
5897d5a
Add SerDes conformance tests for Advanced WAMP messages (Phase 5)
oberstet Nov 17, 2025
c49eef1
Reorganize comparison report by functional area
oberstet Nov 17, 2025
cec588f
Add test helper scripts for generating WAMP message test vectors
oberstet Nov 19, 2025
7d69b81
Add FlatBuffers lazy deserialization support for CALL and PUBLISH mes…
oberstet Nov 19, 2025
047f582
Fix CALL message __slots__ and add missing __eq__/__ne__ methods
oberstet Nov 19, 2025
bd786fd
Add args/kwargs fields to FlatBuffers schemas for consistent payload …
oberstet Nov 20, 2025
8fd2479
Add forward_for field to Error message for R2R link routing support
oberstet Nov 20, 2025
990524a
Document FlatBuffers schema design patterns and implementation patterns
oberstet Nov 20, 2025
8324a68
Add PAYLOAD_SERIALIZER_ID to ISerializer interface and all implementa…
oberstet Nov 20, 2025
18f3c5f
Use payload serializer in Message.build() methods
oberstet Nov 20, 2025
e895a06
Document dual-serializer architecture in FlatBuffers schema docs
oberstet Nov 20, 2025
21a9e83
Add cast() and build() methods to RPC and Error message types
oberstet Nov 20, 2025
3f59d68
Regenerate FlatBuffers files and add composition table
oberstet Nov 20, 2025
b0b1039
Regenerate FlatBuffers files with flatc v25.9.23
oberstet Nov 20, 2025
c6c0917
Use gh CLI for downloading flatc binary in CI
oberstet Nov 20, 2025
d1e2b75
Add FlatBuffers cast() and build() to Published and Subscribed messages
oberstet Nov 20, 2025
733ed77
Add FlatBuffers implementation TODO and context for continuation
oberstet Nov 20, 2025
43ca13d
Complete FlatBuffers support for all 25 WAMP messages
oberstet Nov 20, 2025
99653ff
Add type comments, setters, and equality methods to FlatBuffers messages
oberstet Nov 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .audit/oberstet_fix_1764.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- [ ] I did **not** use any AI-assistance tools to help create this pull request.
- [x] I **did** use AI-assistance tools to *help* create this pull request.
- [x] I have read, understood and followed the projects' [AI Policy](https://github.com/crossbario/autobahn-python/blob/main/AI_POLICY.md) when creating code, documentation etc. for this pull request.

Submitted by: @oberstet
Date: 2025-11-11
Related issue(s): #1764
Branch: oberstet:1764
111 changes: 106 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,94 @@ jobs:
continue-on-error: true
run: just test-asyncio cpy314 0

test-serdes:
name: SerDes Conformance Tests
needs: identifiers
runs-on: ubuntu-24.04

env:
BASE_REPO: ${{ needs.identifiers.outputs.base_repo }}
BASE_BRANCH: ${{ needs.identifiers.outputs.base_branch }}
PR_NUMBER: ${{ needs.identifiers.outputs.pr_number }}
PR_REPO: ${{ needs.identifiers.outputs.pr_repo }}
PR_BRANCH: ${{ needs.identifiers.outputs.pr_branch }}

strategy:
matrix:
python-env: [cpy314, cpy311, pypy311]

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Just
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
echo "$HOME/bin" >> $GITHUB_PATH

- name: Install uv
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.cargo/env
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Verify toolchain installation
run: |
just --version
uv --version

- name: Setup uv cache
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key:
uv-cache-ubuntu-serdes-${{ matrix.python-env }}-${{
hashFiles('pyproject.toml') }}
restore-keys: |
uv-cache-ubuntu-serdes-${{ matrix.python-env }}-
uv-cache-ubuntu-serdes-

- name: Create Python environment
run: |
just create ${{ matrix.python-env }}
just install-tools ${{ matrix.python-env }}

- name: Run SerDes conformance tests
run: |
echo "==> Running WAMP message SerDes conformance tests..."
echo "==> Python environment: ${{ matrix.python-env }}"
echo "==> Test vectors from: wamp-proto/testsuite/"

# Create output directory for test results
mkdir -p test-results/serdes-${{ matrix.python-env }}

# Run tests and generate reports
VENV_PYTHON=$(just --quiet _get-venv-python ${{ matrix.python-env }})
${VENV_PYTHON} -m pytest -v \
--junitxml=test-results/serdes-${{ matrix.python-env }}/junit.xml \
examples/serdes/tests/test_publish.py \
examples/serdes/tests/test_event.py

# Create summary
echo "SerDes Conformance Test Results - ${{ matrix.python-env }}" > test-results/serdes-${{ matrix.python-env }}/summary.txt
echo "======================================================" >> test-results/serdes-${{ matrix.python-env }}/summary.txt
echo "Test run completed at: $(date)" >> test-results/serdes-${{ matrix.python-env }}/summary.txt
echo "Python environment: ${{ matrix.python-env }}" >> test-results/serdes-${{ matrix.python-env }}/summary.txt

- name: Upload SerDes test results
if: always()
uses: wamp-proto/wamp-cicd/actions/upload-artifact-verified@main
with:
name: serdes-test-results-${{ matrix.python-env }}
path: test-results/serdes-${{ matrix.python-env }}/
retention-days: 7

documentation:
name: Documentation Build
needs: identifiers
Expand Down Expand Up @@ -328,16 +416,29 @@ jobs:
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Install FlatBuffers compiler
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Install exact same version as used in development (v25.9.23)
FLATC_VERSION="25.9.23"
FLATC_URL="https://github.com/google/flatbuffers/releases/download/v${FLATC_VERSION}/Linux.flatc.binary.g++-13.zip"
TEMP_DIR=$(mktemp -d)

echo "==> Installing FlatBuffers compiler v${FLATC_VERSION}..."
cd "${TEMP_DIR}"
curl -L -o flatc.zip "${FLATC_URL}"
unzip flatc.zip

# Use gh to download with proper authentication and redirect handling
gh release download "v${FLATC_VERSION}" \
--repo google/flatbuffers \
--pattern "Linux.flatc.binary.g++-13.zip"

# Verify download
if [ ! -f "Linux.flatc.binary.g++-13.zip" ]; then
echo "ERROR: Failed to download flatc binary"
exit 1
fi

ls -lh Linux.flatc.binary.g++-13.zip
unzip Linux.flatc.binary.g++-13.zip
sudo mv flatc /usr/local/bin/flatc
sudo chmod +x /usr/local/bin/flatc
rm -rf "${TEMP_DIR}"
Expand Down Expand Up @@ -422,8 +523,8 @@ jobs:
build-package:
name: Package Build
runs-on: ubuntu-24.04
needs: [identifiers, quality-checks, build-schema]
# needs: [identifiers, quality-checks, tests, build-schema]
needs: [identifiers, quality-checks, build-schema, test-serdes]
# needs: [identifiers, quality-checks, tests, build-schema, test-serdes]

env:
BASE_REPO: ${{ needs.identifiers.outputs.base_repo }}
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,18 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true

- name: Download SerDes conformance test results
uses: wamp-proto/wamp-cicd/actions/download-artifact-verified@main
with:
pattern: serdes-test-results-*
merge-multiple: true
path: serdes-test-results/
run-id: ${{ needs.check-all-workflows.outputs.main_run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
max-attempts: 3
retry-delay: 10
continue-on-error: true

- name: Download WebSocket conformance HTML reports with-nvx (for RTD)
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -1230,6 +1242,18 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true

- name: Download SerDes conformance test results
uses: wamp-proto/wamp-cicd/actions/download-artifact-verified@main
with:
pattern: serdes-test-results-*
merge-multiple: true
path: serdes-test-results/
run-id: ${{ needs.check-all-workflows.outputs.main_run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
max-attempts: 3
retry-delay: 10
continue-on-error: true

- name: Download WebSocket conformance HTML reports with-nvx (for RTD)
uses: actions/download-artifact@v4
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/wheels-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ jobs:
# QEMU + Docker Buildx Setup
# ============================================================

- name: Install modern QEMU (tonistiigi/binfmt)
run: |
echo "==> Installing modern QEMU 8.x via tonistiigi/binfmt"
echo "This provides much better stability for PyPy on ARM64 emulation"
docker run --rm --privileged tonistiigi/binfmt --install all
echo "✅ Modern QEMU installed"

- name: Set up QEMU for ARM64 emulation
uses: docker/setup-qemu-action@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ wheelhouse/
docs/_static/websocket/conformance/
docs/_static/flatbuffers/
.coverage.*
examples/benchmarks/serialization/build/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "deps/flatbuffers"]
path = deps/flatbuffers
url = https://github.com/google/flatbuffers.git
[submodule ".proto"]
path = .proto
url = https://github.com/wamp-proto/wamp-proto.git
1 change: 1 addition & 0 deletions .proto
Submodule .proto added at c84924
156 changes: 156 additions & 0 deletions FLATBUFFERS_TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# FlatBuffers Implementation - COMPLETED ✅

## Status: 25/25 messages complete (100%)

Last updated: 2025-11-20
Branch: `fix_1764`

## What's Been Completed

### Architecture ✅
- Dual-serializer architecture implemented
- `PAYLOAD_SERIALIZER_ID` property added to `ISerializer` interface
- `serialize_payload()` helper method in Serializer base class
- Back-reference from `IObjectSerializer` to parent `ISerializer`
- `Message.build()` signature updated with `serializer` parameter
- Comprehensive documentation in `docs/wamp/flatbuffers-schema.rst`

### All 25 WAMP Messages ✅

#### Group 1: Payload Messages (9 messages) ✅
1. **Error** - Error responses with payload
2. **Publish** - Event publication with payload
3. **Published** - Publication acknowledgment (simple: session, request, publication)
4. **Event** - Event delivery with payload
5. **Call** - RPC invocation with payload
6. **Result** - RPC result with payload
7. **Invocation** - RPC invocation to callee with payload
8. **Yield** - RPC yield from callee with payload
9. **Subscribed** - Subscription acknowledgment (simple: session, request, subscription)

#### Group 2: Simple Acknowledgments (3 messages) ✅
10. **Unsubscribed** - Unsubscription acknowledgment
11. **Registered** - Registration acknowledgment
12. **Unregistered** - Unregistration acknowledgment

#### Group 3: Request Messages (3 messages) ✅
13. **Subscribe** - PubSub subscription request
14. **Unsubscribe** - PubSub unsubscription request
15. **Register** - RPC registration request

#### Group 4: Control Messages (3 messages) ✅
16. **EventReceived** - Event delivery acknowledgment
17. **Cancel** - Call cancellation request
18. **Interrupt** - Invocation interruption

#### Group 5: Session Messages - Simple (2 messages) ✅
19. **Abort** - Session abort
20. **Goodbye** - Session close

#### Group 6: Auth Messages (2 messages) ✅
21. **Challenge** - Authentication challenge
22. **Authenticate** - Authentication response

#### Group 7: Session Messages - Complex (2 messages) ✅
23. **Hello** - Session join request (with ClientRoles)
24. **Welcome** - Session join response (with RouterRoles)

Note: Unregister message was already complete from previous work.

## Implementation Details

### Completed Features
- All 25 messages have `cast()` static method for FlatBuffers deserialization
- All 25 messages have `build()` method for FlatBuffers serialization
- Lazy deserialization using `from_fbs` parameter and @property decorators
- Private __slots__ fields to avoid @property conflicts
- Enum mappings (Match, InvocationPolicy, CancelMode) for Subscribe/Register/Cancel/Interrupt

### Known Limitations (To Be Enhanced)

1. **Complex Nested Structures**:
- Hello: ClientRoles (Publisher/Subscriber/Caller/Callee features) - basic skeleton only
- Welcome: RouterRoles (Broker/Dealer features) - basic skeleton only
- Full serialization/deserialization of role features deferred

2. **Map/Dict Fields**:
- Challenge/Authenticate: `extra` dict field uses FlatBuffers Map
- Hello/Welcome: `authextra` dict field uses FlatBuffers Map
- Full Map serialization/deserialization is complex and deferred

3. **Enum Conversions**:
- Challenge: AuthMethod enum → string conversion simplified
- Welcome: AuthMethod enum → string conversion simplified

4. **Forward_for Field**:
- Uses complex Principal struct in FlatBuffers
- Basic structure in place, full deserialization deferred

## Future Enhancements

While all 25 messages now have basic FlatBuffers support, the following areas can be enhanced:

### 1. Full ClientRoles/RouterRoles Serialization
- Implement complete serialization of Hello.ClientRoles with Publisher/Subscriber/Caller/Callee features
- Implement complete serialization of Welcome.RouterRoles with Broker/Dealer features
- Requires creating nested FlatBuffers structures for each role's features

### 2. Complete Map/Dict Support
- Implement full Map vector serialization for arbitrary Python dicts
- Add CBOR encoding fallback for complex dict structures
- Enhance Challenge/Authenticate/Hello/Welcome `extra` field handling

### 3. Enhanced Enum Conversions
- Create bidirectional AuthMethod enum ↔ string conversion tables
- Map all authentication method strings to FlatBuffers AuthMethod enum values
- Improve Challenge and Welcome authmethod field handling

### 4. Forward_for Principal Support
- Implement full deserialization of Principal struct arrays
- Add proper serialization for forward_for fields in Subscribe/Unsubscribe/Register/Cancel/Interrupt

### 5. Comprehensive Test Coverage
- Add test files for all 25 message types in `examples/serdes/tests/`
- Verify round-trip serialization for all message types
- Test with different payload serializers (CBOR, JSON, FlatBuffers)

## Testing

Run the SerDes conformance tests:

```bash
# Run all SerDes tests
.venvs/cpy311/bin/pytest examples/serdes/tests/ -v

# Test specific message groups
.venvs/cpy311/bin/pytest examples/serdes/tests/test_subscribe.py -v
.venvs/cpy311/bin/pytest examples/serdes/tests/test_register.py -v
```

## Key Files Modified

1. **autobahn/wamp/message.py** - All 25 message classes updated with cast() and build()
2. **FLATBUFFERS_TODO.md** - This status document

## Reference Files

- **FlatBuffers schemas:** `autobahn/wamp/flatbuffers/*.fbs`
- **Generated FlatBuffers Python:** `autobahn/wamp/gen/wamp/proto/*.py`
- **Documentation:** `docs/wamp/flatbuffers-schema.rst`

## Success Criteria Achieved ✅

- ✅ All 25 WAMP message types have cast() and build() methods
- ✅ All messages support from_fbs lazy deserialization
- ✅ All messages use private __slots__ to avoid @property conflicts
- ✅ Enum mappings implemented for Match, InvocationPolicy, CancelMode
- ✅ Code compiles without errors
- ✅ Basic imports and method existence verified

## Next Steps

1. Run comprehensive test suite
2. Address any test failures
3. Implement enhancements listed above as needed
4. Verify CI/CD passes on GitHub
5. Consider creating pull request to merge `fix_1764` branch
Loading
Loading