# Agentic upgrade instructions

This file contains structured instructions for AI assistants helping consumers upgrade to this version of the package.

## Automated migrations

Run the automated migration tool first to apply all available codemods for this release:

```bash
dt-app update @dynatrace/strato-components
```

Sections marked **Automated by codemod** below have already been applied — verify the result rather than applying them manually. Sections marked **Opt-in feature** are new features that need a decision from the consumer. All other sections require manual code changes.

## Modes

Assume unattended mode unless the consumer is clearly present in the session.

**Unattended.** Apply the codemod results and the required migrations. Skip every section whose first line starts with `> **Opt-in feature:**`. Do not make decisions for the consumer.

**Attended.** Finish the codemod results and the required migrations first. Then handle each opt-in section in turn:

1. Run the section's **Detect** step over the consumer's repository.
2. If nothing matches, mention the section in one line and move on.
3. If there are matches, show the section title and the match count. List each match with `file:line` and the proposed diff from the **Propose** step, then ask the question from the **Ask** step.
4. Do not edit anything before the consumer answers. Apply only the changes they accept.

End with a summary that lists the sections applied, declined, uncertain and without matches. Do not write declined sections to the repository.

---

Each section below corresponds to a change in this release that requires consumer attention. Sections are separated by `---`.

## Opt-in features in this release

1. Icon visual for EmptyState
2. `validationMode` for form controls

---

> **Opt-in feature:** Icon visual for EmptyState. No existing code requires migration.

**Detect.** Find every `EmptyState.Visual` from `@dynatrace/strato-components/content` whose only child is a single icon component, for example `MagnifyingGlassIcon` from `@dynatrace/strato-icons`. Include aliased imports and local wrappers around `EmptyState`. Skip every `EmptyState.Visual` that holds `EmptyState.VisualPreset`, an image, an inline `svg`, an illustration component or several children. If you cannot tell whether a child is an icon, list it as uncertain and do not propose a change.

**Propose.** Wrap the icon in `EmptyState.VisualIcon`:

```tsx
// Before
<EmptyState.Visual>
  <MagnifyingGlassIcon />
</EmptyState.Visual>

// After
<EmptyState.Visual>
  <EmptyState.VisualIcon>
    <MagnifyingGlassIcon />
  </EmptyState.VisualIcon>
</EmptyState.Visual>
```

**Ask.** For each match, show `file:line` and the diff. Tell the consumer that the `size` of the `EmptyState` now sets the icon size: 20px for `small`, 32px for `default` and 40px for `large`. Also tell the consumer that the icon now takes only the space it needs, so the space around it is smaller than before. The visual can change size, so screenshot tests of that screen may change. Offer to apply the change to all matches, to selected ones or to none.

---

> **Opt-in feature:** `validationMode` for form controls. No existing code requires migration.

**Detect.** Find every form control such as `TextInput`, `FilterField` or `SegmentSelector` that renders a value loaded from saved data, for example `defaultValue={savedQuery}`. Include aliased imports and local wrappers. Skip controls that start empty. If you cannot tell whether a value comes from saved data, list the site as uncertain and do not propose a change.

**Propose.** Set the prop on the control:

```tsx
// Before
<TextInput defaultValue={savedName} required />

// After
<TextInput defaultValue={savedName} required validationMode="on-mount" />
```

**Ask.** For each match, show `file:line` and the diff. Tell the consumer that errors of an invalid initial value show right away and that `onValidityChange` reports them with `trigger: 'initial'`. A control that mounts empty and gets its value later shows its required error until the value arrives. Offer to apply the change to all matches, to selected ones or to none.

---

The tab stop of the `CodeEditor` and `DQLEditor` from `@dynatrace/strato-components` is now a visually hidden button which repeats their label, prefixed with "Edit". Label queries such as `getByLabel('My label')` can find both elements, so query the editable content by role instead:

```tsx
page.getByRole('textbox', { name: 'My label' });
```

Editors with foldable sections have one more tab stop after the editor, for the fold buttons.

---

Search the app for `dtVisualRefreshEnabled`. Remove every assignment such as `globalThis.dtVisualRefreshEnabled = false;` or `globalThis.dtVisualRefreshEnabled = true;`. The flag is no longer read by `@dynatrace/strato-components`, and all components render the refreshed design.

If the app opted out with `false`, tell the consumer that screenshot tests of their app will change to the refreshed design.
