[Bug] Constraints not enforced where `workspace_field ` is absent
See original GitHub issue- I’d be willing to implement a fix
Describe the bug
Creating a constraint using the query predicate to enforce the fact for workspace manifests where a field does not exist.
Running yarn constraints
does not enforce the constraint.
To Reproduce Seem minimal reproduction here https://github.com/theseyi/constraints
- init a yarn workspace with one workspace package
packages/package-a
and the workspace root - import the constraint plugin
yarn plugin import constraints
- touch a constraints.pro file and add in the following constraint
- attempt to enforce the constraint with
yarn constraints
% enforce workspace packages without a workspace field to have a scripts.test field
gen_enforced_field(WorkspaceCwd, 'scripts.test', 'someValue') :-
workspace_field(WorkspaceCwd, 'workspaces', null).
Reproduction
// in workspace root
{
"name": "constraints",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"workspaces": [
"packages/*"
]
}
// in packages/package-a
{
"name": "package-a",
"version": "1.0.0",
"main": "index.js",
"license": "MIT"
}
% enforce workspace packages without a workspace field to have a scripts.test field
gen_enforced_field(WorkspaceCwd, 'scripts.test', 'someValue') :-
workspace_field(WorkspaceCwd, 'workspaces', null).
Expected:
➤ YN0037: package-a must have a field scripts.test set to someValue, but doesn't
➤ YN0000: Failed with errors in 0s 18ms
IMPORTANT: We strongly prefer reproductions that use Sherlock. Please check our documentation for more information: https://yarnpkg.com/advanced/sherlock
Unable to use Sherlock here since I’m not familiar with running it over prolog
Environment if relevant (please complete the following information):
- OS:
macos
- Node version
v12.20.1
- Yarn version
2.4.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
New Workspace Field Type: Count Fields
In our next release, we're introducing a new type of custom workspace field that tallies data from other fields in native or dynamic ......
Read more >San Diego Patch 1 - Product Documentation | ServiceNow
How search works: Punctuation and capital letters are ignored. Special characters like underscores (_) are removed.
Read more >BUI for Administrators - Oracle Help Center
Note that the Chat workspace is not customizable for the Agent Browser UI. ... An arrow on a workspace field or control that...
Read more >MySQL Bugs: #57904: Missing constraint from information ...
Bug #57904, Missing constraint from information schema ... This is the output from 5.5.7 followed by the output from 5.1.52.
Read more >Bug List
27290, Platform, User Ass, platform-help-inbox, CLOS, WONT, ISC: The Toggle navigator key is missing on the content toolbar, 2002-12-03.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You can update your constraint to check that it has any value and then negate it to get the result you’re after
Sure, will get to it today, thanks for following up