Skip to content

feat: add Astra metrics card schema - #482

Merged
thomasluizon merged 3 commits into
mainfrom
feature/ticket-333-metrics-block
Aug 23, 2026
Merged

thomasluizon merged 3 commits into
mainfrom
feature/ticket-333-metrics-block

Conversation

@thomasluizon

@thomasluizon thomasluizon commented Aug 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • append the nullable metrics card response and client capability contracts
  • build one current-week overview through the free and ungated GetRecapQuery path
  • strip metrics directives for unsupported clients and across split SSE delta chunks
  • expose the progress surface id without carrying a client route
  • emit chat_metrics_card_emitted with platform and chip presence
  • document ChatResponse and MetricsCard in the generated OpenAPI contract

Tracks https://github.com/thomasluizon/orbit-tickets/issues/333

Assumptions

  • Interpreted the API related-surfaces map as AgentCatalogService.Surfaces; rejected editing the UI related-surfaces.ts because the work order forbids touching a second repository and assigns that consumer change its own ticket.
  • Interpreted OpenAPI regeneration as requiring the buffered chat 200 response to be typed as ChatResponse; rejected leaving status-only documentation because it cannot expose metricsCard.

Streaming behavior

The metrics directive is buffered only while a chunk could still be its prefix, then removed case-insensitively even when split across chunks. The final event carries the completed metrics card. The older habit directive still streams raw today; that existing issue is outside #333.

Verification

  • dotnet build Orbit.slnx --no-restore: 0 errors
  • dotnet test --no-restore: 5,761 passed
  • focused application tests: 76 passed
  • focused infrastructure tests: 22 passed
  • chat controller tests after typed OpenAPI annotation: 9 passed
  • architecture.json and architecture.html regenerated with node tools/arch-map.mjs
  • src/Orbit.Api/openapi.json regenerated by the API build
  • git grep for a quoted /progress route under src returned no matches
  • dash guard passed for every changed file

@thomasluizon

Copy link
Copy Markdown
Owner Author

I will append the two nullable contract fields, add a MetricsCardBuilder beside the existing habit and goal card builders, and integrate it into ProcessUserChatCommand after directive extraction. The builder will use GetRecapQuery for the authenticated user's current local week, because that path is already free and ungated; I will not use the pay gated gamification overview tool or accept a model supplied user or route. I will extend related surfaces with the progress surface id, add the server emission metric, preserve other cards in the same response, and make metrics calculation failure keep the prose while omitting the card. Tests will cover support absent and false, repeated and inline directives, combined cards, zero data, FAQ cache exclusion, free access, and the SSE token behavior. Generated OpenAPI and architecture artifacts will be refreshed after the focused tests pass.

Expected files are the chat command partials and card model, AgentContracts, the related surfaces definition, focused application and API tests, plus openapi.json and architecture.json. This keeps the feature in the existing card pipeline and rejects a new read endpoint, a client route in the API, per habit drill in, and mutual exclusion between cards.

pullfrog[bot]
pullfrog Bot previously approved these changes Aug 22, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes Reviewed the empty planning scaffold at cb94a66; no implementation exists yet.

  • Branch initialization: The sole commit introduces zero file changes, so there is no runtime, contract, or test surface to assess.

Pullfrog  | View workflow run | Using GPT Sol | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The metrics failure path must be fixed before merging because it returns a successful but incomplete response for the exact request this feature handles.

Reviewed changes Reviewed the two implementation commits added after the prior Pullfrog review at cb94a66.

  • Metrics contract: Appended a nullable metrics card response and optional client capability, with API-first gating checked against the current mobile and web consumer.
  • Card construction: Added a current-week overview using the user's local date, week-start preference, and the existing recap query.
  • Streaming behavior: Added case-insensitive filtering for complete and split metrics directives before SSE deltas reach the client.
  • Observability and schema: Added card-emission properties, progress-surface metadata, and generated ChatResponse OpenAPI exposure.
  • Tests: Added coverage for capability mapping, directive extraction, card mapping, split SSE chunks, prompt selection, analytics, and card-build failures.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏

Comment thread src/Orbit.Application/Chat/Commands/ProcessUserChatCommand.cs
@thomasluizon

Copy link
Copy Markdown
Owner Author

@pullfrog The blocking finding conflicts with #333's explicit edge-case requirement: "The metrics computation throwing must not fail the turn: fall back to no card and keep the prose." The current failure test pins exactly that required behavior. Returning a failed ChatResponse would violate the ticket; synthesizing metrics would bypass the required GetRecapQuery source; and inventing fallback copy is a product/copy decision the work order forbids this worker from guessing. Please reconsider discussion_r3837316942 against the ticket's stated failure contract.

@sonarqubecloud

Copy link
Copy Markdown

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

The earlier metrics failure-path finding is withdrawn because the successful response with preserved prose and no card is the ticket's explicit failure contract.

Pullfrog  | View workflow run | Using GPT Sol | 𝕏

@thomasluizon
thomasluizon merged commit 6b840d1 into main Aug 23, 2026
31 of 33 checks passed
@thomasluizon
thomasluizon deleted the feature/ticket-333-metrics-block branch August 23, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant