Skip to content

Conversation

CalebCourier
Copy link
Collaborator

@CalebCourier CalebCourier commented Mar 11, 2024

Should fix the issue reported in discord: https://discord.com/channels/1085077079697150023/1086092225122926614/1216673781691711509

The only way I was able to reproduce the failure reported there was to add multiple empty newlines to the .guardrailsrc file manually. Since both reporters of this issue were using Windows I assume it has to do with differences in how readlines works between different operating systems. The current fix first filters out any empty lines, then asserts that each line has a key and a value before trying to deconstruct them for assignment. If we still somehow encounter a line with only one item in the tuple after splitting on =, we log a warning and move on. This should reveal any other issues and allow the end user to both debug on their own and include more information when reporting any issues.

Also, since we are now using the logger in the Credentials class which is shared between the cli and library, I send the logger via dependency injection so that we can use the appropriate logger based on the situation. After fixing this, tests regarding multi-processing started failing. I'm not completely sure why these changes triggered those failures, but the root cause of the failures were duplicated logs hence the removal on line 299 of validator_service. I also updated the failing test to be more clear what instances we're comparing in the assertions.

[EDIT]: Forgot to add that this PR also reduces the number of times we're loading credentials from the rc file during the Guard/validation lifecycle. As part of that, I also defaulted to disabling the tracer if not specified. @zsimjee this would make our anonymous metrics opt-in instead of opt-out.

@zsimjee zsimjee merged commit 0aeb410 into main Mar 11, 2024
@ShreyaR ShreyaR deleted the safe-guard-from-rc-file branch March 29, 2024 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants