Skip to content

feat: derive connector gender for display (compute-only) - #3121

Open
githappens wants to merge 2 commits into
RackulaLives:mainfrom
githappens:feat/1944-derive-gender
Open

feat: derive connector gender for display (compute-only)#3121
githappens wants to merge 2 commits into
RackulaLives:mainfrom
githappens:feat/1944-derive-gender

Conversation

@githappens

@githappens githappens commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

User description

Closes #1944.

Adds deriveGender(type, direction) beside inferDirection in port-utils, and a
gender row in PortTooltip. Computed only, per the spike #1927 resolution: no
schema field, no migration, no drift.

Conventions encoded:

  • XLR (xlr-3, xlr-5) per AES14: output = male, female = input; underivable
    without a resolved in/out direction (bidirectional/unset returns undefined).
  • Speakon: male regardless of direction. The convention is physical, not
    directional - chassis connectors (NL4MP family) are male; the mating cable
    end is female; a port models the chassis side.
  • dmx-xlr deliberately underived: DMX512 (ANSI E1.11) reverses AES14
    (transmitters are female), so applying the XLR rule would display the wrong
    gender. Happy to encode the DMX convention in a follow-up if wanted.
  • TRS/TS/RCA and everything else: undefined, per the AC.

Heads-up: PR #3120 (signal_type) also touches PortTooltip.svelte (adds a
signal row in the same spot) and the same port-utils import line - whichever
merges second has a trivial both-sides conflict.


CodeAnt-AI Description

Show derived connector gender in the port tooltip

What Changed

  • The port tooltip now shows connector gender when it can be determined from the port type and direction.
  • XLR ports display Male or Female based on input/output direction, and Speakon ports always display Male.
  • Gender is hidden for connectors where the convention is unclear or should not be guessed, such as TRS, TS, RCA, HDMI, network ports, and DMX XLR.
  • Added tests to cover the supported connector cases and the hidden cases.

Impact

✅ Clearer port details
✅ Fewer wrong connector labels
✅ Faster hardware setup checks

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai

codeant-ai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 66fdffb Jul 20, 2026 · 11:04 11:07

Updated in place by CodeAnt AI · last 5 reviews

@codeant-ai

codeant-ai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a pure connector-gender derivation utility, tests XLR and Speakon mappings plus unsupported cases, and displays derivable gender labels in port tooltips.

Changes

Connector gender display

Layer / File(s) Summary
Gender derivation contract and validation
src/lib/utils/port-utils.ts, src/tests/derive-gender.test.ts
Adds ConnectorGender and deriveGender, with tests for XLR, Speakon, DMX-XLR, and ambiguous connectors.
Tooltip gender rendering
src/lib/components/PortTooltip.svelte
Infers direction when needed, renders a gender row when derivable, and applies shared muted styling.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PortTooltip
  participant inferDirection
  participant deriveGender
  PortTooltip->>inferDirection: resolve port direction when needed
  inferDirection-->>PortTooltip: return effective direction
  PortTooltip->>deriveGender: pass connector type and direction
  deriveGender-->>PortTooltip: return gender label or undefined
  PortTooltip-->>PortTooltip: render gender row when label exists
Loading

Suggested reviewers: ggfevans

Poem

A bunny hops where connectors gleam,
XLRs reveal their gender scheme.
Speakon shines, the tooltip grows,
Ambiguous ports keep secrets close.
“Hop hop!” says the rabbit, “clean and bright—
Computed labels now fit just right!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the PR adds compute-only connector gender derivation for display.
Description check ✅ Passed The description matches the changes and accurately explains the computed-only gender tooltip update.
Linked Issues check ✅ Passed The changes satisfy #1944 by adding deriveGender, showing gender in the tooltip, and covering XLR, Speakon, and ambiguous connectors in tests.
Out of Scope Changes check ✅ Passed No clearly unrelated code changes are introduced beyond the gender derivation and tooltip display work.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Jul 20, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/components/PortTooltip.svelte`:
- Around line 108-110: Update the gender-label rendering block in PortTooltip to
compute getGenderLabel(port) once using Svelte’s {`@const`} tag, then reuse that
local value for both the conditional and displayed text.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: af1a475a-ab22-42c3-bcd2-8015f2a73ea9

📥 Commits

Reviewing files that changed from the base of the PR and between d770ece and 66fdffb.

📒 Files selected for processing (3)
  • src/lib/components/PortTooltip.svelte
  • src/lib/utils/port-utils.ts
  • src/tests/derive-gender.test.ts

Comment thread src/lib/components/PortTooltip.svelte Outdated
githappens and others added 2 commits July 20, 2026 13:42
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Bence Kovács <23636204+githappens@users.noreply.github.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Bence Kovács <23636204+githappens@users.noreply.github.com>
@githappens
githappens force-pushed the feat/1944-derive-gender branch from 66fdffb to 76aad2f Compare July 20, 2026 11:42
@githappens

Copy link
Copy Markdown
Contributor Author

Addressed the CodeRabbit note: getGenderLabel(port) is now computed once via a {@const} at the top of the tooltip block and reused for both the guard and the rendered text, instead of being called twice. Pushed as an amend to the tooltip commit.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/components/PortTooltip.svelte`:
- Around line 102-108: Cache the result of getDirectionLabel(port) with a Svelte
{`@const`} declaration alongside genderLabel, then use that cached value for both
the conditional and rendered direction text in the port tooltip template.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 977ee77a-6e3f-431a-aa7c-b9393fccb6b9

📥 Commits

Reviewing files that changed from the base of the PR and between 66fdffb and 76aad2f.

📒 Files selected for processing (3)
  • src/lib/components/PortTooltip.svelte
  • src/lib/utils/port-utils.ts
  • src/tests/derive-gender.test.ts

Comment thread src/lib/components/PortTooltip.svelte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

feat: derive connector gender for display (compute-only)

1 participant