Repository navigation
feat(search): report embedding token usage instead of discarding it - #32552
Conversation
Code Review ✅ ApprovedAdds optional OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
✅ Playwright Results — workflow succeededValidated commit ✅ 944 passed · ❌ 0 failed · 🟡 3 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 1h 18m 21s ⏱️ Max setup 5m 3s · max shard execution 17m 7s · max shard-job elapsed before upload 20m 42s · reporting 6s 🌐 206.87 requests/attempt · 2.39 app boots/UI scenario · 36.81% common-shard skew Optimization targets still in progress:
🟡 3 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…32342) (#32987) * Fix MCP entity patch lifecycle handling (#32226) * fix(mcp): respect entity patch lifecycles * fix(mcp): protect task patch lifecycle * gitarbot feedback: block document, metric, metricGroup patch lifecycles too * reflow lifecycle comment so no entry wraps at the 100-col limit * drop metric and metricGroup entries, reverted upstream by #32333 (cherry picked from commit ac4a26b) * feat(search): report embedding token usage instead of discarding it (#32552) * feat(search): report embedding token usage instead of discarding it * fix(search): report the text the provider received, not the caller's input (cherry picked from commit 2209bd7) * Fixes 30023: apply the caller's policies to bot searches (#32460) * fix(search): apply the caller's policies to bot searches (#30023) * test: poll for the widened bot's own view in the allow-only role IT * test: probe search RBAC on the asset index, not the domain index * test: prove bot search scoping with a deny rule, not domains * gitarbot feedback: include team ids in the RBAC query cache key (cherry picked from commit dda6a92) * fix(search): embed ElasticSearch semantic search queries as queries, not documents (#32553) (cherry picked from commit ce2a1c1) * fix(ingestion): use HTTP transport for MCP connector (#32342) * fix(ingestion): use HTTP transport for MCP connector * Update generated TypeScript types and dereferenced schemas * chore: prune obsolete G004 baseline entries * fix(ingestion): complete MCP HTTP transport support * style(ingestion): format MCP transport client --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> (cherry picked from commit c45f71a) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* feat(data-insights): capture completeness evidence and extend run lifecycle * feat(search): report embedding token usage instead of discarding it (#32552) * feat(search): report embedding token usage instead of discarding it * fix(search): report the text the provider received, not the caller's input (cherry picked from commit 2209bd7) * Restrict cross-user follower changes (#32322) * fix(security): restrict cross-user follower changes * fix(security): validate follower user IDs * fix(cache): bypass read-bundle cache for uncached entities buildReadBundle used the read-bundle cache for every non-deleted read, ignoring UNCACHED_ENTITY_TYPES (user, task, workflow*, bot, domain, dataProduct). For those types a mutation followed by an immediate re-read — e.g. the follower add/delete then fetch in this PR's DataProductResourceIT — could serve a stale cached bundle. Without this, the follower authorization tests fail under a cache-enabled deployment (postgres-elasticsearch-redis / postgres-opensearch integration lanes) with `expected <false> but was <true>` after a delete. Gate the read-bundle cache on isCacheableEntityType(entityType) so uncached types take the already-supported bundleCache == null path and always reflect the current entity_relationship state. Required for the follower tests to pass on the Redis/OpenSearch lanes (documents why this caching change is part of the security fix, per reviewer request). * test(followers): rename put_-prefixed delete-follower tests to delete_ prefix The two round-trip tests exercise the DELETE follower endpoint (add is setup), so name them with the delete_ verb prefix to match the method-name convention (addresses the Copilot review comment). --------- Co-authored-by: sonika-shah <[email protected]> (cherry picked from commit 2fb1cb5) * Fixes #32600: include samples in AI context (#32608) * feat(api): add samples to AI context Limit structured table context to 10 permission-filtered rows so SQL agents can inspect value shape without a warehouse discovery query. * fix(api): resolve sample-data authz with owners loaded The AI context sample-data check wrapped an already-loaded table in a pre-resolved ResourceContext. That constructor never runs resolveEntity(), so owners and domains stayed absent (TABLE_FIELDS does not request them) and every owner- or domain-conditioned rule misfired in both directions: an owner-conditioned Deny failed open, and authorizePII() saw null owners so a table's own owner had their sample data masked. Resolve by id instead, which loads authorizationFields(), matching what TableResource's GET /tables/{id}/sampleData already does. The existing IT used an unconditioned Deny, which passes whether or not owners are loaded. Add an owner-conditioned Deny case that first asserts the real endpoint returns 403, then asserts the AI context endpoint agrees. Verified: it returns 10 sample rows before the fix, none after. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]> (cherry picked from commit 8298911) * fix(search): resolve DI indexes with the cluster data stream prefix * fix(ui): keep autocomplete responses with their own requests --------- Co-authored-by: Sriharsha Chintalapani <[email protected]> Co-authored-by: Vishnu Jain <[email protected]> Co-authored-by: Sriharsha Chintalapani <[email protected]> Co-authored-by: sonika-shah <[email protected]> Co-authored-by: Pere Miquel Brull <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Closes #32489
Bedrock Titan returns
inputTextTokenCountand OpenAI returnsusage.prompt_tokens. We read the vector out of the response and throw the rest away, so nothing downstream can tell how many tokens embeddings used.What this adds
UsageListeneronEmbeddingClient, called after each successful embedding.doEmbedWithUsage(text, query)hook that defaults to the current behaviour.Notes
doEmbedis unaffected, andGoogleEmbeddingClient/DjlEmbeddingClientneed no changes.Tests
119 pass. Two of them were checked by breaking the code first: one fails if the
doEmbedQuerydispatch is collapsed, one fails if the listener moves back inside the concurrency permit.