Include ref.parent matches in events by-reference navigation#2280
ref.parent matches in events by-reference navigation#2280Conversation
|
|
ref.parent matches in events by-reference navigation
Co-authored-by: niemyjski <1020579+niemyjski@users.noreply.github.com>
e666187 to
8f5e641
Compare
# Conflicts: # src/Exceptionless.Web/Controllers/EventController.cs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae3cc52eb3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f152edde5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 775c14f17c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f0dd46364
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| return `reference:${quoteIfSpecialCharacters(this.value)}`; | ||
| const reference = quoteIfSpecialCharacters(this.value); | ||
| return `(reference:${reference} OR ref.parent:${reference})`; |
There was a problem hiding this comment.
Keep parent reference filters free in the Svelte guard
When this filter is used on the events route, (app)/+layout.svelte calls filterUsesPremiumFeatures() on the filter query string, and premium-filter.ts still treats any ref.parent field as premium because its free-field list only contains reference/reference_id. For free-plan organizations, clicking a Reference filter or the by-ref page's “View In Events” link now shows the premium-upgrade notification even though the backend validator intentionally made parent-reference lookup free; the client free-field list needs the same ref.parent allowance.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a507d669da
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!name.IsValidFieldName()) | ||
| throw new ArgumentException("Name must contain between 1 and 25 alphanumeric or '-' characters.", nameof(name)); |
There was a problem hiding this comment.
Keep SetEventReference backward compatible
When an existing caller uses a custom reference name that was previously accepted, such as order_id or a name longer than 25 characters, this new guard now throws instead of storing @ref:<name>. SetEventReference is public, and the indexing/query paths already skip names they cannot safely index, so rejecting those names at the write boundary introduces an unapproved behavioral break; preserve storage compatibility or explicitly version the API change. This is a review BLOCKER under the repository guidance.
AGENTS.md reference: AGENTS.md:L67-L67
Useful? React with 👍 / 👎.
| { | ||
| string referenceKey = $"@ref:{Event.KnownReferenceNames.Parent}"; | ||
| string indexKey = $"{Event.KnownReferenceNames.Parent}-r"; | ||
| string script = $"if (ctx._source.data != null && ctx._source.data.containsKey('{referenceKey}') && ctx._source.data['{referenceKey}'] != null) {{ if (ctx._source.idx == null) ctx._source.idx = [:]; ctx._source.idx['{indexKey}'] = ctx._source.data['{referenceKey}']; }} else {{ ctx.op = 'noop'; }}"; |
There was a problem hiding this comment.
Normalize legacy parent values before backfilling
When a retained event contains a non-string data["@ref:parent"] value—which raw legacy DataDictionary records permit—this script assigns the map, list, or other value directly to the idx.parent-r keyword field rather than applying the string normalization used by CopyDataToIndex. Elasticsearch can reject that update with a mapping failure, and the later completion branch does not inspect the task's embedded failures, allowing migration version 3 to be recorded as complete while some valid records remain unbackfilled; filter or normalize legacy values and fail/retry when the task reports failures.
AGENTS.md reference: AGENTS.md:L72-L75
Useful? React with 👍 / 👎.
/events/by-ref/{referenceId}only matchedreference:{id}, so child events that stored their relationship inref.parentcould not be reached through Parent navigation.Root cause
referencefield.ref.parentto the query initially made the route premium-only because dynamic reference fields were classified as premium.idx.parent-reven though test fixtures did.Changes
reference:{id}orref.parent:{id}in organization- and project-scoped handlers and frontend navigation.@ref:parentfor free-plan events; arbitrary custom data remains unindexed.idx.parent-rvalues for retained events without overwriting existing indexes.ref.<name>query fields.ref.<name>and suppress unsafe/invalid filter controls.origin/maininto the PR branch.Verification
dotnet build tests/Exceptionless.Tests/Exceptionless.Tests.csproj --no-restore --disable-build-servers -m:1— 0 warnings, 0 errors.StringExtensionsTests— 43 passed.PersistentEventQueryValidatorTests— 70 passed.EventPipelineTests— 60 passed, 1 intentional skip.EventEndpointTests— 104 passed.BackfillParentReferencesMigrationTests— passed against Elasticsearch.npm run validate— passed (Prettier, ESLint, and Svelte check with 0 errors/warnings).dotnet format --verify-no-changes— passed.Compatibility and scope
identifierroute constraint and event validation to 8–100 letters, digits, or hyphens.idx.parent-rsearch field; arbitrary dynamic reference fields remain premium-only.