Skip to content

fix(runtime): align parse-rf2-coord with rf2-z7f7's emitted format - #1

Merged
mike-thompson-day8 merged 1 commit into
mainfrom
rf2-7g2q-source-coord-parser
May 10, 2026
Merged

mike-thompson-day8 merged 1 commit into
mainfrom
rf2-7g2q-source-coord-parser

Conversation

@mike-thompson-day8

Copy link
Copy Markdown
Contributor

Summary

re-frame2's rf2-z7f7 (PR #135 in day8/re-frame2) shipped the data-rf2-source-coord DOM annotation. The actual emitted format is <ns>:<handler-id>:<line>:<col> (4 colon-separated segments), with ? legal for line/col on programmatic reg-view* calls.

re-frame-pair2's parse-rf2-coord was written speculatively before rf2-z7f7 landed and assumed <ns>|<file>:<line>:<col> (per STATUS.md known-unknown #3). This fix aligns the parser with the canonical format.

Tracked under bead rf2-7g2q (in re-frame2's bd) as discovered-from rf2-9ra3.

Changes

  • scripts/runtime.cljs — parse-rf2-coord updated to handle the 4-segment format and degraded ? cases.
  • tests/runtime/parse_rf2_coord_test.clj — new, 12 tests / 21 assertions.
  • STATUS.md — known-unknown #3 fully resolved with citations.
  • docs/TESTING.md — struck failing-point + updated "not tested yet" list.

Format citations

  • spec/006-ReactiveSubstrate.md §Attribute value format (L274–287)
  • spec/Tool-Pair.md §Source-mapping (L414, L417)
  • Emitters: implementation/core/src/re_frame/views.cljs L210–224, ssr.cljc L137–151
  • Tests: implementation/reagent/test/re_frame/source_coord_dom_cljs_test.cljs, ssr_source_coord_test.clj

Test results

bb tests/runtime/parse_rf2_coord_test.clj — 12 tests, 21 assertions, 0 failures.

Coverage: canonical PR #135 sample, Form-1, Form-2 inner, SSR, programmatic ?:? degradation, partial :line:?, malformed (too few/too many segments, empty <ns> or <handler-id>), non-string inputs, dotted+hyphenated ids, parse→format→parse round-trip.

Edge case worth flagging

Fragment / :> interop / fn-component fallback emits no attribute at all (substrate skips with one-shot warning per Spec 006 §Documented exemption). Parser never sees these — consumers fall back to (rf/handler-meta :view id).

Side effect

dom-find-by-src and dom-fire-click had a file parameter that was wrong post-fix (segment 1 is handler-id, not file). Renamed to file-or-id; substring-match impl unchanged. Real cross-attribute querying may want a redesign — out of scope here.

The speculatively-written parser assumed `<ns>|<file>:<line>:<col>`.
re-frame2's rf2-z7f7 ships `<ns>:<handler-id>:<line>:<col>` (4
colon-separated segments, per Spec 006 §Source-coord annotation and
Tool-Pair.md §Source-mapping; verified against the SSR + Reagent
emitters and their tests). Updated parser to return
`{:ns :handler-id :line :col}`, with `:line`/`:col` nil when the
segment is `?` (programmatic registrations that bypassed the macro
path).

Refs rf2-7g2q. Closes STATUS.md known-unknown #3.
@mike-thompson-day8
mike-thompson-day8 merged commit 983c194 into main May 10, 2026
1 check passed
@mike-thompson-day8
mike-thompson-day8 deleted the rf2-7g2q-source-coord-parser branch May 10, 2026 05:09
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