Skip to content

1166 local plans dataset list deploy to production#1168

Merged
pooleycodes merged 16 commits intomainfrom
1166-local-plans-dataset-list---deploy-to-production
Apr 16, 2026
Merged

1166 local plans dataset list deploy to production#1168
pooleycodes merged 16 commits intomainfrom
1166-local-plans-dataset-list---deploy-to-production

Conversation

@pooleycodes
Copy link
Copy Markdown
Contributor

@pooleycodes pooleycodes commented Apr 1, 2026

Description

Update the default yaml file to include the hard coded list of datasets to allow plans datasets and timetable ones to show through to production dataset.

Also removed the requirement for a database to already exist for a dataset, now supplementary plan dataset will show on the platform even though it has not database set up in datasette (as no data provided yet)

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Related Tickets & Documents

  • Closes #

QA Instructions, Screenshots, Recordings

Before

Before screenshot here

After

After screenshot here

Added/updated tests?

We encourage you to keep the code coverage percentage at 80% and above.

  • Yes
  • No, and this is why: Please replace this line with details on why tests have not been included
  • I need help with writing tests

QA sign off

  • Code has been checked and approved
  • Design has been checked and approved
  • Product and business logic has been checked and proved

[optional] Are there any post-deployment tasks we need to perform?

[optional] Are there any dependencies on other PRs or Work?

Summary by CodeRabbit

  • New Features

    • Added five plan-related datasets: plan-timetable, local-plan, minerals-plan, waste-plan and supplementary-plan, each linked to plan guidance.
    • New alternative pre-populated source notice shown for local-plan and plan-timetable.
  • Chores

    • Recognised local-planning-group as an organisation type in production and staging.
    • Adjusted several dataset display names for clearer wording.
    • Updated plan dataset fallbacks to include a description field and unified minerals/waste authority naming.
  • Documentation

    • Updated the guidance link for infrastructure-funding-statement to the latest specification URL.
  • Tests

    • Updated a unit-test expectation to match revised dataset wording.

@pooleycodes pooleycodes linked an issue Apr 1, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔄 Running review...

Walkthrough

Updated dataset configuration names and guidance links; added five plan-related dataset entries and adjusted plan-fallback schema; added local-planning-group to environment configs; introduced a new Nunjucks macro and conditional rendering in two templates; removed a Datasette per-row existence check; minor test assertion and SQL LIMIT tweak.

Changes

Cohort / File(s) Summary
Dataset configurations
config/default.yaml
Adjusted multiple entityDisplayName values and guidance links; added plan-timetable, local-plan, minerals-plan, waste-plan, supplementary-plan with guidance and display names.
Plan fallback schema
config/plan-fallback.json
Added description fields for plan datasets; renamed minerals/waste authority keys to minerals-and-waste-planning-authorities.
Environment configs
config/production.yaml, config/staging.yaml
Added local-planning-group to organisationTypes.
Datasette utilities
src/utils/datasetteQueries/fetchDatasetCollections.js, src/utils/datasetteQueries/fetchDatasetsFromProvisions.js
Removed per-dataset Datasette existence pre-check and related logging; added LIMIT -1 to the provision query; removed unused import.
Templates / Notices
src/views/components/alternativePrePopulatedSourceNotice.html, src/views/organisations/dataset-overview.html, src/views/organisations/dataview.html
Added alternativePrePopulatedSourceNotice(...) macro and conditional rendering so local-plan and plan-timetable use the new notice while other datasets use existing notice.
Tests
test/unit/middleware/datasetTaskList.middleware.test.js, test/unit/views/organisations/lpaOverviewPage.test.js
Adjusted test assertions: “article 4 directions” wording and case-insensitive dataset title comparison.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • gibahjoe
  • Ben-Hodgkiss

Poem

🐇 I hopped through YAML rows at dawn's light,
I nudged dataset names and set plan links right,
A notice sprang where plans are shown,
Tests blinked green, the schema grown,
A cheerful thump — the configs now bright.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title refers to local plans dataset functionality but lacks clarity about the core change; it mentions deployment but doesn't explain what feature is being deployed. Consider revising to clarify the main change, e.g. 'Add local plans and supplementary plans dataset support' or 'Enable local plans dataset with pre-populated notice'.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 1166-local-plans-dataset-list---deploy-to-production

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 66.11% 6986 / 10566
🔵 Statements 66.11% 6986 / 10566
🔵 Functions 64.18% 285 / 444
🔵 Branches 77.6% 939 / 1210
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/utils/datasetteQueries/fetchDatasetCollections.js 100% 100% 100% 100%
src/utils/datasetteQueries/fetchDatasetsFromProvisions.js 88% 85.71% 100% 88% 22-24
Generated in workflow #1409 for commit f9f1dee by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
config/default.yaml (1)

136-139: Consider adding local-planning-group to default configuration.

The organisationTypes list in default.yaml does not include local-planning-group, which was added to both config/production.yaml and config/staging.yaml. This creates an inconsistency where development environments (using default.yaml) won't recognise local-planning-group organisations, whilst production and staging will.

Based on the middleware code in organisations.middleware.js, the SQL query dynamically filters organisations using these types, so local-planning-group entries will be excluded in development. Consider whether development and testing environments should also support this organisation type to maintain consistency and enable proper testing before deployment.

♻️ Proposed addition to align with production and staging
 organisationTypes:
   - local-authority
   - national-park-authority
   - development-corporation
+  - local-planning-group
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/default.yaml` around lines 136 - 139, The default configuration's
organisationTypes list is missing the local-planning-group entry which causes
dev environments to behave differently than staging/production; update the
organisationTypes YAML sequence by adding "local-planning-group" to the list so
it matches the other environment configs and ensure the middleware that filters
by organisationTypes (organisationTypes key used by organisations.middleware.js)
will include those organisations during development and testing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@config/default.yaml`:
- Around line 136-139: The default configuration's organisationTypes list is
missing the local-planning-group entry which causes dev environments to behave
differently than staging/production; update the organisationTypes YAML sequence
by adding "local-planning-group" to the list so it matches the other environment
configs and ensure the middleware that filters by organisationTypes
(organisationTypes key used by organisations.middleware.js) will include those
organisations during development and testing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e2df5b72-7594-4e03-a5f2-3d197252ac5e

📥 Commits

Reviewing files that changed from the base of the PR and between 99d0d8a and 016e718.

📒 Files selected for processing (3)
  • config/default.yaml
  • config/production.yaml
  • config/staging.yaml

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
config/plan-fallback.json (1)

100-100: Verify compatibility with external systems before production deployment.

The fallback resolver uses exact-name field matching. Whilst the codebase shows consistent use of the new "minerals-and-waste-planning-authorities" field name, ensure any external data stores, integrations, or third-party systems do not reference legacy field names that could silently fail to map.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/plan-fallback.json` at line 100, The fallback resolver currently does
exact-name matching for the field "minerals-and-waste-planning-authorities",
which may break integrations using legacy names; update the resolver (or its
mapping table) to accept aliases by adding known legacy field names as synonyms
for "minerals-and-waste-planning-authorities" and/or implement a normalization
step (e.g., lowercase, dash/underscore normalization) before matching, and add a
short comment and test covering the alias set so external data stores or
third-party systems referencing legacy names will still map correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@config/plan-fallback.json`:
- Line 100: The fallback resolver currently does exact-name matching for the
field "minerals-and-waste-planning-authorities", which may break integrations
using legacy names; update the resolver (or its mapping table) to accept aliases
by adding known legacy field names as synonyms for
"minerals-and-waste-planning-authorities" and/or implement a normalization step
(e.g., lowercase, dash/underscore normalization) before matching, and add a
short comment and test covering the alias set so external data stores or
third-party systems referencing legacy names will still map correctly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e972bb62-225c-4c90-95ae-9be789c0381c

📥 Commits

Reviewing files that changed from the base of the PR and between 6f71666 and 68eecbc.

📒 Files selected for processing (1)
  • config/plan-fallback.json

…, add alternate pre populated notice for local plan
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/utils/datasetteQueries/fetchDatasetsFromProvisions.js (1)

6-6: Clarify the purpose of LIMIT -1.

In SQLite, LIMIT -1 means "no limit" and returns all rows, which is equivalent to omitting the LIMIT clause entirely. Is this change intentional to work around a specific datasette behaviour or pagination default? A brief comment explaining the reasoning would help future maintainers.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/datasetteQueries/fetchDatasetsFromProvisions.js` at line 6, The SQL
uses "LIMIT -1" which in SQLite means "no limit"; clarify intent by adding a
brief inline comment next to the const sql definition in
fetchDatasetsFromProvisions.js (the const named sql with value 'SELECT DISTINCT
dataset, provision_reason FROM provision LIMIT -1') stating that LIMIT -1 is
used to force no-limit behavior (or to work around Datasette's default
pagination) and note whether this is intentional or could be replaced by
omitting LIMIT; update the comment to reference Datasette pagination if that was
the reason.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/utils/datasetteQueries/fetchDatasetsFromProvisions.js`:
- Line 6: The SQL uses "LIMIT -1" which in SQLite means "no limit"; clarify
intent by adding a brief inline comment next to the const sql definition in
fetchDatasetsFromProvisions.js (the const named sql with value 'SELECT DISTINCT
dataset, provision_reason FROM provision LIMIT -1') stating that LIMIT -1 is
used to force no-limit behavior (or to work around Datasette's default
pagination) and note whether this is intentional or could be replaced by
omitting LIMIT; update the comment to reference Datasette pagination if that was
the reason.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 30a1aee0-eb42-40fb-b8c5-97c3c7d4f122

📥 Commits

Reviewing files that changed from the base of the PR and between 68eecbc and 63bec85.

📒 Files selected for processing (5)
  • src/utils/datasetteQueries/fetchDatasetCollections.js
  • src/utils/datasetteQueries/fetchDatasetsFromProvisions.js
  • src/views/components/alternativePrePopulatedSourceNotice.html
  • src/views/organisations/dataset-overview.html
  • src/views/organisations/dataview.html

Ben-Hodgkiss
Ben-Hodgkiss previously approved these changes Apr 16, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/views/organisations/dataset-overview.html (1)

221-225: Consider centralising this dataset-type predicate.

The same local-plan/plan-timetable check now exists in multiple templates. A shared helper/macro would reduce drift when this list changes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/views/organisations/dataset-overview.html` around lines 221 - 225,
Extract the repeated predicate (dataset.dataset === "local-plan" or
dataset.dataset === "plan-timetable") into a single shared template helper/macro
(e.g., isPrepopulatedDataset or is_local_plan_dataset) and replace the inline
checks in dataset-overview.html and all other templates with a call to that
macro; update the conditional here to use the new macro to choose between
calling alternativePrePopulatedSourceNotice(organisation, dataset, downloadUrl,
alternateSources) and alternativeSourceNotice(...), and add unit/template tests
or comments where the macro is defined so future dataset-type changes are made
in one place.
src/views/components/alternativePrePopulatedSourceNotice.html (1)

6-12: Render the MHCLG explanatory paragraph at most once.

If alternateSources contains duplicate entries for the same source name, this paragraph will repeat. Consider guarding this so it renders once per page.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/views/components/alternativePrePopulatedSourceNotice.html` around lines 6
- 12, The MHCLG explanatory paragraph can render multiple times if
alternateSources contains duplicates; change the template so it renders at most
once by detecting whether any source with name "Ministry of Housing, Communities
& Local Government" exists and emitting the paragraph only once—for example,
replace the per-item conditional inside the {% for source in alternateSources %}
loop with a single check over alternateSources (or use a local rendered flag
such as mhclgRendered set before/after the loop) that references
alternateSources and source.name to ensure the paragraph is output only once.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/views/components/alternativePrePopulatedSourceNotice.html`:
- Around line 6-12: The MHCLG explanatory paragraph can render multiple times if
alternateSources contains duplicates; change the template so it renders at most
once by detecting whether any source with name "Ministry of Housing, Communities
& Local Government" exists and emitting the paragraph only once—for example,
replace the per-item conditional inside the {% for source in alternateSources %}
loop with a single check over alternateSources (or use a local rendered flag
such as mhclgRendered set before/after the loop) that references
alternateSources and source.name to ensure the paragraph is output only once.

In `@src/views/organisations/dataset-overview.html`:
- Around line 221-225: Extract the repeated predicate (dataset.dataset ===
"local-plan" or dataset.dataset === "plan-timetable") into a single shared
template helper/macro (e.g., isPrepopulatedDataset or is_local_plan_dataset) and
replace the inline checks in dataset-overview.html and all other templates with
a call to that macro; update the conditional here to use the new macro to choose
between calling alternativePrePopulatedSourceNotice(organisation, dataset,
downloadUrl, alternateSources) and alternativeSourceNotice(...), and add
unit/template tests or comments where the macro is defined so future
dataset-type changes are made in one place.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1526b138-39b5-4b56-a73a-95ebc7abe719

📥 Commits

Reviewing files that changed from the base of the PR and between 68eecbc and f9f1dee.

📒 Files selected for processing (7)
  • config/default.yaml
  • src/utils/datasetteQueries/fetchDatasetCollections.js
  • src/utils/datasetteQueries/fetchDatasetsFromProvisions.js
  • src/views/components/alternativePrePopulatedSourceNotice.html
  • src/views/organisations/dataset-overview.html
  • src/views/organisations/dataview.html
  • test/unit/views/organisations/lpaOverviewPage.test.js
✅ Files skipped from review due to trivial changes (2)
  • src/utils/datasetteQueries/fetchDatasetCollections.js
  • config/default.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/utils/datasetteQueries/fetchDatasetsFromProvisions.js

@pooleycodes pooleycodes merged commit 5b27917 into main Apr 16, 2026
5 checks passed
@pooleycodes pooleycodes deleted the 1166-local-plans-dataset-list---deploy-to-production branch April 16, 2026 09:41
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.

Local Plans Dataset List - Deploy to Production Add conditional content for timetable data on alternative source page

3 participants