Avoid nesting in event processor, do not add coupling#782
Merged
SHAcollision merged 1 commit intopubky:feat/universal-tags-app-specific-pathsfrom Apr 3, 2026
Conversation
5 tasks
Ari4ka
approved these changes
Apr 3, 2026
SHAcollision
added a commit
that referenced
this pull request
Apr 11, 2026
* feat: universal tags with app-specific paths * Add TODO for future query batching * chore: remove empty wrapper put_index_sorted_set_static * chore: remove superfluous stream conversions * chore: remove empty wrapper put_score_index_sorted_set_static * Avoid nesting in event processor, do not add coupling (#782) * PR fixes * fix clippy * infinite loop fix * fixes * fix: use new traced_join! to integrate tracing into tag::put_sync_resource * chore: add URI length validation in raw URI lookup API * chore: removed unused fields in try_handle_universal_tag * chore: extract, re-use ResourceDetails::get_by_id(resource_id) * chore: use `Option<&[String]>` as tags type to simplify type conversions * chore: simplify build_index_key return type to minimize type conversions --------- Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
aintnostressin
pushed a commit
that referenced
this pull request
Apr 20, 2026
* feat: universal tags with app-specific paths * Add TODO for future query batching * chore: remove empty wrapper put_index_sorted_set_static * chore: remove superfluous stream conversions * chore: remove empty wrapper put_score_index_sorted_set_static * Avoid nesting in event processor, do not add coupling (#782) * PR fixes * fix clippy * infinite loop fix * fixes * fix: use new traced_join! to integrate tracing into tag::put_sync_resource * chore: add URI length validation in raw URI lookup API * chore: removed unused fields in try_handle_universal_tag * chore: extract, re-use ResourceDetails::get_by_id(resource_id) * chore: use `Option<&[String]>` as tags type to simplify type conversions * chore: simplify build_index_key return type to minimize type conversions --------- Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
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.
This PR proposes a way to address this review thread: #777 (comment) . This is a proposed change to #777 , so it points to that PR's branch.
More specifically, it avoids introducing (7-layer) nesting in the main event processor logic, while also avoiding the coupling counter-argument raised in the same thread.
AI detailed description below
The counter-argument rests on a false dilemma: that incorporating logic into
Event::parse_eventnecessarily means teachingnexus-commonabout app-specific paths. It doesn't.The root cause of the nesting is that
Event::parse_event(nexus-common/src/models/event/mod.rs:70-72) treats aParsedUri::try_fromfailure asInvalidEventLine:But
pubky://user/pub/mapky/tags/123is not an invalid event line — it's a valid event thatpubky-app-specsdoesn't recognize. By conflating "unrecognized path" with "invalid line,"parse_eventthrows away the already-parsedevent_typeanduri, forcing the universal tag handler to re-parse the raw line from scratch viaparse_event_line(which duplicates the split + event type validation).The fix: Give
parse_eventa richer return type that distinguishes "parsed," "skipped," and "unrecognized URI":nexus-commongains zero knowledge of universal tags or app-specific paths.What this achieves:
parse_event_lineis eliminated — no more duplicated line splittingnexus-commonstays free of app-specific logictry_parse_app_tag_path,handle_put,handle_del) stays unchanged innexus-watcherhandle_eventpattern