Add new device saves this device when given its localhost address
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- networking
Research direction
Start with NetworkClient.discover_from_address in kolibri/core/discovery/utils/network/client.py and the NetworkClientTestCase tests in kolibri/core/discovery/test/test_network_utils.py; the issue provides a passing reproduction for localhost:8000. Trace how discovered and saved devices are checked against the current instance ID. Done when all acceptance criteria pass, including rejecting the current instance across ports and schemes while adding a different Kolibri in one request.
Written by the indexing model from the issue text.
Description
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch: develop
Observed behavior
- Add new device with
localhost:8000, on a device serving on port 8000, saves this device athttp://localhost:8000/. 127.0.0.1:8000and the LAN address get the field error "Could not connect to this device".NetworkClient.discover_from_addressskips only the URLsget_urls()returns, andlocalhostis never one of them:client.py#L154-L157.- Once saved, the same address is returned from the saved device without a request:
client.py#L109-L125.
Expected behavior
An address that answers /api/public/info/ with this device's own instance ID is refused like 127.0.0.1:8000.
User-facing consequences
Select device lists this device as a source for its own channel and facility imports.
Steps to reproduce
- Sign in as a super admin on a device serving on port 8000.
- Device > Channels > Import > Local network or internet > Continue > Add new device.
- Enter
localhost:8000as Full network address, fill in Name, select Add. - Select device shows the new device.
The same result without a browser, in kolibri/core/discovery/test/test_network_utils.py's NetworkClientTestCase; this passes on develop:
@mock.patch.object(
requests.Session, "request", mock_happy_request("http://localhost:8000/")
)
def test_discover_from_address__returns_own_instance_at_localhost(self):
own_instance_id = InstanceIDModel.get_or_create_current_instance()[0].id
with mock.patch.dict(mock_device_info, {"instance_id": own_instance_id}):
client = NetworkClient.discover_from_address("localhost:8000")
self.assertEqual(client.base_url, "http://localhost:8000/")
Context
- Kolibri develop at
758605b764, Linux, noURL_PATH_PREFIX. - The browser steps ran on #16072's branch at
2d9c5f6274, which returns the same result as develop for this address.
Acceptance Criteria
- Add new device with
localhost:<port>of this device shows "Could not connect to this device" and saves nothing. - A saved device whose instance ID is this device's is not returned by
discover_from_address. - When the entered address reports this device's instance ID, no device at another port or scheme of that host is saved in its place.
- A different Kolibri at an address
get_urls()does not list is still added in one request.
AI usage
Written by rtibblesbot, an LLM-based coding agent running Claude Code, from its browser QA of #16072 and a run of discover_from_address on develop.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 1.1k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 87
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from learningequality/kolibri
-
Setup wizard's "Responsibilities as an administrator" step throws when left within 200 ms of openingOpenAPP: Setup Wizard bug DEV: frontend
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
learningequality/kolibri#16097 ·
Maintainers usually reply within 1 day
-
bug DEV: frontend
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
learningequality/kolibri#16050 ·
Maintainers usually reply within 1 day
-
APP: Learn bug DEV: frontend
Difficulty 2/5 1-3 hours Newbie friendliness 30/100
learningequality/kolibri#16096 ·
Maintainers usually reply within 1 day
-
APP: Learn bug DEV: frontend
Difficulty 4/5 3-5 days Newbie friendliness 35/100
learningequality/kolibri#16095 ·
Maintainers usually reply within 1 day
-
APP: Learn bug DEV: frontend
Difficulty 3/5 1-2 days Newbie friendliness 35/100
learningequality/kolibri#16094 ·
Maintainers usually reply within 1 day
All issues in learningequality/kolibri
Similar issues
-
backend: claude chore dependencies
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
briandconnelly/amicus#606 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
semantica-agi/semantica#2320 ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
vllm-project/vllm-omni#11465 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
jxxghp/MoviePilot#7699 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
vllm-project/vllm-ascend#24010 ·
Maintainers usually reply within 1 day