Skip to content

Conversation

@Mr-Stoneman
Copy link

When typing a attribute like services.x only the first 30 solutions would be displayed and the isIncomplete flag was always set to false. Moving the bounds check fixed this and isincomplete can now be true.

Copy link
Member

@inclyc inclyc left a comment

Choose a reason for hiding this comment

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

I don't understand how this fixes the issue. Also, regression tests should be added to ensure that the fix is verified.

@Mr-Stoneman
Copy link
Author

This fixes the issue by checking the size of the vector after adding the last element. What was happening before this was that, there were only 30 Items, because the size was checked before adding a element the max size of Items was 29 and so never hit the 30 need to throw the error.

@Mr-Stoneman
Copy link
Author

I ran the regression test locally, they all passed. I do not know how to add them here sry.

@inclyc
Copy link
Member

inclyc commented Feb 9, 2026

This fixes the issue by checking the size of the vector after adding the last element. What was happening before this was that, there were only 30 Items, because the size was checked before adding a element the max size of Items was 29 and so never hit the 30 need to throw the error.

I see, then let's write some regression tests (like options-incomplete.md in #674), the file should be placed under nixd/tools/nixd/test. Just write markdown files and our test suite will discover it automatically.

@inclyc
Copy link
Member

inclyc commented Feb 9, 2026

This fixes the issue by checking the size of the vector after adding the last element. What was happening before this was that, there were only 30 Items, because the size was checked before adding a element the max size of Items was 29 and so never hit the 30 need to throw the error.

The code you modified appears to emplace items regardless of size. If the addItem method is called unconditionally, shouldn't the vector continue to grow unless an error is explicitly thrown?

When typing a attribute like services.x only the first 30 solutions
would be displayed and the isIncomplete flag was always set to false.
Moving the bounds check fixed this and isincomplete can now be true.
@inclyc inclyc force-pushed the isIncomplete_Patch branch from 72a3bf8 to 86c2238 Compare February 9, 2026 04:18
@inclyc
Copy link
Member

inclyc commented Feb 9, 2026

I just wrote the tests for you, no worries.

@inclyc inclyc changed the title Fixed a bug with isIncomplete nixd/Completion: fix isIncomplete flag handling Feb 9, 2026
@inclyc inclyc added bug Something isn't working nixd:controller labels Feb 9, 2026
@Mr-Stoneman
Copy link
Author

Ty I was struggling with that.

Copy link
Member

@inclyc inclyc left a comment

Choose a reason for hiding this comment

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

The tests passed anyway however I think the real problem here is nixd/lib/Eval/AttrSetProvider.cpp where the options list is truncated but it does not notify the Controller the list is truncated.

// We set this a very limited number as to speedup
if (Response.size() >= MaxItems)
break;

@Mr-Stoneman
Copy link
Author

Regarding the unconditionally growth, the AttrSetProvider.cpp file also has a constexpr int MaxItems = 30; which also impacts the behavior of this bug. As i currently understand it this Maxitems = 30 limits the available Names, that are used to fill the Items

@inclyc
Copy link
Member

inclyc commented Feb 9, 2026

Regarding the unconditionally growth, the AttrSetProvider.cpp file also has a constexpr int MaxItems = 30; which also impacts the behavior of this bug. As i currently understand it this Maxitems = 30 limits the available Names, that are used to fill the Items

So maybe the correct fix is to add a isIncomplete field to AttrSetProvider.cpp though, the Controller is notified that the list it receives is also incomplete, HDYT?

@Mr-Stoneman
Copy link
Author

Sounds reasonable, then you could remove the redundant MaxCompletionSize and only track this in the nixd/lib/Eval/AttrSetProvider.cpp file. Also some of the try catch could be removed as well. To tracking this as a value makes more sense than as a error.

@inclyc
Copy link
Member

inclyc commented Feb 9, 2026

then you could remove the redundant MaxCompletionSize and only track this in the nixd/lib/Eval/AttrSetProvider.cpp file.

No, because not only attrset provider may add items into the completion list.

@Mr-Stoneman
Copy link
Author

Okay didn't know that. So in that case the MaxCompletionSize would still be checked but now at the correct spot and there would be a additional isIncomplete field. But isn't the isIncomplete redundant because the MaxCompletionSize check would already catch this?

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

Labels

bug Something isn't working nixd:controller

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants