Issue #3586218: Allow subcontext scope to override parent scope.

Closes #3586218

How to test in the UI

  1. Settings → Context Items Settings: enable "Enable subcontext hierarchy". Create a top-level parent item with a scope (e.g. Use case = Working with text).
  2. From the items list, use Add subcontext on the parent.
    • Confirm "Same as parent" is checked by default and the scope fields are hidden.
    • Uncheck it, set a different scope (e.g. Use case = Working with canvas), Save, then re-edit → it must stay unchecked with the custom scope (this is the persistence fix).
  3. Add a second subcontext, leave "Same as parent" checked, Save → re-edit shows it still checked and inheriting.
  4. Effective scope: on /admin/config/ai/context/items, the inheriting child's Scope/Use-cases column should mirror the parent's; the custom child shows its own.
  5. Reindex cascade: edit the parent's scope and Save → the inheriting child's scope follows in the list/filter; the custom child is unchanged.
  6. Global cap: set Max global context items low, fill it with top-level global items, then add an inheriting subcontext under a global parent → it should save fine (inheriting children don't consume a cap slot).
  7. Upgrade path: on a site that already ran the previous numbering, run /update.php (or drush updb) → update 10011 installs the field and backfills existing items without errors, even if globals exceed the cap.
Edited by Kristen Pol

Merge request reports

Loading