{"id":391,"date":"2025-08-06T18:03:07","date_gmt":"2025-08-07T01:03:07","guid":{"rendered":"https:\/\/blog.mozilla.org\/sfink\/?p=391"},"modified":"2025-08-06T18:03:07","modified_gmt":"2025-08-07T01:03:07","slug":"jj-and-rr-leveraging-history","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/sfink\/2025\/08\/06\/jj-and-rr-leveraging-history\/","title":{"rendered":"Brief love note to jj and rr: leveraging history"},"content":{"rendered":"\r\nLast week, I went on vacation.<br \/><br \/>\r\n\r\nThat is not the point.<br \/><br \/>\r\n\r\nCloser to the point is that I returned to work this week, and resumed working on tracking down a bug that I had been looking at just before going on vacation. I knew I had captured the bug in my latest <a href='https:\/\/rr-project.org\/'>rr<\/a> recording, but I had moved off to other things since making that recording and so my source checkout no longer matched what my debugged binary was built from.<br \/><br \/>\r\n\r\nrr doesn&#8217;t really care, so it let me replay the recording. I had all my old log messages, tied to the exact point in time they corresponded to. (I get that from my <a href='https:\/\/github.com\/hotsphink\/sfink-tools'>.gdbinit setup<\/a>, but that&#8217;s not all that relevant here.) So I could jump to the points in time that I cared about. But gdb showed me the wrong source, so I found myself staring at a blank line just after a comment, and I&#8217;m pretty sure my problem does not originate from a blank line after a comment.<br \/><br \/>\r\n\r\nSo what to do? I wanted to find what version of the source code I had checked out. If I were working on Firefox, it would have burned a build ID into the binary. But I wasn&#8217;t.<br \/><br \/>\r\n\r\nLong story short, <a href='https:\/\/github.com\/jj-vcs\/jj\/blob\/main\/docs\/operation-log.md'>jj&#8217;s operation log<\/a> came to my rescue here. First, I looked at my recording&#8217;s timestamp: `<code>ls -ltr ~\/.rr\/latest-trace\/<\/code>`. (Yours might be in `<code>~\/.local\/share\/rr<\/code>` or somewhere. Actually, mine are too, I just have a symlink.) Each entry is associated with a time range, and presumably I had the correct version checked out when I made the recording.<br \/><br \/>\r\n\r\nI scanned through the operations log to find the operation ID from that moment in time: `<code>jj op log -T 'id.short(8) ++ \" \" ++ time ++ \" \" ++ description ++ \"\\n\"'<\/code>`. That gave me operation ID `<code>55731d73<\/code>`.<br \/><br \/>\r\n\r\nI have two workspaces, and I can&#8217;t even remember which one I was using at the time, so I displayed my working copy for both: `<code>jj log -r 'at_operation(55731d73, working_copies())'<\/code>`. That gave me two git commit hashes, `<code>3c79c068<\/code>` and `<code>a1a9d12b<\/code>`.<br \/><br \/>\r\n\r\nWith my rr replay session running, I tried `<code>jj edit 3c79c068<\/code>` and checked where I was. Nope, still floating in whitespace. (Note that I am talking about code here, not my racial background. Leave me alone.) But `<code>jj edit a1a9d12b<\/code>` did the trick! My checkpoints were in actual code! That I wrote! Incorrectly!<br \/><br \/>\r\n\r\nAnyway, nothing earth-shattering here. But it made me happy. And perhaps it will be useful to other people with a need for resurrecting their forgotten past.<br \/>\r\n","protected":false},"excerpt":{"rendered":"<p>Last week, I went on vacation. That is not the point. Closer to the point is that I returned to work this week, and resumed working on tracking down a bug that I had been looking at just before going on vacation. I knew I had captured the bug in my latest rr recording, but [&hellip;]<\/p>\n","protected":false},"author":206,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/sfink\/wp-json\/wp\/v2\/posts\/391"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/sfink\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/sfink\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/sfink\/wp-json\/wp\/v2\/users\/206"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/sfink\/wp-json\/wp\/v2\/comments?post=391"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/sfink\/wp-json\/wp\/v2\/posts\/391\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/sfink\/wp-json\/wp\/v2\/media?parent=391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/sfink\/wp-json\/wp\/v2\/categories?post=391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/sfink\/wp-json\/wp\/v2\/tags?post=391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}