Skip to content

Conversation

@Ulthran
Copy link
Contributor

@Ulthran Ulthran commented Jan 28, 2026

Motivation

  • The species page sometimes showed an empty box when a Newick tree was loaded without any visible error, so rendering failures needed to be explicit and debuggable.
  • Improve robustness by normalizing Newick input and surfacing library/load/parse errors in the UI so users and developers can quickly identify the root cause.

Description

  • Add a visible status element above the tree container (#tree-status) that reports loading, success, or error messages to the user.
  • Add client-side validation and normalization of the Newick string (trim and ensure a trailing ;) and log basic diagnostics (console.debug of length and preview).
  • Add checks for the presence of the phylotree library and wrap the render call in a try/catch to display parsing/render errors instead of leaving the container blank.
  • Apply a small formatting change to app/nl_query.py via black (no behavior change) to keep the codebase formatted.

Testing

  • Ran black . which reformatted files and completed successfully.
  • Ran pytest tests/ and all tests passed (9 passed).

Codex Task

Copilot AI review requested due to automatic review settings January 28, 2026 18:24
Copy link
Contributor

Copilot AI left a comment

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 enhances the species tree visualization page by adding comprehensive error handling and diagnostics for phylotree rendering failures. Previously, rendering failures resulted in an empty container with no visible feedback to users.

Changes:

  • Added a visible status element that reports loading, success, or error messages for tree rendering
  • Implemented client-side validation and normalization of Newick strings with diagnostic logging
  • Added error handling for library loading failures and parsing/rendering errors
  • Applied Black formatting to app/nl_query.py (no functional change)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
app/templates/show_species.html Added status element, Newick validation/normalization, library checks, and try-catch error handling for phylotree rendering
app/nl_query.py Applied Black formatting to lambda expression (multi-line wrapping with parentheses)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 56 to 58
const newick = rawNewick.trim().endsWith(";")
? rawNewick.trim()
: `${rawNewick.trim()};`;
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The Newick string is being trimmed twice in the ternary expression. Consider storing the trimmed value in a variable first to avoid redundant operations. For example:

const trimmedNewick = rawNewick.trim();
const newick = trimmedNewick.endsWith(";") ? trimmedNewick : `${trimmedNewick};`;

Copilot uses AI. Check for mistakes.
@Ulthran Ulthran closed this Jan 31, 2026
@Ulthran Ulthran deleted the codex/debug-empty-tree-display-on-show_species.html branch January 31, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant