Skip to content
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

Add the option --features #1648

Merged
merged 20 commits into from
Apr 26, 2022
Merged

Add the option --features #1648

merged 20 commits into from
Apr 26, 2022

Conversation

konnov
Copy link
Collaborator

@konnov konnov commented Apr 20, 2022

Closes #1647. As discussed in #401, this PR introduces the option --features that lets us pass experimental features to the tool. The only supported feature in rows, which is parsed as RowsFeature. When we want to add new features, we have to extend the trait Feature with a case class and update the parser in General.

For the moment, I am not adding any documentation to the user manual. I will extend the manual section on types, when we start the transition period to Type System 1.2.

  • Tests added for any new code
  • Ran make fmt-fix (or had formatting run automatically on all files edited)
  • Documentation added for any new functionality
  • Entry added to UNRELEASED.md for any new functionality

@konnov konnov requested review from shonfeder, thpani, bugarela, Kukovec and rodrigo7491 and removed request for shonfeder April 20, 2022 09:48
@konnov konnov changed the title Support for the option --features Add the option --features Apr 20, 2022
Copy link
Collaborator

@thpani thpani left a comment

Choose a reason for hiding this comment

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

Code LGTM, but I think we should discuss how this will evolve once the feature becomes stable. Do you have a plan for that?

UNRELEASED.md Outdated
Comment on lines 19 to 23
* Fix references to `--tune-here` (actually `--tuning-options`), see #1579
* Fix references to `--tune-here` (actually `--tuning-options`), see #1579
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should either not commit these, or have a convention on file ending newlines.

Comment on lines 39 to 40
| - rows: enable row typing as explained in ADR-014
|""".stripMargin)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Won't this print an extra newline?

Suggested change
| - rows: enable row typing as explained in ADR-014
|""".stripMargin)
| - rows: enable row typing as explained in ADR-014""".stripMargin)

@codecov-commenter
Copy link

codecov-commenter commented Apr 20, 2022

Codecov Report

Merging #1648 (20c8b55) into unstable (b96c73a) will decrease coverage by 0.09%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##           unstable    #1648      +/-   ##
============================================
- Coverage     75.00%   74.90%   -0.10%     
============================================
  Files           356      357       +1     
  Lines         11597    11611      +14     
  Branches        552      553       +1     
============================================
- Hits           8698     8697       -1     
- Misses         2899     2914      +15     
Impacted Files Coverage Δ
.../src/main/scala/at/forsyte/apalache/tla/Tool.scala 0.00% <0.00%> (ø)
.../at/forsyte/apalache/tla/tooling/opt/General.scala 0.00% <0.00%> (ø)
...n/scala/at/forsyte/apalache/io/ConfigManager.scala 0.00% <0.00%> (ø)
...in/scala/at/forsyte/apalache/tla/lir/Feature.scala 0.00% <0.00%> (ø)
...he/io/annotations/parser/CommentPreprocessor.scala 95.60% <0.00%> (-1.10%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b96c73a...20c8b55. Read the comment docs.

Copy link
Collaborator

@thpani thpani left a comment

Choose a reason for hiding this comment

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

LGTM (modulo fixing the output on that failing integration test)

Shon Feder and others added 9 commits April 21, 2022 13:54
I'm not sure why the mdx wildcard matching wasn't working as expected,
but I think this test is as clear.

The `ERROR` output was actually spurious, afaict, because CLI parsing
errors are handled before we ever get to Apalache's internal tool
executable error handling.
Moving the name and description into the `Feature` trait lets us ensure
the inline documentation is up to date.

Moving the conversion into the case class lets us reuse this logic in
the configuration manager.
There's no need to call `ConfigManager` outside of `outputAndLogConfig`
since its result is only used in the body of the latter.
Under the assumption that:

- We shouldn't start measuring model checking time while setting up the
  output and processing configs.
- We want to be able to reflect configuration failures in the exit code.
- We don't need comments that repeat the name of functions.
Prior to this change errors resulting from invalid Apalache
configuration files were resulting in uncaught exceptions.

Now we return an `Either` from the configuration loading, and use that
to determine whether we should continue running the command or report a
configuration error.
The full error looks something like

```
22:00:34.534 [main] ERROR at.forsyte.apalache.tla.Tool$ - Configuration error: at 'features.0':
  - (/home/sf/Sync/informal-systems/apalache/apalache-core/test/tla/./.apalache.cfg: 1) Cannot convert 'invalid-feature' to at.forsyte.apalache.tla.lir.Feature: .
EXITCODE: ERROR (255)
```

We truncate it in the integration test to avoid platform-specific
information breaking the integration tests.
Hopefully will account for stderr output from docker container
…neral.scala

Co-authored-by: Thomas Pani <thomas@informal.systems>
Copy link
Contributor

@shonfeder shonfeder left a comment

Choose a reason for hiding this comment

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

Leaving a note that I have requested a change set via #1652

@thpani
Copy link
Collaborator

thpani commented Apr 26, 2022

Leaving a note that I have requested a change set via #1652

@shonfeder quick workflow question: I think we don't necessarily need to block on this?
It should be fine to review #1652 against this branch, then rebase it on unstable once this PR gets merged?

@shonfeder shonfeder merged commit 2ef78c2 into unstable Apr 26, 2022
This was referenced May 2, 2022
@shonfeder shonfeder deleted the ik/features1647 branch May 9, 2022 03:49
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.

Introduce a facility for enabling experimental features
5 participants