|
| 1 | +--- |
| 2 | +name: update-dotty-docs |
| 3 | +description: Update .NET agent compatibility docs based on a Dotty PR. Use when the user mentions a Dotty PR, dotty updates, or updating compatibility docs. |
| 4 | +disable-model-invocation: true |
| 5 | +--- |
| 6 | + |
| 7 | +# Update .NET Agent Compatibility Docs from Dotty PR |
| 8 | + |
| 9 | +Update the "compatibility and requirements" documentation in the docs-website repo based on package updates from the current open Dotty PR. |
| 10 | + |
| 11 | +## Step 0: Check prerequisites |
| 12 | + |
| 13 | +Verify that all required tools are available before proceeding. Run each check and **stop with a clear error message** if any are missing: |
| 14 | + |
| 15 | +1. **GitHub CLI (`gh`)**: Run `gh --version`. If not found, stop with: "GitHub CLI (`gh`) is required but not installed. Install it from https://cli.github.com/" |
| 16 | +2. **GitHub CLI auth**: Run `gh auth status`. If not authenticated, stop with: "GitHub CLI is not authenticated. Run `gh auth login` first." |
| 17 | +3. **Git**: Run `git --version`. If not found, stop with: "Git is required but not installed." |
| 18 | + |
| 19 | +If all checks pass, continue silently — do not list the results. |
| 20 | + |
| 21 | +## Step 1: Find the open Dotty PR |
| 22 | + |
| 23 | +Search for the open Dotty PR: |
| 24 | +``` |
| 25 | +gh pr list --repo newrelic/newrelic-dotnet-agent --search "dotty" --state open --limit 1 --json number,title,body,url |
| 26 | +``` |
| 27 | + |
| 28 | +If no open Dotty PR is found, inform the user and stop. |
| 29 | + |
| 30 | +## Step 2: Parse the package updates |
| 31 | + |
| 32 | +Fetch the PR diff: |
| 33 | +``` |
| 34 | +gh pr diff <number> --repo newrelic/newrelic-dotnet-agent |
| 35 | +``` |
| 36 | + |
| 37 | +From each `<PackageReference>` change, extract: |
| 38 | +- **Package name** (`Include` attribute) |
| 39 | +- **Old version** and **new version** |
| 40 | +- **Target framework** from `Condition` attribute: |
| 41 | + - `net4xx` (e.g., `net481`) = .NET Framework section |
| 42 | + - `net8.0`, `net10.0`, etc. = .NET Core section |
| 43 | + - No condition = both sections |
| 44 | + |
| 45 | +## Step 3: Check CI status |
| 46 | + |
| 47 | +Check the all_solutions workflow status for the Dotty PR: |
| 48 | +``` |
| 49 | +gh pr checks <number> --repo newrelic/newrelic-dotnet-agent |
| 50 | +``` |
| 51 | + |
| 52 | +Look for any failing jobs, especially in: |
| 53 | +- **Integration test** jobs (`Run IntegrationTests (*)`) |
| 54 | +- **Unbounded integration test** jobs (`Run UnboundedIntegrationTests (*)`) |
| 55 | +- **Container test** jobs (`Run Linux Container Tests (*)`) |
| 56 | + |
| 57 | +If there are **any failing CI jobs**, report them prominently: |
| 58 | + |
| 59 | +> **CI FAILURES:** The following jobs are failing on the Dotty PR: |
| 60 | +> - {job name} — [link] |
| 61 | +> |
| 62 | +> An all-passing CI run is required to confirm the updated libraries don't break tests. |
| 63 | +
|
| 64 | +Then loop through **each failing job individually**, asking the user how to proceed using `AskUserQuestion` with three options: |
| 65 | + |
| 66 | +> **Failing job: {job name}** — [link] |
| 67 | +
|
| 68 | +1. **Analyze** — Diagnose whether this failure is caused by the Dotty package updates |
| 69 | +2. **Skip** — Skip this failure and move on to the next one |
| 70 | +3. **Stop** — Stop the skill and wait for a green build before retrying |
| 71 | + |
| 72 | +**If the user chooses "Stop":** End the skill run immediately. |
| 73 | + |
| 74 | +**If the user chooses "Skip":** Record this job as unanalyzed, exclude any packages that could be related to it from docs updates, and move to the next failing job. |
| 75 | + |
| 76 | +**If the user chooses "Analyze":** Perform a detailed diagnosis of that job: |
| 77 | + |
| 78 | +1. Fetch the failing job's logs: |
| 79 | + ``` |
| 80 | + gh api repos/newrelic/newrelic-dotnet-agent/actions/jobs/<job_id>/logs |
| 81 | + ``` |
| 82 | +2. Search the logs for error messages, exceptions, and stack traces. |
| 83 | +3. Correlate failures with specific package updates from Step 2 — check whether the error references types, assemblies, or versions from updated packages. |
| 84 | +4. Check for **transitive dependency conflicts** — a common pattern is Package A being updated to a version that's incompatible with Package B (e.g., `OpenAI` 2.9.0 removing a type that `Azure.AI.OpenAI` depends on). Compare the dependency chains of updated packages against their co-dependencies in `MFALatestPackages.csproj`. |
| 85 | +5. Present findings: |
| 86 | + - Which test(s) failed and the specific error |
| 87 | + - Whether the failure is caused by a Dotty package update (and which one) |
| 88 | + - Recommended remediation (e.g., revert the specific package, pin a version, or wait for an upstream fix) |
| 89 | + - Which docs updates are safe to proceed with and which should be held |
| 90 | + |
| 91 | +Then move to the next failing job. |
| 92 | + |
| 93 | +After processing all failing jobs, summarize which packages are safe to update in docs and which should be excluded, then continue to Step 4. |
| 94 | + |
| 95 | +## Step 4: Flag major version bumps |
| 96 | + |
| 97 | +If any package has a **major version change** (e.g., 3.x to 4.x), report it prominently BEFORE proceeding: |
| 98 | + |
| 99 | +> **MAJOR VERSION BUMP:** {Package} {old} -> {new} |
| 100 | +> Major version updates require deeper compatibility evaluation and may block merging the Dotty PR. |
| 101 | +
|
| 102 | +## Step 5: Prepare the docs repo |
| 103 | + |
| 104 | +Clone the user's fork of `newrelic/docs-website` to a temporary directory and set up remotes. |
| 105 | + |
| 106 | +1. **Find the user's fork** by querying the GitHub API: |
| 107 | + ``` |
| 108 | + gh api user |
| 109 | + gh api repos/<github-username>/docs-website --jq '.full_name' |
| 110 | + ``` |
| 111 | + If the user does not have a fork of `newrelic/docs-website`, inform them and stop. Do not attempt to create one. |
| 112 | + |
| 113 | +2. **Clone to a temp directory:** |
| 114 | + ``` |
| 115 | + DOCS_REPO=$(mktemp -d)/docs-website |
| 116 | + git clone --depth 1 --branch develop https://github.com/<github-username>/docs-website.git "$DOCS_REPO" |
| 117 | + cd "$DOCS_REPO" |
| 118 | + ``` |
| 119 | + |
| 120 | +3. **Add upstream remote and sync:** |
| 121 | + ``` |
| 122 | + git remote add upstream https://github.com/newrelic/docs-website.git |
| 123 | + git fetch upstream develop |
| 124 | + git merge upstream/develop |
| 125 | + git push origin develop |
| 126 | + ``` |
| 127 | + |
| 128 | +4. **Create a feature branch** from `develop` (e.g., `dotnet/dotty-updates-YYYY-MM-DD`). |
| 129 | + |
| 130 | +All subsequent steps operate inside `$DOCS_REPO`. |
| 131 | + |
| 132 | +## Step 6: Update the docs file |
| 133 | + |
| 134 | +The file to edit is: |
| 135 | +``` |
| 136 | +src/content/docs/apm/agents/net-agent/getting-started/net-agent-compatibility-requirements.mdx |
| 137 | +``` |
| 138 | + |
| 139 | +This MDX file has two tabbed sections: `.NET Core` (`id="core"`) and `.NET Framework` (`id="framework"`). Update the correct section based on the target framework from Step 2. Only update entries for packages where CI tests are passing. |
| 140 | + |
| 141 | +### Package-to-docs mapping |
| 142 | + |
| 143 | +Not every Dotty package has a docs entry. Some are supporting dependencies (e.g., `AWSSDK.SecurityToken`) that aren't directly instrumented. Skip packages that don't have a matching entry — do not mention skipped packages in the output. |
| 144 | + |
| 145 | +Search the docs file to find matching entries. Common mappings include: |
| 146 | + |
| 147 | +| NuGet Package | Docs Entry | |
| 148 | +|---|---| |
| 149 | +| `Microsoft.Azure.Cosmos` | Cosmos DB | |
| 150 | +| `CouchbaseNetClient` | Couchbase | |
| 151 | +| `StackExchange.Redis` | StackExchange.Redis | |
| 152 | +| `EnyimMemcachedCore` | Memcached | |
| 153 | +| `AWSSDK.DynamoDBv2` | DynamoDB | |
| 154 | +| `Confluent.Kafka` | Confluent.Kafka | |
| 155 | +| `AWSSDK.SQS` | AWSSDK.SQS | |
| 156 | +| `AWSSDK.Kinesis` | AWSSDK.Kinesis | |
| 157 | +| `AWSSDK.KinesisFirehose` | AWSSDK.KinesisFirehose | |
| 158 | +| `AWSSDK.BedrockRuntime` | AWS Bedrock | |
| 159 | +| `OpenAI` | OpenAI | |
| 160 | +| `Azure.AI.OpenAI` | Azure.AI.OpenAI | |
| 161 | +| `log4net` | Log4Net | |
| 162 | +| `NLog` | NLog | |
| 163 | +| `Serilog` | Serilog | |
| 164 | +| `Microsoft.Extensions.Logging` | Microsoft.Extensions.Logging | |
| 165 | +| `NServiceBus` | NServiceBus | |
| 166 | +| `RabbitMQ.Client` | RabbitMQ.Client | |
| 167 | +| `MassTransit` | MassTransit | |
| 168 | +| `Elastic.Clients.Elasticsearch` | Elasticsearch | |
| 169 | +| `MySql.Data` | MySQL | |
| 170 | +| `Npgsql` | PostgreSQL | |
| 171 | +| `MongoDB.Driver` | MongoDB | |
| 172 | + |
| 173 | +This table is not exhaustive. Always search the docs file for the package name to find the correct entry. |
| 174 | + |
| 175 | +### Version formats in the docs |
| 176 | + |
| 177 | +The "latest verified compatible version" appears in two formats: |
| 178 | + |
| 179 | +**Bullet list** (Datastores, Messaging sections): |
| 180 | +``` |
| 181 | +* Latest verified compatible version: 3.57.0 |
| 182 | +``` |
| 183 | + |
| 184 | +**Table column** (LLM, Logging sections — last `<td>` in the row): |
| 185 | +```html |
| 186 | +<td> |
| 187 | + 2.8.0 |
| 188 | +</td> |
| 189 | +``` |
| 190 | + |
| 191 | +Update only the version number. Do not change any surrounding text or structure. |
| 192 | + |
| 193 | +## Step 7: Present changes for review |
| 194 | + |
| 195 | +Show the user: |
| 196 | +1. A summary table of docs updates (package, old version, new version, section) |
| 197 | +2. Any major version bumps flagged in Step 3 |
| 198 | +3. The full diff of the docs file |
| 199 | + |
| 200 | +**Do NOT commit or push until the user explicitly approves.** |
| 201 | + |
| 202 | +## Step 8: Commit, push, and create PR |
| 203 | + |
| 204 | +After user approval: |
| 205 | + |
| 206 | +1. Commit with message: `chore(.net agent): Update compatibility docs for latest Dotty package versions` |
| 207 | +2. Push the branch to origin (the fork). |
| 208 | +3. Create a PR against **upstream** `newrelic/docs-website` on the `develop` branch, using the GitHub username discovered in Step 5: |
| 209 | + ``` |
| 210 | + gh pr create --repo newrelic/docs-website --base develop --head <github-username>:<branch-name> --title "<title>" --body "<body>" |
| 211 | + ``` |
| 212 | + Keep the title and body concise, e.g.: |
| 213 | + - Title: `chore(.net agent): Updating latest supported framework versions` |
| 214 | + - Body: Brief list of packages updated with new versions. |
| 215 | + |
| 216 | +## Step 9: Comment on the Dotty PR |
| 217 | + |
| 218 | +Add a comment on the original Dotty PR in the .NET agent repo linking to the newly created docs PR: |
| 219 | +``` |
| 220 | +gh pr comment <dotty-pr-number> --repo newrelic/newrelic-dotnet-agent --body "Compatibility docs update PR created: <docs-pr-url>" |
| 221 | +``` |
| 222 | + |
| 223 | +## Step 10: Clean up |
| 224 | + |
| 225 | +Remove the temporary docs repo clone: |
| 226 | +``` |
| 227 | +rm -rf "$DOCS_REPO" |
| 228 | +``` |
0 commit comments