Skip to content

[Task]: Make Flask a thin web adapter around navigation #79

Open

Description

@simonteague6

Motivation

routes.py currently handles graph loading, error interpretation, identity parsing, floor bounds, and response shape. Flask should translate web inputs into a navigation request and navigation results into a page model, rather than carry domain/data knowledge.

Proposed change

Construct navigation in create_app() and retain it in app.extensions or the established application context. Routes should get building/location options through the navigation interface, turn submitted fields into validated route requests, map domain results/errors to explicit page-model fields, preserve selections on error, and pass explicit floor segments to templates. Remove hard-coded development endpoints such as /api/test unless they are justified.

Affected modules or data

  • app/__init__.py, app/routes.py, templates/page models, and route tests
  • The navigation interface created by the deep-navigation module
  • No CSS redesign, database migration, or new public API version

Acceptance criteria

  • create_app() owns navigation construction.
  • Routes depend only on the navigation interface, not JSON/NetworkX or node-ID parsing.
  • Domain failures produce intentional user-facing responses.
  • Multi-floor results reach the page as explicit segments.
  • Tests inject controlled navigation behavior.
  • Route tests cover missing fields, invalid IDs, same-node, no-route, preference-only failure, success, and multi-floor page models.
  • Hard-coded test endpoints are removed or justified and just check passes.

Testing requirements

Use controlled navigation implementations in Flask/route tests instead of filesystem/global-graph setup. Exercise rendered page models and error preservation.

Dependencies and risks

This depends on the deep-navigation module. Keep it separate from navigation-domain design so both seams can be reviewed independently.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions