inmanta / inmanta/std

std::ipv4_network validation error not correctly reported

Open
#619 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

usability
Dominant language
Python
Stars
0
Forks
6
Avg merge
12h 25m
Merged PRs (30d)
5

Description

I encountered an error while trying to set an ipv4 network on an entity:

Invalid value '172.25.103.22/24', does not match constraint `std::validate_type('ipaddress.IPv4Network',self)

But after some more investigation, it seems I forgot to use the network address. This was not correctly reported by the compiler. When I test the actual python type I get this:

>>> ipaddress.IPv4Network("172.25.103.22/24")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.12/ipaddress.py", line 1544, in __init__
    raise ValueError('%s has host bits set' % self)
ValueError: 172.25.103.22/24 has host bits set

This would be good to report this in the compiler output error. Here is the minimal example I used to reproduce the error:

entity A:
    std::ipv4_network net
end
implement A using std::none

A(net="172.25.103.22/24")

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal entity A example in the issue and trace the std::validate_type('ipaddress.IPv4Network', self) validation path. Reproduce the host-bits error for 172.25.103.22/24 and identify how compiler validation errors are formatted; done means the compiler output reports that the IPv4 network has host bits set.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.