Skip to content

Can commit faulty code? #13424

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

Closed
wants to merge 3 commits into from
Closed

Conversation

privat
Copy link
Contributor

@privat privat commented Apr 13, 2023

How far can faulty code goes?

  • installing a faulty method. OK.
    Note this require direct call to OpalCompiler or other MOP facility.
    Editors won't let you install any faulty methods.
  • Creating a commit.
    Iceberg has no issue to commit the method.
    However, there is a #error critique ReMethodHasSyntaxErrorRule, so you cannot push faulty code unwillingly :)
    • Can faulty code mess with the serialization format (tonel or whatever) and corrupt the file?
      Note that file corruption should already be handled, as bad command-line file edition can happen.
      But I don't know is the serialization format is fragile if the method contains garbage.
      → I checked, It seems that yes, the format is very fragile. It uses an ad hoc scanner and expect the content to be well-formed. This is bad because 1. it is uselessly complex code 2. it forces it to be synchronized with the language features (e.g. new literals or something) 3. it's limiting.
  • Removing the faulty method (switch to a sane branch). Unloading the code was ok.
  • Checkout back the branch with the faulty method
    • The diff is shown in the "preview", with the syntax error visible in the diff, but nothing is done to alert you.
      However, up to my knowledge, Iceberg never tries to warn you on the diff anyway. So full check mark here.
    • Proceeding "checkout" works until it shows a CodeError debugger.
      Inspection of the syntax error is "manual" but easy (just inspect self). While it could be improved, it is much better than the awful syntax error debugger I removed at the beginning of Pharo12 (Kill syntax error debugger #12910). So full check mark here.
    • Closing the debugger, cancel the checkout.
      Since there is nothing else in the commit, I don't know if the system is left in the middle or if there is some kind of transaction/rollback. However, this is a "classic" iceberg issue of fault handling and not specifically related to faulty code with syntax errors, so full check mark here
    • Proceeding "checkout" again, bring the same debugger, Now I "proceed ▶️" (the button is green because CodeError are resumable) and the faulty method is installed. The idea is that you can fix it at your own pace.
  • Code change. Go to Epicea and try to "Revert..." the faulty method.
    Epicea show you the diff and ask you to confirm. All fine and it revert the bad method
  • Return to the code change. Try to "Apply..." the faulty method.
    Epicea show you the diff and ask you to confirm. But a growl (popup infobox in the lower left corner of the screen) show you the description of the CodeError, instead of launching a debugger. Why? Why you failed me Epicea?
    fixed by EpiceaBrowsers: stop catching all errors #13425

I'm quite happy about the current status.

@privat
Copy link
Contributor Author

privat commented Apr 13, 2023

Task failed successfully.

Some Unicode issues, but overall a very acceptable outcome!

Syntax Error on line 1: 'Unknown character'

===========================================

1: faultySource ^ 1+¿

                   _^_

CodeError:RBSyntaxErrorNotice OpalCompilerTest>>#faultySource 18:Unknown character->¿

@privat
Copy link
Contributor Author

privat commented Apr 14, 2023

Experiment conclusive. Enhancement proposed at the tonel repository to close the last remaining checkbox. pharo-vcs/tonel#108

@privat privat closed this Apr 14, 2023
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.

1 participant