Skip to content

feat: reload the app config after pre hooks with AIO_RELOAD_CONFIG_ON_PRE_HOOKS - #948

Open
iivvaannxx wants to merge 3 commits into
adobe:masterfrom
iivvaannxx:aio-reload-config-env
Open

iivvaannxx wants to merge 3 commits into
adobe:masterfrom
iivvaannxx:aio-reload-config-env

Conversation

@iivvaannxx

@iivvaannxx iivvaannxx commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds AIO_RELOAD_CONFIG_ON_PRE_HOOKS, off by default. When it is on for a pre hook, the command reloads app.config.yaml and its $include files after that hook, so changes the hook made to the config take effect in the same run. It takes the list syntax from the base PR.

Hook Command What a reload does
pre-app-build aio app build, aio app deploy Recomputes the extension list. Added extensions are built (and deployed). A removed one is skipped with a warning.
pre-app-deploy aio app deploy Uses the reloaded config for the rest of that extension's steps. The list is not recomputed. If the extension is gone, it warns and skips it.
pre-app-run aio app run Refreshes the config of the extension being run. If it is gone, it warns and returns.

Other hook names in the list are ignored, and pre-app-undeploy is not supported. A reload only happens if the extension defines that hook.

build / deploy
  extensions = load config
  while an extension is not done yet
    buildOneExt(ext)
      run pre-app-build, reloadEnvOnPreHooks
+     if enabled for pre-app-build: reload, log added and removed, skip ext if removed
+     extensions = reloaded list
    deploy(ext)                          (deploy only)
      run pre-app-deploy, reloadEnvOnPreHooks
+     if enabled for pre-app-deploy: reload, keep the list, skip ext if removed
 getFullConfig(options)
-  if (!this.appConfig) load
+  if (!this.appConfig || options.fresh) load   // fresh bypasses the cache

reloadExtConfigs and the added/removed logging live in BaseCommand, so build, deploy and run share them. If a reload fails, for example on invalid yaml, the command fails with Failed to reload the app config after the <hook> hook.

Evidence

  • Before: the extension list is captured before the loop, so a hook that edits app.config.yaml only takes effect on the next run.
    After: tests cover a reload that adds an extension and one that removes the current one (build and deploy), the pre-app-deploy refresh, the pre-app-run refresh, -e after a removal, invalid yaml, the variable off, and the fresh option. npm test and eslint pass.

Merge Danger

Door: two-way

Blast Radius: build and deploy loops

Behavior is unchanged with the variable off. buildOneExt is called with the same arguments as before. Known edges: a failed reload mid-deploy can happen after earlier extensions were already deployed, aio app run does not re-validate "nothing to run" after a reload, and the standalone-app check in deploy is computed once at the start. This branch includes the commit from the base PR, which drops out of the diff once that PR merges.

@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@iivvaannxx iivvaannxx changed the title feat: reload the app config after pre-app-build with AIO_RELOAD_CONFIG_ON_PRE_HOOKS feat: reload the app config after pre hooks with AIO_RELOAD_CONFIG_ON_PRE_HOOKS Nov 16, 2026
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