Skip to content

research(elements): RE-145 the native route takes the latest copy, and can land on an empty partition (#548) - #569

Merged
DrunkOnJava merged 6 commits into
mainfrom
re/re145-current-copy-report
Oct 3, 2026
Merged

DrunkOnJava merged 6 commits into
mainfrom
re/re145-current-copy-report

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

This answers #548, which copy of an element's record is current, for every file measured (Measure runs 37116666890 and 37117317288).

New: the probe examples/probe_re145_current_copy_routing.rs and the report reports/element-framing/RE-145-current-copy-routing.md.

Open: why the route lands on an empty partition.


Note

Low Risk
Research-only: new probe example, report, and changelog; no production extraction or routing code changes in this diff.

Overview
Documents RE-145 research for #548: how native_index::route_episode chooses which partition’s channel-101 record counts as “current” when an element appears in multiple partitions.

Adds examples/probe_re145_current_copy_routing.rs, which walks partition streams, compares routed partitions to where records live, and (on admitted Revit versions) cross-checks native_document::extract skip/emit counts. Adds reports/element-framing/RE-145-current-copy-routing.md with Measure-run tables across Core Interior, Einhoven, RE1 models, and Autodesk samples.

Findings recorded in CHANGELOG: for differing copies, routing picks the latest partition’s copy on 1,518 / 1,522 ids (including 887/887 on 2021 rac_advanced); a smaller set routes to partitions with no copy for that element (16 on Einhoven/Core Interior in the report), which the changelog notes was addressed separately in #565.

Reviewed by Cursor Bugbot for commit 9189130. Configure here.

…element's current record (#548)

Routes every declared element as native_document does
(native_index::route_episode from its stored revision) and compares the
partition with the ones that hold its channel-101 records: single copies
routed to a partition without a record of theirs, and for repeated ids
whether the route takes the latest or earliest partition's copy. On the
admitted releases it also runs native_document::extract on channel 101.
…holds none of their records (#548)

Adds every element, single or repeated, that native_index::route_episode
sends to a partition without a channel-101 record of it, with its class,
partitions and stored revision; and the indexed elements with a record
that native_document::extract does not emit. The first run (37116666890)
found 5 such single copies on Einhoven and 10 elements extract does not
emit on Core Interior.
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 3, 2026 11:03

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Example arrays are invalid JSON
    • Added json_u32_array to serialize partition lists as JSON arrays instead of BTreeSet Debug output in both example fields.

Create PR

Or push these changes by commenting:

@cursor push f42cd718d9
Preview (f42cd718d9)
diff --git a/examples/probe_re145_current_copy_routing.rs b/examples/probe_re145_current_copy_routing.rs
--- a/examples/probe_re145_current_copy_routing.rs
+++ b/examples/probe_re145_current_copy_routing.rs
@@ -82,6 +82,11 @@
     format!("{{{}}}", parts.join(","))
 }
 
+fn json_u32_array(set: &BTreeSet<u32>) -> String {
+    let parts: Vec<String> = set.iter().map(|k| k.to_string()).collect();
+    format!("[{}]", parts.join(","))
+}
+
 fn probe(path: &str) -> anyhow::Result<String> {
     let file = std::path::Path::new(path)
         .file_name()
@@ -164,9 +169,10 @@
             routed_without_copy += 1;
             if without_copy.len() < EXAMPLES {
                 without_copy.push(format!(
-                    "{{\"id\":{id},\"class\":{},\"partitions\":{partitions:?},\"routed\":{routed},\
+                    "{{\"id\":{id},\"class\":{},\"partitions\":{},\"routed\":{routed},\
                      \"stored_revision\":{},\"identical\":{}}}",
                     class_of(&list[0].body),
+                    json_u32_array(&partitions),
                     identity.stored_revision,
                     list.iter().all(|c| c.body == list[0].body)
                 ));
@@ -216,8 +222,9 @@
                         let list = &copies[id];
                         let partitions: BTreeSet<u32> = list.iter().map(|c| c.partition).collect();
                         format!(
-                            "{{\"id\":{id},\"class\":{},\"partitions\":{partitions:?}}}",
-                            class_of(&list[0].body)
+                            "{{\"id\":{id},\"class\":{},\"partitions\":{}}}",
+                            class_of(&list[0].body),
+                            json_u32_array(&partitions)
                         )
                     })
                     .collect();

You can send follow-ups to the cloud agent here.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 9189130. Configure here.

…nd skips Measure's flags

Reported by Cursor Bugbot on #569: the example lists embedded a BTreeSet's
Debug form ({0, 3}), which is not JSON. The probe also opened Measure's
trailing --records flag as a file.
DrunkOnJava added a commit that referenced this pull request Oct 3, 2026
…counts as JSON

The blocks-by-id-minus-one map was a BTreeMap's Debug form ({1: 46}) and a
counterexample's stated count an Option's (Some(n)); both are JSON now,
as the probe's one-object-per-line contract says (the same defect Cursor
Bugbot found in RE-145's probe on #569).
@DrunkOnJava
DrunkOnJava merged commit dac3850 into main Oct 3, 2026
22 checks passed
@DrunkOnJava
DrunkOnJava deleted the re/re145-current-copy-report branch October 3, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant