-
Notifications
You must be signed in to change notification settings - Fork 188
Add --disable-assertions option to skip all assertions during compilation and execution #2024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add --disable-assertions option to skip all assertions during compilation and execution #2024
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
…tion and execution
09047c6
to
b9ff7c3
Compare
…nstead of excluding them
/gcbrun |
/gcbrun |
operations: [], | ||
tests: [], | ||
notebooks: [], | ||
projectConfig: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should store the value of disableAssertions
here
type: "assertion" | ||
} | ||
], | ||
projectConfig: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
const npmCacheDir = tmpDirFixture.createNewTmpDir(); | ||
const workflowSettingsPath = path.join(projectDir, "workflow_settings.yaml"); | ||
const packageJsonPath = path.join(projectDir, "package.json"); | ||
suite("disable-assertions flag excludes assertions", ({ beforeEach }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also add a test with this flag defined in workflow_settings.yaml
expect(afterFormatCheckResult.stdout).contains("All files are formatted correctly"); | ||
}); | ||
|
||
suite("disable-assertions flag excludes assertions", ({ beforeEach }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests seem to be failing at the moment
Fixes: #1984
Solution
This PR introduces a new
--disable-assertions
command-line flag that allows users to completely disable all assertions during compilation and execution. This includes both manual assertions (defined withtype: "assertion"
) and built-in inline assertions (uniqueKey
,nonNull
, androwConditions
).Key Implementation Details:
CLI Flag: Added
--disable-assertions
option to bothcompile
andrun
commands with the description: "Disables all assertions including built-in assertions (uniqueKey, nonNull, rowConditions) and manual assertions (type: assertion)."Core Integration: The flag is passed through the compilation pipeline:
ProjectConfigOptions.disableAssertions
→ProjectConfig.disableAssertions
→Session.projectConfig.disableAssertions
Assertion Disabling Logic: When disableAssertions is true, all assertions (both manual and inline) are automatically marked as
disabled: true
during their construction phase.Test
Verify that
bazel test //core/...
passesEnsure
./scripts/lint
passesTest the complete workflow by running both
./scripts/run compile --disable-assertions
and./scripts/run run --disable-assertions --dry-run
on a personal project, confirming that:type: "assertion"
) are properly disableduniqueKey
,nonNull
,rowConditions
) are properly disabled