launchdarkly / ld-vscode

VSCode extension for LaunchDarkly
https://www.launchdarkly.com
Other
17 stars 8 forks source link

Quick user targeting for myself only #117

Closed kaischroeder closed 8 months ago

kaischroeder commented 9 months ago

Hi,

Thank you so much for this useful extension! I am working with a larger team. Therefore, I can rarely change the general flag status on/off during development - and the toggles per flag with no confirmation dialog feel a little risky. During development I often want to add / remove myself as a targeted user - it would be wonderful to make the checkboxes do this instead of the global toggling. Have you thought about this?

InTheCloudDan commented 9 months ago

Hi @kaischroeder,

We just released 5.0.0 into the Marketplace last week which might have the functionality you're looking for. Our Quick Targeting under LaunchDarkly: Flag Actions looks for a yaml file under .launchdarkly in your home directory, so ~/.launchdarkly/rules/yaml and can add/remove individual context or specific rules to a flag: https://docs.launchdarkly.com/integrations/vscode#quick-targeting

Please let me know if this isn't what you mean and I'd be happy to dive into the confirmation dialog a bit more. My initial thought would be to add it as a configurable option, our goal is to keep friction for developers to a minimum so while I can see this as a good potential guardrail I also don't want to slow down teams that don't need it.

kaischroeder commented 9 months ago

Many thanks for the quick response! This definitely goes into the right direction.

I have tried it but couldn't make it work (but I am not an expert how to define contexts and rules outside of the launchdarkly website). I tried it with the following rules.yaml

rules:
  - name: Myself
    clauses:
      - contextKind: user
        attribute: key
        op: is-one-of
        negate: false
        values:
          - GB...

The rule also appears under Flag Actions - but it fails with error 400. Toggling a flag generally works using the extension otherwise.

I am wondering if this can be further simplified: The current UI still requires quite some mental effort, clicking through all the options. For boolean flags maybe there can be a simpler UI in the future where I don't need to think about which variation (true/false) I need to add to - but instead it's much more like a right click context action similar to "Toggle Flag" but "Toggle Flag Variation for User/Segment".

InTheCloudDan commented 9 months ago

@kaischroeder Can you try changing op from is-one-of to in and then test the rule again? As for:

The current UI still requires quite some mental effort, clicking through all the options. For boolean flags maybe there can be a simpler UI in the future where I don't need to think about which variation (true/false) I need to add to - but instead it's much more like a right click context action similar to "Toggle Flag" but "Toggle Flag Variation for User/Segment".

Can you just confirm that you mean for the LaunchDarkly application UI, and not for instance the VSCode UI?

InTheCloudDan commented 8 months ago

@kaischroeder we added additional information about the targeting schema at: https://docs.launchdarkly.com/integrations/vscode#quick-targeting

I'm going to close out this issue for now, please reopen or create a new issue if you're still running into problems.