Skip to content

Show ActionListPage in menu for NZC instances#257

Open
Bhavatu wants to merge 4 commits into
mainfrom
feat/nzc-actions-page-in-menu
Open

Show ActionListPage in menu for NZC instances#257
Bhavatu wants to merge 4 commits into
mainfrom
feat/nzc-actions-page-in-menu

Conversation

@Bhavatu
Copy link
Copy Markdown
Contributor

@Bhavatu Bhavatu commented Apr 27, 2026

Description

Optional per-page CharField on PathsPage that overrides the page title when the page appears in a menu. Exposed on PageInterface so menu queries can pick it up; defaults to empty (frontend falls back to title).
Set menu_label='Home' on the InstanceRootPage after default nzc content creation, also data migration to set this for existing nzc instances.

Screenshots/Videos (if applicable)

Add screenshots or videos demonstrating the changes if applicable.

Related issue

https://app.asana.com/1/1201243246741462/project/1206017643443542/task/1214290365647451
https://app.asana.com/1/1201243246741462/project/1206017643443542/task/1214290365647450

Requirements, dependencies and related PRs

For the UI custom menu labels to work: kausaltech/kausal-paths-ui#267

Additional Notes

Any additional information that reviewers should know about this PR.


✅ Pre-Merge Checklist

Type of Change

  • Set the PR's label to match the nature of this change

Testing

  • Built Unit tests (unit tests added/updated)
  • Built E2E tests (if applicable. E2E tests added/updated)
  • Authorization is tested (permissions and access controls verified)
  • Manually tested locally (functionality verified)
    Manual testing instructions
    If feature requires manual testing by reviewer, you can provide instructions here.

Internationalization & Accessibility

  • New strings are translatable (all user-facing text uses i18n)
  • Accessibility standards met (WCAG compliance, screen reader support)

Dependencies

  • Dependencies are merged (if applicable. If the change depends on other PRs e.g. kausal_common)

Screenshots/Videos (if applicable)

Add screenshots or videos demonstrating the changes if applicable.

Additional Notes

Any additional information that reviewers should know about this PR.

@Bhavatu Bhavatu added the New feature New feature (non-breaking change which adds functionality) label Apr 27, 2026
@Bhavatu Bhavatu force-pushed the feat/nzc-actions-page-in-menu branch from a010c5b to 9145525 Compare April 28, 2026 11:57
@kausal-code-coverage
Copy link
Copy Markdown

kausal-code-coverage Bot commented Apr 28, 2026

Codecov Report

❌ Patch coverage is 42.85714% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
frameworks/models.py 26.66% 8 Missing and 3 partials ⚠️
pages/page_interface.py 75.00% 1 Missing ⚠️

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #257   +/-   ##
=======================================
  Coverage   46.22%   46.22%           
=======================================
  Files         340      340           
  Lines       44102    44116   +14     
  Branches     6577     6579    +2     
=======================================
+ Hits        20385    20392    +7     
- Misses      22111    22114    +3     
- Partials     1606     1610    +4     
Flag Coverage Δ
e2e-tests 13.47% <0.00%> (-0.01%) ⬇️
unittests 42.89% <42.85%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
frameworks/mutations.py 86.07% <100.00%> (+0.17%) ⬆️
pages/models.py 59.72% <100.00%> (+0.18%) ⬆️
pages/page_interface.py 67.69% <75.00%> (+0.47%) ⬆️
frameworks/models.py 66.77% <26.66%> (-0.23%) ⬇️

... and 1 file with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@woodwoerk woodwoerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, could we try this out in staging?

@Bhavatu Bhavatu force-pushed the feat/nzc-actions-page-in-menu branch 2 times, most recently from cc48781 to be18877 Compare April 30, 2026 10:51
@Bhavatu Bhavatu force-pushed the feat/nzc-actions-page-in-menu branch from be18877 to 3a858c5 Compare May 5, 2026 10:36
@juyrjola
Copy link
Copy Markdown
Member

Most of the existing NZC instances' root page is of type OutcomePage, not InstanceRootPage. This should probably be reflected in the data migration?

@Bhavatu Bhavatu force-pushed the feat/nzc-actions-page-in-menu branch from 3a858c5 to 468cbae Compare May 27, 2026 08:48
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 468cbae2a1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +10 to +11
qs = FrameworkConfig.objects.select_related('instance_config__site__root_page')
for fwc in qs:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit root-page menu migration to NZC configs

This migration iterates every FrameworkConfig, unlike the earlier NZC action-page migration which filters framework__identifier='nzc', so applying it will also set show_in_menus=True and menu_label='Home' on root pages for non-NZC framework instances. In deployments that already have framework configs for other frameworks, those instances will unexpectedly get their hidden root page inserted into menu queries and renamed in the menu even though this change is scoped to NZC instances.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bhavatu Has it been confirmed that this won't cause trouble for CADS framework instances?

Bhavatu added 3 commits May 27, 2026 12:12
Optional per-page CharField on PathsPage that overrides the page title
when the page appears in a menu. Exposed on PageInterface so menu
queries can pick it up; defaults to empty (frontend falls back to
title)
In FrameworkConfig.create_instance, flip show_in_menus=True and set
menu_label='Home' on the InstanceRootPage after default content
creation, so new instances get a Home link in the menu out of the box
Data migration: for every FrameworkConfig with a site, flip
show_in_menus=True on the root page and set menu_label='Home' on the
InstanceRootPage where it's empty (preserves any manual overrides)
@Bhavatu Bhavatu force-pushed the feat/nzc-actions-page-in-menu branch from 468cbae to 05af2b2 Compare May 27, 2026 09:15
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05af2b2fda

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread frameworks/models.py
Comment on lines +804 to +806
root_page.show_in_menus = True
root_page.menu_label = 'Home'
root_page.save()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply the menu defaults to the Strawberry creator too

This post-creation menu setup only runs through FrameworkConfig.create_instance, but the Strawberry createInstance mutation in frameworks/mutations.py still creates FrameworkConfig directly and then calls ic.create_default_content() without setting the root page visible/menu-labeled or clearing the action page footer flag. Instances created through that self-service path will therefore keep the root page out of pages(inMenu: true) and still show the Actions page in the footer, unlike existing instances covered by the migration and instances created through the Graphene helper. Consider moving this into a shared helper called by both creation paths.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65e3c40ea6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread frameworks/migrations/0023_set_root_page_home_label.py
Extract the post-creation menu setup (root page show_in_menus,
menu_label='Home', ActionListPage show_in_footer=False) into
FrameworkConfig.setup_instance_pages and call it from both creation
paths. Previously the Strawberry createInstance mutation skipped this
step, so self-service instances were missing the Home menu link and
still showed Actions in the footer
@Bhavatu Bhavatu force-pushed the feat/nzc-actions-page-in-menu branch from 65e3c40 to 7a04bc7 Compare May 27, 2026 09:56
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a04bc7cde

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread frameworks/models.py
Comment on lines +810 to +812
if isinstance(root_page, PathsPage):
root_page.show_in_menus = True
root_page.menu_label = 'Home'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict root-page menu defaults to NZC

This helper is called for every newly created FrameworkConfig path, but the change is scoped to NZC and there is no self.framework.identifier == 'nzc' guard here. When a non-NZC framework instance is created through FrameworkConfig.create_instance or the Strawberry mutation, its root page will now be forced into pages(inMenu: true) with a Home label even if that framework expected the root page to stay hidden or use its configured title; the fresh evidence beyond the existing migration comment is that the same unguarded behavior is now in the shared creation helper.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New feature New feature (non-breaking change which adds functionality)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants