Skip to content

Urb 3488 fix vocabularies values#555

Open
WBoudabous wants to merge 2 commits into
2.9.xfrom
URB-3488_fix_vocabularies_values
Open

Urb 3488 fix vocabularies values#555
WBoudabous wants to merge 2 commits into
2.9.xfrom
URB-3488_fix_vocabularies_values

Conversation

@WBoudabous

@WBoudabous WBoudabous commented May 4, 2026

Copy link
Copy Markdown
Contributor

This PR adds the missing vocabulary terms for the road decree procedure and applies the upgrade step.

Summary by CodeRabbit

  • New Features

    • Established RoadDecree vocabulary framework including townships, categories, work types, and classification systems for divergences, derogations, investigations, exemptions, and missing parts.
  • Chores

    • System upgrade to version 2911.

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR adds missing vocabulary definitions for the RoadDecree procedure. The changes include defining vocabulary structure in configuration defaults, creating a migration function to populate those vocabularies, registering the migration step, incrementing the version, and adding a changelog entry.

Changes

RoadDecree Vocabulary Setup Migration

Layer / File(s) Summary
Configuration Data
src/Products/urban/profiles/extra/config_default_values.py
Adds default_values["RoadDecree"] with vocabulary definitions (townships, roadmissingparts, divergences, derogations, investigationarticles, exemptfdarticle, foldercategories, missingparts) and registers RoadDecree in shared vocabulary lists.
Migration Imports & Helpers
src/Products/urban/migration/update_290.py (lines 6-8)
Imports vocabulary/folder creation helpers and default configuration values needed by migration logic.
Migration Implementation
src/Products/urban/migration/update_290.py (lines 375-459)
New function add_missing_roaddecree_vocabularies(context) reads RoadDecree vocabulary definitions from config, creates vocabulary folders, and populates them with default values.
Migration Registration
src/Products/urban/migration/upgrades_290.zcml
Registers the new migration function as upgrade step from version 2910 to 2911.
Version Increment
src/Products/urban/profiles/default/metadata.xml
Profile version updated from 2910 to 2911 to track the migration.
Changelog
news/URB-3488.feature
Adds news fragment documenting the new vocabulary term addition.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • mpeeters

Poem

🐰 A rabbit dug tunnels through vocabularies deep,
Where RoadDecree treasures were buried and steep.
With folders and values arranged just right,
The migration now hops through the darkness to light! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding missing vocabulary values for the RoadDecree procedure as documented in the PR description.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 URB-3488_fix_vocabularies_values

Review rate limit: 4/5 reviews remaining, refill in 12 minutes.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Products/urban/migration/update_290.py`:
- Around line 375-459: The add_missing_roaddecree_vocabularies migration omits
creating the "roadmissingparts" vocabulary; add provisioning for it by reading
default_values["RoadDecree"]["roadmissingparts"] (e.g. roadmissingparts_config =
default_values["RoadDecree"]["roadmissingparts"]), extract portal_type =
roadmissingparts_config[0] and terms = roadmissingparts_config[1:], then call
createVocabularyFolder(roaddecree_folder, "roadmissingparts", site,
allowedtypes=portal_type) to create roadmissingparts_folder and finally call
createFolderDefaultValues(roadmissingparts_folder, terms, portal_type) just like
the existing missingparts block.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3ada03a6-095b-454a-88fb-2810ac0ce334

📥 Commits

Reviewing files that changed from the base of the PR and between 7281f3f and dec60e6.

📒 Files selected for processing (5)
  • news/URB-3488.feature
  • src/Products/urban/migration/update_290.py
  • src/Products/urban/migration/upgrades_290.zcml
  • src/Products/urban/profiles/default/metadata.xml
  • src/Products/urban/profiles/extra/config_default_values.py

Comment on lines +375 to +459
def add_missing_roaddecree_vocabularies(context):
logger = logging.getLogger("urban: Add RoadDecree buildworktypes vocabulary")
logger.info("starting upgrade steps")
portal_urban = api.portal.get_tool("portal_urban")
roaddecree_folder = getattr(portal_urban, "roaddecree", None)

if roaddecree_folder is None:
logger.warning("RoadDecree config folder not found, skipping")
return

site = api.portal.get()

buildworktypes_config = default_values["shared_vocabularies"][
"folderbuildworktypes"
]
portal_type = buildworktypes_config[0]
terms = buildworktypes_config[2:]
buildworktypes_folder = createVocabularyFolder(
roaddecree_folder, "folderbuildworktypes", site, allowedtypes=portal_type
)
createFolderDefaultValues(buildworktypes_folder, terms, portal_type)

divergences_config = default_values["RoadDecree"]["divergences"]
portal_type = divergences_config[0]
terms = divergences_config[1:]
divergences_folder = createVocabularyFolder(
roaddecree_folder, "divergences", site, allowedtypes=portal_type
)
createFolderDefaultValues(divergences_folder, terms, portal_type)

derogations_config = default_values["RoadDecree"]["derogations"]
portal_type = derogations_config[0]
terms = derogations_config[1:]
derogations_folder = createVocabularyFolder(
roaddecree_folder, "derogations", site, allowedtypes=portal_type
)
createFolderDefaultValues(derogations_folder, terms, portal_type)

investigationarticles_config = default_values["RoadDecree"]["investigationarticles"]
portal_type = investigationarticles_config[0]
terms = investigationarticles_config[1:]
investigationarticles_folder = createVocabularyFolder(
roaddecree_folder, "investigationarticles", site, allowedtypes=portal_type
)
createFolderDefaultValues(investigationarticles_folder, terms, portal_type)

townships_config = default_values["RoadDecree"]["townships"]
portal_type = townships_config[0]
terms = townships_config[1:]
createVocabularyFolder(
roaddecree_folder, "townships", site, allowedtypes=portal_type
)
exemptfdarticle_config = default_values["RoadDecree"]["exemptfdarticle"]
portal_type = exemptfdarticle_config[0]
terms = exemptfdarticle_config[1:]
exemptfdarticle_folder = createVocabularyFolder(
roaddecree_folder, "exemptfdarticle", site, allowedtypes=portal_type
)
createFolderDefaultValues(exemptfdarticle_folder, terms, portal_type)

pebcategories_config = default_values["shared_vocabularies"]["pebcategories"]
portal_type = pebcategories_config[0]
terms = pebcategories_config[2:]
pebcategories_folder = createVocabularyFolder(
roaddecree_folder, "pebcategories", site, allowedtypes=portal_type
)
createFolderDefaultValues(pebcategories_folder, terms, portal_type)

foldercategories_config = default_values["RoadDecree"]["foldercategories"]
portal_type = foldercategories_config[0]
terms = foldercategories_config[1:]
foldercategories_folder = createVocabularyFolder(
roaddecree_folder, "foldercategories", site, allowedtypes=portal_type
)
createFolderDefaultValues(foldercategories_folder, terms, portal_type)

missingparts_config = default_values["RoadDecree"]["missingparts"]
portal_type = missingparts_config[0]
terms = missingparts_config[1:]
missingparts_folder = createVocabularyFolder(
roaddecree_folder, "missingparts", site, allowedtypes=portal_type
)
createFolderDefaultValues(missingparts_folder, terms, portal_type)

logger.info("migration step done!")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Provision roadmissingparts in this upgrade step too.

This migration creates missingparts, but it never creates roadmissingparts, even though default_values["RoadDecree"]["roadmissingparts"] was added in src/Products/urban/profiles/extra/config_default_values.py:3958-3990. Upgraded sites will therefore still miss the road-specific vocabulary and its seeded terms after 2911.

Suggested patch
 def add_missing_roaddecree_vocabularies(context):
     logger = logging.getLogger("urban: Add RoadDecree buildworktypes vocabulary")
     logger.info("starting upgrade steps")
     portal_urban = api.portal.get_tool("portal_urban")
     roaddecree_folder = getattr(portal_urban, "roaddecree", None)
@@
     foldercategories_folder = createVocabularyFolder(
         roaddecree_folder, "foldercategories", site, allowedtypes=portal_type
     )
     createFolderDefaultValues(foldercategories_folder, terms, portal_type)
 
+    roadmissingparts_config = default_values["RoadDecree"]["roadmissingparts"]
+    portal_type = roadmissingparts_config[0]
+    terms = roadmissingparts_config[1:]
+    roadmissingparts_folder = createVocabularyFolder(
+        roaddecree_folder, "roadmissingparts", site, allowedtypes=portal_type
+    )
+    createFolderDefaultValues(roadmissingparts_folder, terms, portal_type)
+
     missingparts_config = default_values["RoadDecree"]["missingparts"]
     portal_type = missingparts_config[0]
     terms = missingparts_config[1:]
     missingparts_folder = createVocabularyFolder(
         roaddecree_folder, "missingparts", site, allowedtypes=portal_type
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Products/urban/migration/update_290.py` around lines 375 - 459, The
add_missing_roaddecree_vocabularies migration omits creating the
"roadmissingparts" vocabulary; add provisioning for it by reading
default_values["RoadDecree"]["roadmissingparts"] (e.g. roadmissingparts_config =
default_values["RoadDecree"]["roadmissingparts"]), extract portal_type =
roadmissingparts_config[0] and terms = roadmissingparts_config[1:], then call
createVocabularyFolder(roaddecree_folder, "roadmissingparts", site,
allowedtypes=portal_type) to create roadmissingparts_folder and finally call
createFolderDefaultValues(roadmissingparts_folder, terms, portal_type) just like
the existing missingparts block.

@WBoudabous WBoudabous requested a review from mpeeters May 4, 2026 12:02
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