Skip to content

refactor(area): stop the area headers leaking names into boost - #7687

Merged
DennisOSRM merged 1 commit into
masterfrom
area-namespaces
Aug 11, 2026
Merged

DennisOSRM merged 1 commit into
masterfrom
area-namespaces

Conversation

@DennisOSRM

Copy link
Copy Markdown
Collaborator

Addresses a review comment on #7161. Small and independent of the area work in flight, so it should go in first; #7684 will rebase on it.

Two headers adapt our types to boost::geometry, and both opened the traits block with

namespace boost::geometry::traits
{
using namespace osrm::extractor::area;

A using-directive at namespace scope in a header is inherited by every translation unit that includes it, and here it lands inside a namespace we do not own.

  • In typedefs.hpp it was not needed at all. Every specialisation in that block is on an osmium:: type.
  • In visibility_graph.hpp it is replaced by naming osrm::extractor::area::VisibilityGraph::Vertex in full.

COEFF goes with it. It was inline constexpr double COEFF = 100.0; declared inside boost::geometry::traits, so a name that generic was being added to boost. It is now osrm::extractor::area::MERCATOR_COEFF, next to the Vertex::point whose scaling it describes.

No behaviour change: same constant, same specialisations, same types.

extractor-tests and util-tests pass, and the four features/foot/area_mesh.feature scenarios pass.

Written with AI assistance: Claude Code, Claude Opus 5 🤖

Copilot AI lite review requested due to automatic review settings August 11, 2026 09:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the area-routing Boost.Geometry trait headers to avoid leaking osrm::extractor::area symbols into boost::geometry::traits via a namespace-scope using namespace in headers. It also relocates the coordinate scaling constant from Boost’s namespace to OSRM’s namespace while keeping the behavior unchanged.

Changes:

  • Remove using namespace osrm::extractor::area; from Boost.Geometry traits blocks in two headers.
  • Move the generic COEFF constant out of boost::geometry::traits and into osrm::extractor::area as MERCATOR_COEFF, updating trait accessors to use the fully qualified name.
  • Update VisibilityGraph::Vertex Boost.Geometry trait specializations to refer to the vertex type with a fully qualified name.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
include/extractor/area/visibility_graph.hpp Moves the Mercator scaling constant into OSRM’s namespace and removes Boost-namespace leakage by fully qualifying the adapted Vertex type.
include/extractor/area/typedefs.hpp Removes an unnecessary using namespace directive from the Boost.Geometry traits block (traits there only specialize osmium:: types).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

🔧 Code Formatting Required

./scripts/format.sh produced changes on this branch.

Option 1 — Download and apply formatting-fixes.zip:

curl -LO https://nightly.link/Project-OSRM/osrm-backend/actions/runs/31478167057/formatting-fixes.zip
unzip formatting-fixes.zip
git apply formatting-fixes.patch

Option 2 — Run locally:

./scripts/format.sh

Then commit the changes.

Both traits blocks opened with `using namespace osrm::extractor::area;`, which every
translation unit that includes the header inherits inside `boost::geometry::traits`.
The one in typedefs.hpp was not needed at all: every specialisation in that block is on
an `osmium::` type. The one in visibility_graph.hpp is replaced by naming
`osrm::extractor::area::VisibilityGraph::Vertex` in full.

`COEFF` moves out with it. It was declared in `boost::geometry::traits`, so a name that
generic was being added to a namespace we do not own; it is now
`osrm::extractor::area::MERCATOR_COEFF`, next to the `Vertex::point` it describes.

Addresses a review comment on #7161.
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.38%. Comparing base (506fac3) to head (b98b18d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7687   +/-   ##
=======================================
  Coverage   94.38%   94.38%           
=======================================
  Files         503      503           
  Lines       39154    39155    +1     
=======================================
+ Hits        36955    36958    +3     
+ Misses       2199     2197    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DennisOSRM
DennisOSRM merged commit c61d159 into master Aug 11, 2026
23 checks passed
@DennisOSRM
DennisOSRM deleted the area-namespaces branch August 11, 2026 13:04
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.

2 participants