refactor: backend extension traits, test coverage, JS events, ASAN fix#54
refactor: backend extension traits, test coverage, JS events, ASAN fix#54AndrewAltimit merged 9 commits intomainfrom
Conversation
Add 49 new pure-logic tests across two crates (PR 6 from refactor plan): demux_lite.rs (21 new tests): - Truncated/empty box headers, invalid box sizes, extended size errors - Zero-size box (extends to EOF), oversized box skipping - Missing moov/empty moov, parse_moov_tracks edge cases - Empty stts/stsc/stsz/stco tables, sample offset/PTS edge cases - AVCC→Annex B: empty data, NAL exceeds bounds, invalid NAL length size - read_desc_len: single/multi/empty, ctts negative offset clamping - find_keyframe_before/find_sample_at with empty tables tv_controller.rs (28 new tests): - should_throttle: extract pure function, test all 12 boundary cases (decoder=0 ± moov ± buf threshold, decoder>0 ± lookahead boundary) - linear_seek_interpolation: extract pure function, test 8 cases (zero/half/full/beyond duration, zero/negative duration, small/large files) - parse_moov_duration: v0, zero timescale, missing mvhd, too short - maybe_evict: 5 tests (small buffer, large buffer, disabled, cursor at start, preserves data near cursor) Also refactors inline seek interpolation formulas to use the extracted linear_seek_interpolation() helper for consistency and testability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add ~85 pure-logic unit tests covering: SDL backend (lib.rs): key_up edge cases (Backspace/F11 not mapped), F-key coverage, letter-key selectivity, wheel delta sign inversion, mouse coordinate truncation, frect/fpoint conversion helpers. WASM backend (input.rs): Extract scale_point_math() pure function from scale_point() for testable letterbox coordinate scaling. 19 tests cover identity, 2x scaling, horizontal/vertical letterboxing, clamping, aspect ratio variations, zero-size elements, fractional coords, DPI. PSP backend (input.rs): Extract analog_to_cursor_delta(), clamp_cursor(), apply_deadzone() helpers. 15 tests for deadzone threshold, cursor speed, boundary clamping, button/trigger map completeness, constant values. PSP backend (lib.rs): Add from_abgr() decode function and 20 tests for RGBA-to-ABGR encode, decode, and round-trip for all primary colors, transparent, arbitrary values, min/max channels. UE5 backend (input.rs): 8 additional tests for coordinate passthrough, boundary values, multiple poll drain cycles, all-button round-trip. UE5 backend (renderer.rs): 28 tests for lerp_u8 endpoints/midpoint/ zero-denominator, lerp_color, intersect_clip, RGBA buffer layout for all primary colors, alpha blending, transparency, out-of-bounds pixel safety, and RGBA encode/decode round-trip. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…AN fix Backend trait surface area: - Split SdiBackend (48 methods) into 8 focused extension traits (SdiShapes, SdiGradients, SdiAlpha, SdiText, SdiTextures, SdiClipTransform, SdiVector, SdiBatch) with blanket impls - Remove dead code: draw_text_weighted (never overridden) - Existing SdiBackend kept intact for backwards compat (Phase 1) Test coverage (~200 new tests): - Input mapping: SDL (13), WASM (19), PSP (15), UE5 (8) tests - Color/pixel conversion: PSP ABGR (20), UE5 RGBA/lerp/clip (28) tests - Video demux: 21 error path tests (truncated headers, missing atoms, empty sample tables, AVCC edge cases) - Streaming: 28 tests (throttle logic, seek interpolation, moov parsing, buffer eviction) with extracted pure helper functions Browser JS runtime: - Retain JsEngine beyond page load (stored in BrowserWidget) - Event bubbling via __oasis_dispatch_with_bubbling (target→root) - stopPropagation, preventDefault, target/currentTarget support - Hit-test clicks through layout tree to dispatch to JS listeners - 8 new JS event dispatch tests CI fixes: - Fix ASAN "incompatible runtimes" by removing CFLAGS=-fsanitize=address (SDL3 C code conflicted with Rust's ASan runtime) - Expand memory-ci PR trigger paths (oasis-app, backend-sdl, backend-ue5, oasis-types, Cargo.toml/lock) - Add advisory nightly clippy step to PR validation pipeline - Fix unused_comparisons warning in oasis-vector anim.rs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CLAUDE.md: SdiBackend 39 methods + 8 extension traits, JS event dispatch - design.md: update method counts in 2 locations - ADR 003: update method counts, document extension traits - AGENTS.md: update method count - Plan doc: mark Phase 1 as implemented Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Benchmarks add significant time to PR validation without blocking value. They can be run manually or in main-ci instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Benchmarks now only run on workflow_dispatch, skipped for PRs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Gemini AI Code ReviewIssues (if any)
Previous Issues (for incremental reviews)(none) Suggestions (if any)
Notes
Generated by Gemini AI (gemini-3.1-pro-preview). Supplementary to human reviews. |
Review Response Agent (Iteration 1)Status: No changes needed Fixed Issues
Ignored Issues
Deferred to Human
Notes
The agent reviewed feedback but determined no code changes were required. |
…g boxes Change SdiVector supertrait from SdiCore to SdiShapes so defaults can use ext_fill_triangle (triangle fan decomposition) for polygons/arcs and ext_draw_line for stroke outlines instead of crude fill_rect bounding boxes. Addresses Gemini review feedback on PR #54. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Gemini AI Incremental ReviewThis is an incremental review focusing on changes since the last review. Issues (if any)
Previous Issues (for incremental reviews)
Suggestions (if any)
Notes
Generated by Gemini AI (gemini-3.1-pro-preview). Supplementary to human reviews. |
Automated fix by Claude in response to Gemini/Codex review. Iteration: 2/5 Co-Authored-By: AI Review Agent <noreply@anthropic.com>
Review Response Agent (Iteration 2)Status: Changes committed, pushing... Commit: Fixed Issues
Ignored Issues
Deferred to Human
Notes
Automated summary of agent fixes. |
- Fix formatting in SdiVector extension trait defaults - Update pre-commit config: cargo fmt auto-fixes on commit (local, not Docker), clippy runs on pre-push only (too slow per commit) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Gemini AI Incremental ReviewThis is an incremental review focusing on changes since the last review. Previous Issues (for incremental reviews)
Issues (if any)(none) Suggestions (if any)
Notes
Generated by Gemini AI (gemini-3.1-pro-preview). Supplementary to human reviews. |
Review Response Agent (Iteration 3)Status: No changes needed Fixed Issues
Ignored Issues
Deferred to Human
Notes
The agent reviewed feedback but determined no code changes were required. |
Summary
Backend trait refactor: Split
SdiBackend(39 methods) into 8 focused extension traits (SdiShapes,SdiGradients,SdiAlpha,SdiText,SdiTextures,SdiClipTransform,SdiVector,SdiBatch) with blanket impls. Phase 1 -- additive only, no breaking changes. Removed deaddraw_text_weightedmethod.~200 new tests across platform-critical code:
scale_point_math,analog_to_cursor_delta,apply_deadzone)should_throttle_pure()andlinear_seek_interpolation()helpersBrowser JS runtime: Retain
JsEnginebeyond page load, event bubbling via__oasis_dispatch_with_bubbling(target to root withstopPropagation/preventDefault), hit-test clicks through layout tree to dispatch to JS listeners. 8 new event dispatch tests.ASAN fix: Remove
CFLAGS="-fsanitize=address"from memory-ci (SDL3 C code conflicted with Rust's ASan runtime). Expand memory-ci PR trigger paths. Add advisory nightly clippy to PR validation. Fixunused_comparisonswarning in oasis-vector.Docs: Update SdiBackend method counts (30 to 39) across CLAUDE.md, design.md, ADR 003, AGENTS.md.
Verified
cargo clippy --workspace -- -D warningscleancargo test --workspace-- all passing, 0 failurescargo fmt --all -- --checkcleancargo +nightly psp --release)build-wasm.sh --release)Test plan
addEventListener("click", ...)fire callbacks on clickGenerated with Claude Code