Add governance and licensing pages#695
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds new “Governance” and “Licensing” policy pages and updates existing policy pages to live under a main/pages/policies/ template structure, wiring the new pages into the site navigation.
Changes:
- Add
GovernancePageView/LicensingPageViewthat fetch and render Markdown from GitHub. - Update Privacy/Terms templates + tests to use new
main/pages/policies/*template paths and add “Policies” breadcrumb items. - Update footer links and add URL routes for the new pages; add mypy stub packages for
requests/markdown.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
tests/main/test_main_views.py |
Updates template-path assertions for Privacy/Terms views. |
pyproject.toml |
Adds typing stub packages for Markdown/requests to dev extras. |
main/views/page_views.py |
Adds GitHub Markdown-backed base view + governance/licensing views; updates Privacy/Terms template paths. |
main/urls.py |
Adds governance/ and licensing/ routes. |
main/templates/main/snippets/footer.html |
Fixes footer URL names and adds links to the new policy pages. |
main/templates/main/pages/policies/terms.html |
Adds “Policies” breadcrumb item. |
main/templates/main/pages/policies/privacy.html |
Adds “Policies” breadcrumb item and tweaks breadcrumb label. |
main/templates/main/pages/policies/licensing.html |
New template for licensing page rendering remote markdown. |
main/templates/main/pages/policies/governance.html |
New template for governance page rendering remote markdown. |
.pre-commit-config.yaml |
Adds typing stub packages for mypy hook. |
Comments suppressed due to low confidence (2)
main/templates/main/pages/policies/privacy.html:9
- In breadcrumbs,
aria-current="page"should only be present on the active/current breadcrumb item. Here it's applied to the non-active "Policies" crumb, which is inconsistent with other templates and is inaccurate for assistive technologies.
main/templates/main/pages/policies/terms.html:9 - In breadcrumbs,
aria-current="page"should only be present on the active/current breadcrumb item. Here it's applied to the non-active "Policies" crumb, which is inconsistent with other templates and is inaccurate for assistive technologies.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| class GovernancePageView(GitHubMarkdownPageView): | ||
| """View that renders the governance page from GitHub Markdown.""" | ||
|
|
||
| template_name = "main/pages/policies/governance.html" | ||
| page_heading = "DIRECT Governance" | ||
| unavailable_message = "Governance document is temporarily unavailable." | ||
|
|
||
| github_raw_url = ( | ||
| "https://raw.githubusercontent.com/direct-framework/.github/main/GOVERNANCE.md" | ||
| ) | ||
|
|
||
|
|
||
| # @method_decorator(cache_page(60 * 60), name="dispatch") # cache 1 hour | ||
| class LicensingPageView(GitHubMarkdownPageView): | ||
| """View that renders the licensing page from GitHub Markdown.""" | ||
|
|
||
| template_name = "main/pages/policies/licensing.html" | ||
| page_heading = "DIRECT Licensing" | ||
| unavailable_message = "Licensing document is temporarily unavailable." | ||
|
|
||
| github_raw_url = ( | ||
| "https://raw.githubusercontent.com/direct-framework/.github/main/LICENSING.md" | ||
| ) |
There was a problem hiding this comment.
New Governance/Licensing views introduce network-fetch + markdown rendering behavior but there are no tests covering these routes (template used, status code, and the failure path when the GitHub fetch errors). Add view tests that mock the HTTP request (e.g., via requests-mock/pytest-mock) to keep the test suite deterministic.
anenadic
left a comment
There was a problem hiding this comment.
This is looking good to me - thank you @davehorsfall.
When trying to run locally - I noticed that dependencies markdown and requests are missing from requirements.txt so a pip freeze should be done.
|
Suggestion for the content of the licence file (to be tweaked, just a starting point): |
AdrianDAlessandro
left a comment
There was a problem hiding this comment.
This is all really good! I like the approach and how the content is being pulled in and rendered. I have made a number of comments related to best practices and security. We should also have tests for the two new pages (at least rudimentary ones that just inherit TemplateOkMixin like the TestFrameworkOverviewPageView).
Also, the copilot review made some good comments, I have reacted to the ones I think are valuable with a thumbs up emoji. Please have a look at those (some of them are related to comments I made too).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…webapp into feat/governance
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
# Conflicts: # main/templates/main/snippets/footer.html
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
I think all pending points here are now addressed @AdrianDAlessandro (except the tests). I've enabled the caching, and sanitised the external content with nh3. I've also fixed the broken test. |
|
I've also added @anenadic draft licensing text to LICENSING.md, so there is some initial content. We can tweak and expand on that if necessary. |
AdrianDAlessandro
left a comment
There was a problem hiding this comment.
I've just pushed a couple basic tests for these two pages. Happy to merge
Description
This PR adds a governance and licensing page to the website, where content is pulled directly from Github markdown files. Content should be cached for 1 hour.
Note: the licensing page on Github doesn't exist yet, and needs to be created. The new page should act as a centralised single point of truth on licensing across the project, and signpost people appropriately to more information as necessary.
Fixes # (issue)
Type of change
Key checklist
python -m pytest)mkdocs serve)pre-commit run --all-files)Further checks