Attribute markdown and ask events to their space - #4501
Open
nolannbiron wants to merge 2 commits into
Open
Conversation
`page_markdown_request` and the `ask_question` the middleware emits for `?ask=` carried only a displayContext, so they were stored with an empty spaceId and an unparseable siteSpaceId. Any space- or section-scoped query dropped them, and the markdown traffic of a space read as zero. Reuse the location the middleware already builds, as `rss_request` does. The llms branches keep theirs: llms.txt spans every section and site-space, so a single spaceId would attribute a site-wide document to one of them. `ask_question` also gains the goal, which was parsed off the query string to be encoded in the rewrite and then dropped from the event. The pageId the TODO asked for is not in the URL, and resolving it in the middleware costs a request per document served; it is left to the API to return alongside the space.
nolannbiron
had a problem deploying
to
2v-preview
August 14, 2026 12:38 — with
GitHub Actions
Failure
🦋 Changeset detectedLatest commit: 1cfc0c1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Summary of the deployments:
Test content |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
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.
page_markdown_requestand theask_questionthe middleware emits for?ask=carried only adisplayContext, so they were stored with an emptyspaceIdand an unparseablesiteSpaceId. Any space- or section-scoped query dropped them, and the markdown traffic of a space read as zero.They now reuse the
eventLocationthe middleware already builds from the URL resolution — the onerss_requesthas used since #4242 — carryingspace,siteSpace,siteSection,siteShareKeyandrevision.The two
llms_requestbranches deliberately keep their own location.llms.txtandllms-full.txtwalk every section and site-space of the site, so stamping the singlespacethe URL resolved to would attribute a site-wide document to one of them.ask_questionalso gains thegoal. It was already parsed off the query string to be encoded into the rewrite target, but never put on the event, soeventAskGoalwas always empty.pageId
The TODO also asked for
pageId. It is not derivable from the URL —PublishedSiteContenthas nopage— and the only path→page endpoints return a full page object. Resolving it in the middleware costs one extra API call per document served, on routes that are otherwise fully cache-served, and it has to complete before the tracking call can be sent — which on Vercel puts a network round-trip in front of awaitUntilthat has no lifecycle-extension primitive today.It belongs on
resolvePublishedContentByUrl, which the middleware already calls on every request. Follow-up in gitbook-x.