Skip to content

fix: name the interface and the reference in topology errors - #22

Merged
marcinpsk merged 1 commit into
developfrom
fix/error-subjects
Sep 15, 2026
Merged

marcinpsk merged 1 commit into
developfrom
fix/error-subjects

Conversation

@marcinpsk

@marcinpsk marcinpsk commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

A rejected inventory reported "unknown controller interface" or "unknown
lower interface" without saying which interface carried the bad reference.
The monitor logs the message unchanged, so the journal did not name the
subject either, and a reader had to reproduce the whole inventory to find
the interface at fault.

Every rejection now names the interface that carries the bad reference and
the reference that failed. Nine failure classes each have their own message
and their own test: invalid index, empty name, duplicate index, duplicate
name, unknown controller, missing lower sub-layer, unknown lower sub-layer,
remote lower sub-layer, and a self reference as controller or as lower
sub-layer.

The final pass that rejected a relationship with two equal indices is gone.
Each of the three sites that inserts a relationship now guards the equality
itself, so the message can name the interface. Those three sites are the
only way to create a relationship, so the guards cover the same inputs.

The lower sub-layer reference is now read before the network namespace
check. An interface with no reference and a namespace identifier reports
the missing reference instead of the namespace. Both inputs are still
rejected.

Interface names come from netlink, so every message renders them with the
Debug format. A name that carries a newline or a terminal escape stays
quoted data on one line.

Validation stays atomic. One bad reference rejects the whole inventory, and
no partial topology reaches the table.

Closes #18

Summary by CodeRabbit

  • Bug Fixes
    • Improved topology validation for invalid interface indices, names, duplicates, controller references, and lower-layer references.
    • Invalid self-referential controller and lower-layer links, including VXLAN underlays, are now rejected.
    • Error messages now identify the affected interface and validation issue more clearly.

A rejected inventory reported "unknown controller interface" or "unknown
lower interface" without saying which interface carried the bad reference.
The monitor logs the message unchanged, so the journal did not name the
subject either, and a reader had to reproduce the whole inventory to find
the interface at fault.

Every rejection now names the interface that carries the bad reference and
the reference that failed. Nine failure classes each have their own message
and their own test: invalid index, empty name, duplicate index, duplicate
name, unknown controller, missing lower sub-layer, unknown lower sub-layer,
remote lower sub-layer, and a self reference as controller or as lower
sub-layer.

The final pass that rejected a relationship with two equal indices is gone.
Each of the three sites that inserts a relationship now guards the equality
itself, so the message can name the interface. Those three sites are the
only way to create a relationship, so the guards cover the same inputs.

The lower sub-layer reference is now read before the network namespace
check. An interface with no reference and a namespace identifier reports
the missing reference instead of the namespace. Both inputs are still
rejected.

Interface names come from netlink, so every message renders them with the
Debug format. A name that carries a newline or a terminal escape stays
quoted data on one line.

Validation stays atomic. One bad reference rejects the whole inventory, and
no partial topology reaches the table.

Closes #18
@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 1278ed21-456f-4363-abf0-531b158a16f2

📥 Commits

Reviewing files that changed from the base of the PR and between af0244f and 2039bab.

📒 Files selected for processing (1)
  • src/link.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

Topology::from_observed now validates interface identity and topology references with contextual InvalidData errors. Tests cover each validation class and assert exact messages.

Changes

Topology validation

Layer / File(s) Summary
Interface and relationship validation
src/link.rs
Topology::from_observed validates indices, names, duplicate entries, controller references, lower-layer references, and self-references. The invalid helper accepts values convertible to String.
Focused validation tests
src/link.rs
Tests cover malformed indices, names, controllers, lower layers, remote references, and self-references. Each test checks the error kind and exact message.

Priority: ⬇️ Low

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

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 2039b

The validation changes retain rejection for malformed required relationships and do not show an actionable merge risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: adding interface and reference names to topology validation errors.
Linked Issues check ✅ Passed Issue #18 requires nine distinct topology validation failure classes to identify the offending interface and failed reference. The reviewed src/link.rs implementation emits distinct messages for inv…
Out of Scope Changes check ✅ Passed The reported changes are confined to topology validation and its tests. The relationship insertion guards, lower-reference check ordering, and Debug formatting support the validation objectives or pre…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/error-subjects
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/error-subjects

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

A rabbit checks each link in line
Names and numbers now align
Bad layers stop at topology’s gate
Clear errors mark the faulty state
The stack grows clean, precise, and bright

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

@marcinpsk

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@marcinpsk
marcinpsk merged commit 01dcd11 into develop Sep 15, 2026
11 checks passed
@marcinpsk
marcinpsk deleted the fix/error-subjects branch September 15, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant