pipeworks_mud_mapper.callbacks.validation_callbacks

Validation callbacks for PipeWorks MUD Mapper.

This module provides callbacks for running validation checks on maps and displaying results in a modal dialog. It also writes validation reports to the data/validation/ directory for CI/CD and record-keeping purposes.

Callbacks

update_validate_button_state

Enables/disables the Validate button based on whether a map is loaded.

run_validation

Runs all validation checks, opens the results modal, writes report file.

close_validation_modal

Closes the validation results modal.

select_room_from_validation

Handles clicking on a room ID in validation results to select it on map.

Validation Categories

The validation service checks for three categories of issues:

Connectivity
  • Broken exit references (ERROR - blocks export)

  • Unreachable rooms from spawn (WARNING)

  • Dead-end rooms with no exits (INFO)

Consistency
  • Asymmetric exits (INFO - may be intentional one-way doors)

  • Direction/coordinate mismatches (WARNING)

Language
  • “Upper Landing” problem - vertical words in names that don’t match the navigational direction (INFO)

Severity Levels

  • ERROR: Must be fixed before export (broken references)

  • WARNING: Should be reviewed but may be intentional

  • INFO: Informational - worth noting but likely intentional

See also

-, -, -

Functions

update_validate_button_state(selected_file)

Enable/disable the Validate button based on whether a map is loaded.

run_validation(n_clicks, zone_data, selected_file)

Run validation checks and display results in modal.

close_validation_modal(n_clicks)

Close the validation results modal.

select_room_from_validation(n_clicks_list, id_list)

Handle clicking on a room ID in validation results.

Module Contents

pipeworks_mud_mapper.callbacks.validation_callbacks.update_validate_button_state(selected_file)[source]

Enable/disable the Validate button based on whether a map is loaded.

The Validate button is enabled when a map file is loaded (selected-file is not None). This prevents users from attempting to validate when there’s no data to check.

Parameters:

selected_file (str or None) – Currently selected map ID, or None if no map is loaded.

Returns:

True to disable the button (no file), False to enable (file loaded).

Return type:

bool

pipeworks_mud_mapper.callbacks.validation_callbacks.run_validation(n_clicks, zone_data, selected_file)[source]

Run validation checks and display results in modal.

This callback: 1. Converts the zone data to a MapFile model 2. Runs all validation checks via validation_service 3. Writes a validation report to data/validation/ 4. Opens the modal with formatted results

Parameters:
  • n_clicks (int or None) – Number of times the Validate button has been clicked.

  • zone_data (dict or None) – Current zone data from the store.

  • selected_file (str or None) – Map ID of the currently selected map.

Returns:

(modal_is_open, modal_body_children, validation_report_data) - modal_is_open: True to show the modal - modal_body_children: Formatted validation results - validation_report_data: Report dict for storage

Return type:

tuple

pipeworks_mud_mapper.callbacks.validation_callbacks.close_validation_modal(n_clicks)[source]

Close the validation results modal.

Parameters:

n_clicks (int or None) – Number of times the Close button has been clicked.

Returns:

False to close the modal, or no_update if not clicked.

Return type:

bool or dash.no_update

pipeworks_mud_mapper.callbacks.validation_callbacks.select_room_from_validation(n_clicks_list, id_list)[source]

Handle clicking on a room ID in validation results.

When a user clicks on a room ID in the validation results, this callback: 1. Selects that room on the map 2. Closes the validation modal so the user can see the room

Parameters:
  • n_clicks_list (list) – List of n_clicks values for all room links.

  • id_list (list) – List of ID dictionaries for all room links.

Returns:

(selected_room_id, modal_is_open) - selected_room_id: The room ID that was clicked - modal_is_open: False to close the modal

Return type:

tuple