Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NoResponse option #332

Merged
merged 13 commits into from
Mar 24, 2025
Merged

Add NoResponse option #332

merged 13 commits into from
Mar 24, 2025

Conversation

zalenskivolt
Copy link
Contributor

@zalenskivolt zalenskivolt commented Mar 22, 2025

see IANA CoAP Option Numbers

# Option RFC
258 No-Response [RFC7967 No Server Response][RFC8613 OSCORE]

@zalenskivolt zalenskivolt changed the title Add RFC 7967 NoResponse option Add NoResponse option Mar 22, 2025
@twyatt twyatt changed the title Add NoResponse option Add NoResponse option Mar 22, 2025
Copy link
Member

Choose a reason for hiding this comment

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

I really appreciate the abundance of tests, but I'd like to move away from tests in this file.
As these tests include details about how the page is rendered, which makes these tests delicate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mostly wanted to test the string rendering of the option, but maybe that could be its own much smaller test?

could add tests for all options in MessageTest.kt perhaps?

Copy link
Member

Choose a reason for hiding this comment

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

could add tests for all options in MessageTest.kt perhaps?

That seems like a good home for that. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added in #340 for existing options

@twyatt
Copy link
Member

twyatt commented Mar 22, 2025

Great job on this! 💯

Some changes I've made:

  • promoted RFC links documentation block to a KDoc for Option and reformatted so it renders nicely in the IDE (see screenshot below)
  • added syntax sugar for specifying the responses "not interested in" (see tests for usage examples)

Screenshot 2025-03-22 at 1 35 40 PM

@twyatt twyatt added the minor Changes that should bump the MINOR version number label Mar 22, 2025
Copy link

codecov bot commented Mar 22, 2025

Codecov Report

Attention: Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.

Project coverage is 59.96%. Comparing base (b3f0d52) to head (4c1f45e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
koap-core/src/commonMain/kotlin/Message.kt 86.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #332      +/-   ##
==========================================
+ Coverage   58.91%   59.96%   +1.05%     
==========================================
  Files           8        8              
  Lines         645      662      +17     
  Branches      146      148       +2     
==========================================
+ Hits          380      397      +17     
+ Misses        228      217      -11     
- Partials       37       48      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.


/** [RFC 7967 2.1. Granular Control over Response Suppression](https://tools.ietf.org/html/rfc7967#section-2.1) */
@Suppress("ktlint:standard:no-multi-spaces")
enum class NotInterestedIn(
Copy link
Member

Choose a reason for hiding this comment

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

Although somewhat awkward naming, I went with NotInterestedIn because Suppress clashes with kotlin.Suppress (and would've made usage cumbersome — potentially requiring import aliasing to use).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it matches the RFC nomenclature as well. "Not interested in 2.xx responses.". It uses "disinterest" in 13 places, but "not interested in" is clearer.

@zalenskivolt
Copy link
Contributor Author

  • promoted RFC links documentation block to a KDoc for Option and reformatted so it renders nicely in the IDE (see screenshot below)

I kind of liked having those short descriptions next to the RFC numbers, so you can spot at a glance what the RFC is about. (But nobody seems to do that anywhere. It made the long list of options much more easy to group by subject!)

@twyatt
Copy link
Member

twyatt commented Mar 22, 2025

I kind of liked having those short descriptions next to the RFC numbers, so you can spot at a glance what the RFC is about. (But nobody seems to do that anywhere. It made the long list of options much more easy to group by subject!)

Ya, I did like it, but a lot of the time it was repeating the name (found in column 1), so it felt a little redundant. 🤷
I'm open to changing it back if you feel strongly about it.

@zalenskivolt
Copy link
Contributor Author

zalenskivolt commented Mar 23, 2025

I kind of liked having those short descriptions next to the RFC numbers, so you can spot at a glance what the RFC is about. (But nobody seems to do that anywhere. It made the long list of options much more easy to group by subject!)

Ya, I did like it, but a lot of the time it was repeating the name (found in column 1), so it felt a little redundant. 🤷 I'm open to changing it back if you feel strongly about it.

I can do a separate PR and compare side-to-side 😄

I tried this, to have links of uniform length and just text for description and section number:

RFC Short names

There are only 5 options that do not share RFC with other options (Observe, OSCORE, Hop-Limit, EDHOC, No-Response), and they are even well spread out (so not too distracting).

I tried this

this version is in: zalenskivolt#1

@twyatt twyatt enabled auto-merge (squash) March 24, 2025 17:39
@twyatt twyatt merged commit 30594b0 into JuulLabs:main Mar 24, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Changes that should bump the MINOR version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants