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

First attempt at refactoring Oracles #2709

Merged
merged 7 commits into from
Sep 6, 2023
Merged

First attempt at refactoring Oracles #2709

merged 7 commits into from
Sep 6, 2023

Conversation

Kukovec
Copy link
Collaborator

@Kukovec Kukovec commented Aug 25, 2023

  • 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
  • Entries added to ./unreleased/ for any new functionality

First step towards #2708.
The PR makes the following changes to https://github.com/informalsystems/apalache/blob/6bb36acc1ad88fdeba21d45b67663b1e792e29c6/tla-bmcmt/src/main/scala/at/forsyte/apalache/tla/bmcmt/rules/aux/Oracle.scala:

  • SymbState is replaced by RewriterScope
  • Method names/parameters are renamed to be more verbose, but also more descriptive
  • Exception previously thrown by each implementation individually has been pushed into the base trait
  • Signature of caseAssertions has been changed such that the optional sequence is now an Option, instead of treating the empty sequence as a special case.
  • Signature of getIndexOfOracleValueFromModel (previously evalPosition) has been changed, to no longer include state. Upon inspection, none of the oracle implementations ever accessed this parameter.

IntOracle is implemented with the changes above as a prototype. Note that tests are currently missing for the IntOracle, and will be added in a subsequent PR.

@Kukovec Kukovec requested review from thpani, konnov and shonfeder August 25, 2023 15:03
@Kukovec Kukovec requested a review from rodrigo7491 as a code owner August 25, 2023 15:03
@codecov-commenter
Copy link

codecov-commenter commented Aug 25, 2023

Codecov Report

Merging #2709 (530ec1b) into main (9b5c1fe) will increase coverage by 0.01%.
The diff coverage is 94.73%.

@@            Coverage Diff             @@
##             main    #2709      +/-   ##
==========================================
+ Coverage   78.51%   78.53%   +0.01%     
==========================================
  Files         461      463       +2     
  Lines       15885    15904      +19     
  Branches     2609     2590      -19     
==========================================
+ Hits        12472    12490      +18     
- Misses       3413     3414       +1     
Files Changed Coverage Δ
.../bmcmt/stratifiedRules/aux/oracles/IntOracle.scala 90.00% <90.00%> (ø)
...tla/bmcmt/stratifiedRules/aux/oracles/Oracle.scala 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@konnov konnov left a comment

Choose a reason for hiding this comment

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

This is a nice PR. It looks nice, structured, and extremely well commented. How about adding a bunch of unit tests?

* An oracle that uses an integer variable. Although using integers as an oracle is the most straightforward decision,
* do not use this oracle by default. It is handy, when reasoning about sequences.
*
* TODO: add tests
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about adding tests? :)

This should be super-easy with the new design. Just a bunch of unit tests

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, I sort of ran out of time before PI week, but yes, adding tests is on my todo list

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.

Looks great, I really appreciate the clarity in code + docs!

Could we add the missing unit tests here? It would make for a more self-contained PR.

Kukovec and others added 2 commits September 4, 2023 16:02
@Kukovec Kukovec requested review from thpani and konnov September 6, 2023 12:04
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

@Kukovec Kukovec merged commit 72e0965 into main Sep 6, 2023
10 checks passed
@Kukovec Kukovec deleted the jk/oracles_1 branch September 6, 2023 13:39
@Kukovec Kukovec mentioned this pull request Oct 20, 2023
4 tasks
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.

4 participants