Unverified Commit 058456fa authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

Set `experimental.agenticAutoUpgrade` after successful upgrade (#98871)

So the framework can nudge agent/human in the future
parent 579ff601
......@@ -67,6 +67,9 @@ references in the prompt instead of the codemod steps below.
- [ ] Complete the codemod's manual steps, resolve its review markers, and
complete every applicable migration item. Keep only changes required by
the final target.
- [ ] Set `experimental.agenticAutoUpgrade` to the policy specified in the
prompt, preserving unrelated configuration. If the target Next.js version
does not support this option, skip the setting and report why.
## 4. Verify
......
......@@ -310,8 +310,6 @@ export async function spawnNextUpgrade(
const references = result.references
.map((reference) => `- ${reference}`)
.join('\n')
// TODO: Persist `latest` or `future` after the selected stable target
// includes the `experimental.agenticAutoUpgrade` implementation.
const reason =
upgradeType === 'security'
? 'the installed version is affected by a published security advisory'
......@@ -338,6 +336,8 @@ Complete each adoption. Temporary opt-outs and TODO markers are intermediate wor
${taskSummary}
Set \`experimental.agenticAutoUpgrade\` to ${JSON.stringify(upgradeType)} in the app's Next.js config as part of this upgrade. Preserve unrelated configuration. If the target Next.js version does not support this option, skip the setting and report why.
${futureDefaultsPrompt ? `${futureDefaultsPrompt.trimStart()}\n\n` : ''}References:
${references}`
......
......@@ -288,6 +288,8 @@ describe('agentic upgrade prompts', () => {
We're upgrading the app in "/workspace/app" from Next.js 14.1.1 to 16.3.5 because the installed version is affected by a published security advisory.
Set \`experimental.agenticAutoUpgrade\` to "security" in the app's Next.js config as part of this upgrade. Preserve unrelated configuration. If the target Next.js version does not support this option, skip the setting and report why.
References:
- https://api.github.com/advisories?affects=next
- https://registry.npmjs.org/next",
......@@ -325,7 +327,7 @@ describe('agentic upgrade prompts', () => {
expect(prepareUpgrade).toHaveBeenCalledWith('/workspace/app', 'security')
})
it.each(['latest', 'future'] as const)(
it.each(['security', 'latest', 'future'] as const)(
'uses the configured %s policy for a bare AI upgrade',
async (policy) => {
jest.mocked(loadConfig).mockResolvedValue({
......@@ -339,6 +341,11 @@ describe('agentic upgrade prompts', () => {
})
expect(prepareUpgrade).toHaveBeenCalledWith('/workspace/app', policy)
expect(Log.bootstrap).toHaveBeenCalledWith(
expect.stringContaining(
`Set \`experimental.agenticAutoUpgrade\` to "${policy}"`
)
)
}
)
......@@ -366,6 +373,8 @@ describe('agentic upgrade prompts', () => {
We're upgrading the app in "/workspace/app" from Next.js 16.2.12 to 16.3.5 because a newer stable Next.js release is available.
Set \`experimental.agenticAutoUpgrade\` to "latest" in the app's Next.js config as part of this upgrade. Preserve unrelated configuration. If the target Next.js version does not support this option, skip the setting and report why.
References:
- https://registry.npmjs.org/next/latest",
],
......@@ -436,6 +445,8 @@ describe('agentic upgrade prompts', () => {
We're upgrading the app in "/workspace/app" from Next.js 16.2.0 to 16.4.0 because the Future policy applies the latest stable release and adopts its Future Defaults.
Set \`experimental.agenticAutoUpgrade\` to "future" in the app's Next.js config as part of this upgrade. Preserve unrelated configuration. If the target Next.js version does not support this option, skip the setting and report why.
After completing and verifying the version migration, adopt these Future Defaults in order:
- Cache Components
- Read and follow "/tmp/next-upgrade-test/docs/01-app/02-guides/migrating-to-cache-components.md".
......@@ -529,6 +540,8 @@ describe('agentic upgrade prompts', () => {
We're adopting the Future Defaults available to the app in "/workspace/app", which already uses Next.js 16.4.0.
Set \`experimental.agenticAutoUpgrade\` to "future" in the app's Next.js config as part of this upgrade. Preserve unrelated configuration. If the target Next.js version does not support this option, skip the setting and report why.
Adopt these Future Defaults in order:
- Cache Components
- Read and follow "/tmp/next-upgrade-test/docs/01-app/02-guides/migrating-to-cache-components.md".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment