Skip to content

ref: Kill heartbeat and aorta - #44

Merged
jan-auer merged 122 commits into
masterfrom
ref/flatline
Aug 24, 2018
Merged

jan-auer merged 122 commits into
masterfrom
ref/flatline

Conversation

@jan-auer

@jan-auer jan-auer commented Aug 16, 2018 •

Copy link
Copy Markdown
Member

TODO

  • resolve panic when upstream request fails
  • check downstream signature of queries
  • resolve timeout on 404 handler (@untitaker: can we still repro this?)
  • buffer request payload with limit for forwards (see slack) @untitaker
  • reencode requests for forwards? (@jan-auer @untitaker)

@jan-auer
jan-auer requested a review from mitsuhiko as a code owner August 16, 2018 15:10
@jan-auer

Copy link
Copy Markdown
Member Author

@untitaker @mitsuhiko Merging this now, since it's feature-complete. Let's clean up and fix tests on Monday.

@jan-auer
jan-auer merged commit 62b6b24 into master Aug 24, 2018
@jan-auer
jan-auer deleted the ref/flatline branch August 24, 2018 21:29
BYK added a commit to getsentry/junior that referenced this pull request Nov 25, 2026
)

An Annotation kept a copy of its object's label, state, description, and
facts, and only webhooks kept that copy current. Now it stores the
subject, the title, and the link. A card reads every other fact live,
and the plugin makes the short label from the link. This closes the "An
Annotation keeps a copy…" Gap in `design/annotations.md`. The Gap line
is removed in its own commit.

## Storage

- `junior_conversation_annotations` gets the `title` and `url` columns.
The migration fills them from the JSON and removes `title`, `url`,
`label`, `status`, `description`, `facts`, `sourceUpdatedAt`, `warning`,
`trigger`, and `displayType` from `annotation_json`.
- Old workers keep writing the old JSON during rollout. A new trigger,
`junior_conversation_annotations_stored_fields`, moves the title and the
link to the columns and removes the dropped keys. Triggers run in name
order, so it runs after the legacy subject trigger, which still reads
the old JSON. That trigger now also reads the link from the `url`
column.
- Search and the subject filter read the `title` and `url` columns.
`storedAnnotationTitle` and `storedAnnotationUrl` are gone.
- **The primary key stays `(conversation_id, plugin, kind, key)`, and
there is no unique index on the subject.** Old workers' `ON CONFLICT`
targets that key. Also, two rows of one Conversation can share a
subject: a renamed repository gives a new key for the same object, and a
`link` subject comes from the URL, so an attached link and a typed
object can name the same thing. Legacy Slack card refs (a plugin + key
digest) and old Message refs `{plugin, key}` resolve by key, so `key`
stays.

## Plugin API and writers (hard cutover)

- `objectAnnotations` entries and `PluginConversationAnnotations.upsert`
take `savedObjectAnnotationSchema`: `{kind, key, subject?, objectType,
title, url}`. `resourceLinkAnnotationSchema` is `{kind, objectType?,
key, url}`. Both are strict, so a plugin that still sends a dropped
field fails at the boundary.
- `ObjectAnnotation` stays the live card shape that link types return.
The new `LiveAnnotation` is the card or the label fallback that a viewer
sees, and the sidebar hook gets it.
- Updated writers: GitHub (create/update issue and pull request), Linear
MCP, Google Calendar (create, update, cancel), Vercel deployments, core
Automations, and attach. GitHub's live card comes from
`githubObjectCard` in `issue-links.ts`. The create-tool replay states
still accept the old fact fields as optional, because states saved
before this change can still be replayed.
- `build-a-plugin.md` describes what an Annotation stores.

## Readers

- **Fallback card** (no access, provider down, failed read): the label
from the plugin's link type, or else the link's host, or else the object
type name, plus the link. The delivered Message card snapshot also posts
the stored title, as before.
- **Model metadata** (prompt tags and tool results that list
Annotations) and search results get the label from the plugin. The label
loads lazily (`chat/conversations/annotation-labels.ts`), because the
link types import the app and the app imports the tools that save
Annotations.
- **Automations get a live source.** A new core link type
(`api/objects/automation.ts`, `/automations/*`, not cached) reads the
Automation from the database with the Automations view's access rule.
The card shows the live status, trigger, and warning.
`automationCardStatus` moved to `chat/automations/card.ts`.
- **Legacy untyped `link` rows, and plugins without a link type, get the
label-only fallback.** Today that means Vercel deployments, and Linear
until its link type (#4331) lands.
- The dashboard Linked work list shows a `resource_link` row as the
label and the link, and asks for its live card. The client no longer
reads the dropped fields.

## `annotation-fields:check`

`scripts/check-annotation-fields.mjs` runs with the other checks in
`scripts/check.mjs`. Its baseline is
`scripts/annotation-fields-baseline.json`. It fails when:

- a table column or a saved-schema field is not in the baseline, or
- source reads a dropped field from the stored JSON
(`annotation_json->>'status'`, `${annotations.annotation}->'facts'`, and
so on).

The baseline-growth check finds the baseline by its name, so the
baseline can only shrink.

## Screenshots

Linked work on a mock Conversation. #2201 and
getsentry/relay#44 are label-and-link rows. getsentry/payments#91 is a
live card.

| | Light | Dark |
| --- | --- | --- |
| Desktop | ![light
desktop](https://junior-prod.sentry.dev/public/artifacts/be0fcec6-4006-4be0-b0d8-145e9ae4f0ed.png)
| ![dark
desktop](https://junior-prod.sentry.dev/public/artifacts/b37ef629-6d22-4031-8bc5-727c80302a7f.png)
|
| Mobile | ![light
mobile](https://junior-prod.sentry.dev/public/artifacts/d6dce8d2-5d8c-4f52-b474-17b63242576d.png)
| ![dark
mobile](https://junior-prod.sentry.dev/public/artifacts/91acaa70-b983-4ff3-a77e-257cf19f2897.png)
|

## Rollout risks

- The migration removes the fields from the JSON. Until the deploy
finishes, old readers show Annotations without the label, state, or
facts.
- Vercel deployment cards show only the link's host, because Vercel has
no link type.
- Linear cards show only the link's host until #4331
merges. Expect a conflict in `junior-linear/src/plugin.ts`.
- A delivered Automation card reads the Automation with the access of
the person who started the Conversation. An Automation run Conversation
has no such person, so its delivered card uses the fallback.

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A883547fc43df31312aaeda4c4dbbb06a -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A883547fc43df31312aaeda4c4dbbb06a)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A883547fc43df31312aaeda4c4dbbb06a/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <[email protected]>
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.

3 participants