Skip to content

feat: add signal_type field (optional, inferred) to InterfaceTemplate and PlacedPort - #3120

Open
githappens wants to merge 3 commits into
RackulaLives:mainfrom
githappens:feat/1935-signal-type
Open

feat: add signal_type field (optional, inferred) to InterfaceTemplate and PlacedPort#3120
githappens wants to merge 3 commits into
RackulaLives:mainfrom
githappens:feat/1935-signal-type

Conversation

@githappens

@githappens githappens commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

User description

Closes #1935.

Adds the 10-value SignalTypeSchema from the issue AC, optional signal_type on
InterfaceTemplate and PlacedPort (a placed port's value overrides its template;
both are resolved at read time, mirroring how direction works), an
inferSignalType(type, direction) utility beside inferDirection, and a signal
row in PortTooltip.

Inference covers the connectors whose signal is unambiguous (XLR resolves
mic-vs-line via direction); DMX, ADAT, and other connectors without a taxonomy
value yet return undefined rather than guessing.

Schema changes are additive and backward compatible. SCHEMA_VERSION is left at
1.1: it was introduced earlier this release cycle and has not shipped yet (the
latest tag is still on 1.0), so per the same-release convention this optional,
additive field rides on 1.1 rather than triggering a second bump. A
current-format upgrade-corpus fixture (v26.7.0-signal-type, schema_version 1.1)
exercises the new fields, including an explicit AES3-over-XLR override beating
inference; its sidecar allowlists only the pre-existing rail-position
conversion. The published JSON schema is regenerated.

Not in scope, per the epic split: signal_type on Connection, compatibility
warnings (#1936), and CSV export (#1940).


CodeAnt-AI Description

Show signal type on ports and support explicit signal values

What Changed

  • Ports can now store a signal type in addition to their connector type and direction.
  • Signal type is shown in the port tooltip, using the saved value when present or a sensible inferred value when it is not.
  • Common connectors now infer a signal type automatically, while unclear cases leave the field blank instead of guessing.
  • The app now accepts and validates signal type values in saved layouts and device templates.

Impact

✅ Clearer port details
✅ Less manual signal labeling
✅ Fewer wrong signal assumptions

💡 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 6f124c0 Jul 20, 2026 · 09:39 09:44

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 04fb5122-99a9-4539-afc8-b4e46820de73

📥 Commits

Reviewing files that changed from the base of the PR and between 6f124c0 and 4717a74.

📒 Files selected for processing (8)
  • src/lib/components/PortTooltip.svelte
  • src/lib/schemas/index.ts
  • src/lib/types/index.ts
  • src/lib/utils/port-utils.ts
  • src/tests/fixtures/upgrade-corpus/v26.7.0-signal-type.expected.json
  • src/tests/fixtures/upgrade-corpus/v26.7.0-signal-type.rackula.yaml
  • src/tests/signal-type.test.ts
  • static/schemas/rackula-layout.schema.json

📝 Walkthrough

Walkthrough

Adds optional signal classifications for interface templates and placed ports, inference and labeling utilities, schema definitions, layout schema support, tooltip rendering, tests, and upgrade fixtures.

Changes

Signal Type Feature

Layer / File(s) Summary
Signal type contracts and schemas
src/lib/schemas/index.ts, src/lib/types/index.ts, static/schemas/rackula-layout.schema.json
Defines allowed signal types and adds optional validated signal_type fields to interface templates, placed ports, and layout schema objects.
Signal inference and labels
src/lib/utils/port-utils.ts
Adds signal labels and infers signal types from connector type and direction.
Tooltip display and validation coverage
src/lib/components/PortTooltip.svelte, src/tests/signal-type.test.ts, src/tests/fixtures/upgrade-corpus/*
Displays inferred or explicit signal labels in tooltips and adds inference, labeling, schema, and fixture coverage.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PortTooltip
  participant PlacedPort
  participant port_utils
  PortTooltip->>PlacedPort: Read signal_type, direction, and connector type
  PortTooltip->>port_utils: Infer signal type when needed
  port_utils-->>PortTooltip: Return signal type or no result
  PortTooltip->>port_utils: Convert signal type to label
  port_utils-->>PortTooltip: Return display label
  PortTooltip-->>PlacedPort: Render optional signal row
Loading

Suggested reviewers: ggfevans

Poem

I’m a rabbit with signals to sort,
From mic to HDMI, each finds its port.
A tooltip now whispers what travels inside,
While schemas keep every value allied.
Hop, hop—the rack’s labels grow bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding an optional inferred signal_type field to InterfaceTemplate and PlacedPort.
Description check ✅ Passed The description is directly related to the PR and summarizes the signal_type schema, inference, tooltip, and compatibility changes.
Linked Issues check ✅ Passed The PR satisfies #1935: it adds SignalTypeSchema, optional signal_type fields, inference, tooltip display, and backward-compatible support.
Out of Scope Changes check ✅ Passed The changes stay within the signal_type feature work and supporting schema/tests/fixtures, with no obvious unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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:L This PR changes 100-499 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: 2

🤖 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 110-112: Update the signal label rendering in PortTooltip to
compute getSignalTypeLabel(port) once using a Svelte {`@const`} block, then reuse
that local value for both the conditional check and displayed text.

In `@src/lib/schemas/index.ts`:
- Line 1224: Remove the duplicated exported SignalType inferred type from
SignalTypeSchema in the schemas module, retaining the canonical SignalType
definition from the types module. Update any local references or exports as
needed so consumers continue importing the canonical type without changing
SignalTypeSchema.
🪄 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: 1447ec1d-73bf-4843-8e47-2c02056f5910

📥 Commits

Reviewing files that changed from the base of the PR and between d770ece and 6f124c0.

📒 Files selected for processing (8)
  • src/lib/components/PortTooltip.svelte
  • src/lib/schemas/index.ts
  • src/lib/types/index.ts
  • src/lib/utils/port-utils.ts
  • src/tests/fixtures/upgrade-corpus/v26.7.0-signal-type.expected.json
  • src/tests/fixtures/upgrade-corpus/v26.7.0-signal-type.rackula.yaml
  • src/tests/signal-type.test.ts
  • static/schemas/rackula-layout.schema.json

Comment thread src/lib/components/PortTooltip.svelte
Comment thread src/lib/schemas/index.ts
githappens and others added 3 commits July 20, 2026 11:44
… placed ports

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>
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/1935-signal-type branch from 6f124c0 to 4717a74 Compare July 20, 2026 09:44
Comment on lines +77 to +81
function getSignalTypeLabel(port: InterfaceTemplate): string | null {
const direction =
port.direction ?? inferDirection(port.type, port.mgmt_only);
const signal = port.signal_type ?? inferSignalType(port.type, direction);
return signal ? getSignalLabel(signal) : null;

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.

Suggestion: This computes signal text from an InterfaceTemplate only, so a placed port's signal_type override is never considered in the tooltip. That breaks the new precedence contract (placed override should win over template/inference) and will show incorrect signal labels for overridden ports. Update the tooltip input contract to include the placed port override (or a pre-resolved effective signal) and resolve as placed override → template value → inference. [api mismatch]

Severity Level: Major ⚠️
❌ Port tooltip shows wrong signal for overridden ports.
⚠️ Breaks documented precedence for PlacedPort signal override.
⚠️ Misleads layout users configuring explicit per-port signals.
Steps of Reproduction ✅
1. In `src/lib/components/PortIndicators.svelte:213-223`, each rendered port comes from
`portPositions` entries of the form `{ iface, port, x, y, color }`, where `port` is a
`PlacedPort` and `iface` is the `InterfaceTemplate`.

2. On hover, `handlePortMouseEnter` at `src/lib/components/PortIndicators.svelte:181-192`
calls `showPortTooltip(iface, rect.left + rect.width / 2, rect.top)`, passing only the
`InterfaceTemplate` and not the corresponding `PlacedPort`.

3. The tooltip store in `src/lib/stores/portTooltip.svelte.ts:8-23` defines
`PortTooltipState.port` as `InterfaceTemplate | null` and `showPortTooltip(port:
InterfaceTemplate, x: number, y: number)` assigns this template-only value to the store,
so the tooltip state never contains `PlacedPort` overrides.

4. The tooltip component `src/lib/components/PortTooltip.svelte:15-21` derives `port` from
`getPortTooltipState()` and `getSignalTypeLabel(port: InterfaceTemplate)` at lines 75-81
computes `signal` as `port.signal_type ?? inferSignalType(port.type, direction)`, meaning
it only considers the template `signal_type` field or inference; any `signal_type`
override stored on `PlacedPort` (as documented in `src/lib/types/index.ts:129-143` with
`signal_type?: SignalType` override) has no code path into the tooltip, so when a placed
port’s signal override differs from the template or inferred value, the tooltip still
shows the template/inferred signal and silently ignores the override.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** src/lib/components/PortTooltip.svelte
**Line:** 77:81
**Comment:**
	*Api Mismatch: This computes signal text from an `InterfaceTemplate` only, so a placed port's `signal_type` override is never considered in the tooltip. That breaks the new precedence contract (placed override should win over template/inference) and will show incorrect signal labels for overridden ports. Update the tooltip input contract to include the placed port override (or a pre-resolved effective signal) and resolve as placed override → template value → inference.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, but deferring for this PR. The port tooltip is template-only by existing design: the portTooltip store carries an InterfaceTemplate, and showPortTooltip is invoked with the template (see PortIndicators.svelte). The same gap already exists for the pre-existing PlacedPort.direction override, which getDirectionLabel likewise does not surface in the tooltip. This change deliberately mirrors that behavior; the issue scopes PlacedPort.signal_type as a read-time override, with the override-consuming read paths landing in the follow-up connections work.

The field is persisted and validated end to end: the v26.7.0-signal-type upgrade-corpus fixture round-trips an explicit AES3-over-XLR override. Threading placed-port overrides into the tooltip (for both signal_type and direction, to keep them consistent) is a reasonable follow-up rather than part of this additive-field change.

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.

Customized review instruction saved!

Instruction:

Do not flag missing placed-port overrides in the port tooltip when the tooltip is intentionally template-only; keep tooltip reads aligned with the existing template-only contract and leave placed-port override threading for the follow-up read-path work.

Applied to:

  • src/lib/components/PortTooltip.svelte
  • src/lib/components/PortIndicators.svelte
  • src/lib/stores/portTooltip.svelte.ts

💡 To manage or update this instruction, visit: CodeAnt AI Settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

feat: add signal_type field (optional, inferred) to InterfaceTemplate and PlacedPort

1 participant