Lexpedite / blawx

A user-friendly web-based tool for Rules as Code.
MIT License
96 stars 9 forks source link

No "Add Fact" button on scenario editor for tests where the rule code has been changed a ton #551

Closed foxcoleman closed 12 months ago

foxcoleman commented 1 year ago

I made changes to an old test I created and tried to run it in the scenario editor, but the "Add Fact" button didn't appear on the screen. I created a new test with the same blocks and it worked. I think once a sufficient amount of changes have been made to the rule code, old test interfaces start getting buggy, and need to be trashed. This may have something to do with how the View tab changes well.

Gauntlet173 commented 1 year ago

Hey, @foxcoleman.

Thanks so much for the feedback. I suspect that a big part of what you have run into is a specific version of a problem that has been around for so long it has a single-digit issue in this repo, #7.

There are blocks that generate other blocks. Category declarations generate new object blocks, attribute and relationship declarations generate known attributes and known relationships. And when you use those blocks, they sort of "remember" how they were configured when they were created. If you then go back and change the block that created them, the old blocks aren't updated.

This is particularly problematic when the you changed the name of the relationship, attribute, or category, because it looks fine, but it definitely will generate code that doesn't work.

The workaround is that whenever you make a change to something other than the display text (so the name, or the data types, or the order, etc.) of a block that creates other blocks (a new category block, a new attribute block, or a new relationship block), you need to find all the old versions of the block that have been used, and replace them with new ones.

What is surprising is that nothing showed up in "Add Fact." Even if you had out-of-date blocks in the test, it still should have found the new information and displayed it to you. So that's a bit of a mystery to me. If you still have the copy that doesn't work, upload the exported .blawx file and let me know what version you were running it on. I'd like to see if that's the same problem or a different one.

Also, I'd love to hear about what you're using Blawx for!

Gauntlet173 commented 1 year ago

I've experienced this problem myself when generating fact scenarios inside the Rock Paper Scissors tool, and the error had to do with "order" being undefined when trying to deal with the new_fact_data inside the draw functions.

Gauntlet173 commented 12 months ago

Can't currently reproduce this.. waiting for example code.

foxcoleman commented 12 months ago

MinorWorksOrderBroken.txt I've attached the code here. For section 12(1), note that one of my attributes has a "-" in it. This reliably prevents the "Add Fact" button from appearing. If you replace the "-" with a "_", it works again.

Gauntlet173 commented 12 months ago

OK, if that's the problem it has been resolved in v1.6.18-alpha. If you see the problem again when using that problem or later, create a new issue for it.