Repository navigation
test(unified): cover the encoder half of the pose factorization - #2537
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
factorized_pose_resists_room_shortcut_leakage builds its latents by hand — content = [scale, 1], full = [scale, room_x/3, 1] — so the skeleton branch's room-independence holds by construction. It verifies FactorizedPoseHead's algebra given a factorized latent, not that RfEncoder produces one, which is the gap ruvnet#1438 describes. Add the missing half against the real encoder. z = g ⊙ gate + Wg·geo + bg, and encode_content returns g ⊙ gate with the window-mean token features and no additive room offset, so two windows differing only in geometry must produce the same content representation while their fused z differs. That is the complement of stale_windows_are_gated_toward_geometry_prior, which pins that z does move with geometry. Also record the existing test's scope in its doc comment and point at the new one. The test name is deliberately unchanged: ADR-281 cites it by name, and that ADR already states the toy scope ("on a toy that isolates the mechanism. MEASURED-CODE for the mechanism; not a pose-accuracy claim"), so renaming would break an accepted ADR's reference to describe something it already describes correctly. cargo test -p ruview-unified --no-default-features: 102 passed, 0 failed. Mutating encode_content to return cache.z (which carries the Wg·geo term) fails the new test, so it is sensitive to the property it names.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the first item of #1438 (
factorized_pose_resists_room_shortcut_leakage) by adding the coverage it is missing rather than by renaming it.What the existing test does and does not verify
heads.rsbuilds its latents by hand:contentsimply lacks theroom_xcolumn, so the skeleton branch's room-independence is true by construction. The test never callsRfEncoder::encode_content. What it genuinely verifies isFactorizedPoseHead's algebra given a factorized latent — which is worth keeping — not that the encoder produces one. That is the gap.The missing half
The encoder documents the contract itself:
encode_contentreturnsg ⊙ gateconcatenated with the window-mean token features, deliberately without the additiveWg·georoom offset (encoder.rs:294-300: "the additiveWg·geoterm is a room-specific offset a linear adapter would memorize").So two windows differing only in
geometrymust produce an identical content representation while their fusedzdiffers. The new test asserts exactly that against the real encoder, and it is the complement of the existingstale_windows_are_gated_toward_geometry_prior, which pins thatzdoes move with geometry. Together the two bracket the factorization the pose head relies on.Why the name is unchanged
#1438 is titled around names that overclaim, so to be explicit: I did not rename
factorized_pose_resists_room_shortcut_leakage.docs/adr/ADR-281-ble-cs-delay-doppler-pose-factorization.md:39cites it by name, and that ADR already states the scope correctly — "on a toy that isolates the mechanism. MEASURED-CODE for the mechanism; not a pose-accuracy claim." Renaming would break an accepted ADR's reference in order to describe something the ADR already describes accurately. Instead the test's own doc comment now records that its latents are synthetic and points at the new encoder test. Happy to rename and update ADR-281 in the same PR if you would rather have the name changed.This also leaves items 2 and 3 of #1438 (
empty_map_returns_exact_friis,inverse_update_learns_a_wall_from_link_residuals) alone — PR #2326 covers those two ingaussian/gain.rs.Validation
Rust 1.89.0, at
ce8d296c:The new test is verified to be sensitive rather than merely green: mutating
encode_contentto returncache.z— i.e. letting theWg·geoterm into the content path — fails it:Mutation reverted; the committed tree is the unmutated source.