djust 0.9.5rc4

Pre-releaseReleased

This is a pre-release. djust 0.9.5 has shipped since: read the djust 0.9.5 release notes.

Tests

  • Multi-cycle sync_ids round-trip torture (#1412 — regression-class hardener for #1408). Added crates/djust_vdom/tests/torture_round_trip_with_sync.rs exercising the production server loop (diffapply_patches on a faithful client tracker → sync_ids → store as last_vdom) across 4 scenarios: three-branch tab toggle, five-boundary independent toggles (THE bug-trigger; trips at round 4 on commit a44e63cb pre-fix), long alternation under matched boundary id, and same-tag siblings around unmatched boundaries. The crate's existing torture (tests/torture_test.rs, 42 tests) and proptest fuzz (tests/fuzz_test.rs) only test single-diff correctness; this file exercises the cross-render invariant — every emitted patch's targeting handle (d / child_d / ref_d) must resolve in the client tracker — that #1408 violated. Test count: djust_vdom 228 → 232. Proptest-randomized variant filed as follow-up #1413.
  • Test harness extracted to crates/djust_vdom/tests/common/mod.rs (#1415). Pure refactor; deduplicated dj-if marker helpers (dj_if_open, dj_if_close, is_dj_if_open*, match_close_idx), VNode lookup helpers, dj-if subtree manipulation, the subtree-aware apply_all patch applier, the cross-render assert_handles_resolve invariant checker, and the sequential IdGen dj-id generator. Unblocks #1413, #1416, #1417, #1418, #1419, #1420 — each will be a small focused PR rather than another 200-LOC duplication of helpers.

Fixed

  • VDOM sync_ids is now dj-if-boundary-aware (#1408). diff::diff_children already aligned children across <!--dj-if id="…"--> boundary swaps via dj_if_pre_pass (#1358); the post-diff sync_ids did not, falling through to sync_ids_keyed/sync_ids_indexed and positionally pairing children regardless of branch identity. After a {% if %} branch swap, fresh djust_ids on new-branch content were overwritten by stale ids from the unmatched-old-branch — the next render's diff then emitted RemoveChild/SetAttr patches whose child_d/d referenced ids the client DOM never had, leaving orphan content from the prior branch. Added sync_ids_dj_if_pre_pass mirroring dj_if_pre_pass's shape (id-only-in-OLD → skip, id-only-in-NEW → skip with fresh ids preserved, id-in-BOTH → recurse, non-boundary siblings → relative-order pairing via build_excluded_mask). Verified at the DJUST_VDOM_TRACE=1 level: pre-fix a tab-swap diff emitted RemoveChild child_d="2y" (a stale id from a render two cycles back) for the bottom-tab content slot; post-fix it correctly emits child_d="5m" matching what the previous diff's InsertChild placed there. Reproduced and verified-fixed against a downstream consumer's bottom-tab-swap reproducer. Regression test in crates/djust_vdom/tests/test_sync_ids_dj_if_1408.rs (4 cases; 3 fail pre-fix). All 228 existing djust_vdom tests still pass.

All releases · Atom feed