Skip to content

Conversation

@joyceerhl
Copy link

For #12146

Note that we still need to enable this experiment in Control Tower before this PR can be merged.

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).
  • The wiki is updated with any design decisions/details.

@joyceerhl joyceerhl added the no-changelog No news entry required label Jul 2, 2020
Copy link

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

:shipit:

@joyceerhl
Copy link
Author

joyceerhl commented Jul 2, 2020

Oops. @rchiodo @IanMatthewHuff @DavidKutu I just set up the experiment in Control Tower and tested locally, and the code we currently have will show the 'Trusted' message for all users who are not enrolled in the experiment. Should we show the user anything related to trusted notebooks at all if the feature is turned off?

@rchiodo
Copy link

rchiodo commented Jul 2, 2020

No it should show nothing until the experiment is activated.

Copy link

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

🕐


@injectable()
export class TrustService implements ITrustService {
public get experimentEnabled() {
Copy link

Choose a reason for hiding this comment

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

This feels like your overcomplicating stuff for the experiment. I think it would be better to put all the interfaces back the way they were, and just pass a flag to the UI on whether or not to show the 'trust' part. We do this for the 'useCustomEditor' stuff too.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah agreed, the only reason I didn't do that to start with was that we'd need to send that shouldShowTrustMessage flag over with the cells, which means updating all the redux stuff. I think it ends up being the same number of files that need to be changed.

Also, this experimentEnabled stuff is inside trustService because I didn't want nativeEditor.ts to have to query the exp service to get the value of the shouldShowTrustMessage flag and send it over. My thought was that whether the experiment is enabled is a property of the trustService class, so we should read it off that. But I can see that this exposes more stuff on the public interface, so I'm happy to drop these changes.

Copy link

Choose a reason for hiding this comment

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

The implicit 'undefined' meaning not enabled was really my biggest concern. That was a new implicit idea in the code that isn't easy to understand.

TrustService exposing experiment enabled was less smelly IMO but still seemed off. There's an experiment service. Why would the TrustService expose something to do with experiments? Your then exposing the concept of an experiment where none is needed.

The UI does need to know about the experiment though, so somebody has to tell it. I think it makes sense for the nativeEditor.ts class to do that. It controls the UI and would make other decisions based on experiments to tell the UI.

Choose a reason for hiding this comment

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

I agree, also not sure about the tri state of trusted using that to determine whether trust=undefined means not in experiment.
I'd just default to true everywhere and not display the UI as @rchiodo has suggested.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah it ended up being the exact same number of files changed (14) but what I had before was definitely harder to follow. Thanks guys 😊

setSharedProperty('ds_notebookeditor', e?.type);
this.nativeContext.set(!!e).ignoreErrors();
this.isNotebookTrusted.set(e?.model?.isTrusted === true).ignoreErrors();
this.isNotebookTrusted.set(e?.model?.isTrusted !== false).ignoreErrors();

Choose a reason for hiding this comment

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

Suggested change
this.isNotebookTrusted.set(e?.model?.isTrusted !== false).ignoreErrors();
this.isNotebookTrusted.set(e?.model?.isTrusted).ignoreErrors();

Isn't this the same?

Choose a reason for hiding this comment

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

Else the context variable gets set to true, which would be incorrect based on your comments.
I.e.

  • trusted = true (then yes)
  • trusted = false (then no)
  • trusted = undefined (then not used).

Shouldn't the same logic apply to this context variable?

Copy link
Author

Choose a reason for hiding this comment

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

If trusted=undefined we want to show all commands for editing notebooks, so the context variable should be set to true. But I agree with Rich and I'm reverting these changes, will check in new code shortly


@injectable()
export class TrustService implements ITrustService {
public get experimentEnabled() {

Choose a reason for hiding this comment

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

I agree, also not sure about the tri state of trusted using that to determine whether trust=undefined means not in experiment.
I'd just default to true everywhere and not display the UI as @rchiodo has suggested.

@joyceerhl joyceerhl requested review from DonJayamanne and rchiodo July 3, 2020 00:20
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 3, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@joyceerhl joyceerhl marked this pull request as ready for review July 5, 2020 06:29
Copy link

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

:shipit:

@joyceerhl joyceerhl merged commit f2c229e into microsoft:master Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog No news entry required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants