mirror of
https://github.com/block/buzz.git
synced 2026-10-27 20:41:57 +00:00
Follow-up to [#8294](https://github.com/block/buzz/pull/8294). Malformed trailing thread tags could make a notification open the right thread while Flutter indexed its reply elsewhere; uppercase references could similarly miss lowercase event IDs. Share one validated thread-reference parser between the mobile timeline, Inbox, and feed helper. It ignores malformed markers, keeps the last valid root/reply, and normalizes lookup IDs to lowercase. Native push parsing now uses the same casing. Existing thread fixtures use valid event IDs so they continue exercising real thread relationships. Add RunnerTests coverage for the production native-to-Flutter argument conversion, including buffered cold-start navigation and omitted optional thread IDs, and run it in the native CI lane. ### Validation - New parser and Inbox regressions cover malformed markers and uppercase references. Widget regressions open and highlight the exact reply for valid, uppercase, and trailing-malformed tags. - After integrating [#8106](https://github.com/block/buzz/pull/8106), Flutter analysis and the complete mobile suite pass: 3,337 tests, four existing skips. Integration preserves per-event read predicates and migrates incoming thread fixtures to valid IDs. An unchanged keyboard-history test also failed with main's original parser; recording reads before the scroll transition fixes its timing assumption while retaining visibility assertions. - Native package tests passed (127 tests), and both Runner bridge tests passed on an iOS simulator with Xcode 26.5. Removing the production `threadRootId` assignment made the bridge regression fail; restoring it passed. Native code is unchanged by the main integration. - [Current-head CI passed](https://github.com/block/buzz/actions/runs/38659307247), including Mobile and Mobile Swift. [Codex review](https://github.com/block/buzz/pull/8332#issuecomment-6181458528) and [security review](https://github.com/block/buzz/pull/8332#issuecomment-6181449235) found no issues on the integrated commit. [Owner approval](https://github.com/block/buzz/pull/8332#pullrequestreview-5526812957) covers the exact integrated commit. - Standards and spec reviews found no blockers, including the merge resolutions and test adjustments. Validation is scoped to mobile/native per VISION_MOBILE; unrelated repository-wide checks were stopped, not counted as passing. The bridge test covers serialization and buffering, not end-to-end APNs delivery or app launch. No new physical-device acceptance is claimed; routine post-merge dogfood remains human-owned. --------- Signed-off-by: Tom Brow <tomb@block.xyz>
23 lines
857 B
Dart
23 lines
857 B
Dart
/// Resolve NIP-10 markers using relay ingest validity and ordering rules.
|
|
///
|
|
/// The last valid 64-character ASCII-hex marker wins. IDs are lowercased for
|
|
/// client lookup. Root-only events remain top-level; a reply without a valid
|
|
/// root uses its parent as root.
|
|
({String? parentId, String? rootId}) parseThreadReference(
|
|
List<List<String>> tags,
|
|
) {
|
|
String? parentId;
|
|
String? rootId;
|
|
for (final tag in tags) {
|
|
if (tag.length < 4 || tag[0] != 'e') continue;
|
|
final id = tag[1];
|
|
if (id.length != 64 || !_threadEventId.hasMatch(id)) continue;
|
|
if (tag[3] == 'reply') parentId = id.toLowerCase();
|
|
if (tag[3] == 'root') rootId = id.toLowerCase();
|
|
}
|
|
if (parentId == null) return (parentId: null, rootId: null);
|
|
return (parentId: parentId, rootId: rootId ?? parentId);
|
|
}
|
|
|
|
final _threadEventId = RegExp(r'^[0-9a-fA-F]{64}$');
|