5.6 KiB
5.6 KiB
Search Self-Serve Contract
Purpose
- Define the page-owned contract for answer-first search.
- Ensure every high-value page can expose common operator questions and clarifying prompts without editing
GlobalSearchComponent. - Keep the self-serve experience deterministic, evidence-first, and testable.
Rule (mandatory for page teams)
- Every page that wants answer-first self-serve behavior must declare
selfServemetadata inSEARCH_CONTEXT_DEFINITIONS. - Page components should continue to implement
SearchContextComponentso ownership remains explicit. selfServedefinitions must provide one or both of:commonQuestions[]clarifyingQuestions[]
- Question entries must provide:
key/fallbackfor the executable question text- optional
kind(page,clarify,recent)
- Question arrays must stay deterministic and bounded:
- at most 3 base common questions per page
- at most 2 base clarifying questions per page
- concise, operator-facing wording
- no tenant secrets or volatile IDs in fallback copy
Priority rollout ownership
| Context ID | Route family | Page ownership rule | Verification floor |
|---|---|---|---|
findings |
/security/triage, /security/findings |
Security triage pages own the findings questions and clarifiers. | Mocked Playwright journey + shared search regressions |
policy |
/ops/policy |
Policy workspace owns the questions and recovery prompts for rules, gates, and exceptions. | Mocked Playwright journey + shared search regressions |
doctor |
/ops/operations/doctor, /ops/operations/system-health |
Doctor pages own the health-check questions and release-readiness follow-ups. | Mocked Playwright journey + live Doctor route pack |
timeline |
/ops/timeline, /audit, /evidence/audit-log |
Timeline/Audit pages own time-window clarifiers and causal follow-ups. | Mocked Playwright journey |
releases |
/releases, /mission-control |
Release-control pages own approval/blocker/next-step questions. | Mocked Playwright journey |
Page team checklist
- Add or update the route entry in
SEARCH_CONTEXT_DEFINITIONS. - Define bounded
commonQuestions[]andclarifyingQuestions[]. - Keep copy operator-facing; do not expose Stella internals or scoring jargon.
- Verify the page still works with telemetry disabled or OTLP unset.
- Add/update unit coverage for route-specific questions and a Playwright journey for the page family.
Answer-first UX contract
- Every non-empty search must render one visible answer state before raw results:
groundedclarifyinsufficient
groundedstates must expose visible evidence summary plus citations or top-result references.clarifystates must offer narrowing guidance instead of a blank panel.insufficientstates must explain the lack of grounding and still provide credible next questions or next searches.
Runtime behavior
- Empty-state search uses
commonQuestions[]for page-owned "Common questions". - A recent-action question may be prepended from the latest meaningful page action:
- opened/used result -> why-it-matters question
- search/chat expansion -> what-to-verify-next question
- fallback -> related follow-up question
- Result-state answer panels use:
commonQuestions[]as follow-up questions when grounded evidence existsclarifyingQuestions[]as non-executable narrowing guidance when no grounded answer exists
- "Related searches" remains driven by contextual chip logic so pages do not need to define a second parallel action system.
Optional telemetry hooks
- Search may emit optional client-side telemetry markers for backlog triage:
search_self_serve_gapsearch_self_serve_reformulationsearch_self_serve_recoverysearch_self_serve_suggestion_suppressed
- These markers are additive only. If telemetry is disabled or the sink is unavailable, search behavior, history, and assistant handoffs must remain unchanged.
- Marker payloads must avoid raw query text. Use route, answer state, counts, and reformulation depth instead.
Gap review workflow
- Review repeated
search_self_serve_gapandsearch_self_serve_reformulationevents by route family. - Compare them with visible no-result/clarify journeys from Playwright and operator feedback.
- Update the page-owned question set or starter chips for the affected route.
- Add or tighten a Playwright journey before marking the gap closed.
- Record the adjustment in the active sprint
Execution Logso the change is traceable.
Source of truth
- Page registry and interfaces:
src/Web/StellaOps.Web/src/app/core/services/search-context.registry.ts
- Runtime composition:
src/Web/StellaOps.Web/src/app/core/services/ambient-context.service.ts
- Search surface:
src/Web/StellaOps.Web/src/app/layout/global-search/global-search.component.ts
Testing requirements
- Add unit coverage for route-specific questions in
ambient-context.service.spec.ts. - Add unit coverage for answer-state rendering in
global-search.component.spec.ts. - Add Playwright coverage for:
- grounded answer
- clarify guidance rendering
- answer-to-AdvisoryAI handoff
- priority-route rollout journeys (
findings,policy,doctor,timeline,releases)
- Keep route and API behavior mocked/deterministic; no live network dependencies.
Relationship to chip contract
search-chip-context-contract.mdstill governs contextual chips and route-suggestion behavior.- This document governs answer-first questions and fallback states.
- Page teams adding self-serve behavior usually need to update both contracts together.