Conversation
…y - temporary workaround for Sonar complaint)
… property - temporary workaround for Sonar complaint)" This reverts commit 98b38ac.
…y - avoid unneeded call that could cause IAE
|
Findings outside this diff:
|
I have a problem with that. We should not duplicate informations. This needs to go into oak-doc somewhere (as everything else we have to say about feature toggles). |
Commit-Check ❌ |
Then, this would defeat the very purpose of adding the AGENTS.md file. AI wouldn't be able to read this information from oak-doc |
| AtomicBoolean value = new AtomicBoolean( | ||
| SystemPropertySupplier.create("oak-feature." + name, false). |
There was a problem hiding this comment.
I'm not too happy with this change. One of the goals of the toggle SPI is to provide an abstraction for feature toggles. The SPI is currently independent of any source where the toggle information comes from. Controlling the toggle through system properties is just one option. I'm also a bit concerned there is no way to opt out. This change introduces hard-coded link between system properties and feature toggles. I would prefer an implementation that is opt in if a user wants to control feature toggles through system properties and then maintain that implementation in a differnt package / bundle.
There was a problem hiding this comment.
That's why I waited for your feedback :-)
Hmmm. The initial idea was to make this consistent.
Would it be ok to let the code creating the feature to opt-in using a parameter in newFeature? That way, existing code would remain unaffected. OTOH, letting the toggle to be defaulted from a system property would be made consistent in naming and behavior.
EDIT: hopefully fixed re FeatureToggle vs Feature.
There was a problem hiding this comment.
I should have been more precise. When I wrote "user", I meant someone deploying an application that contains Oak and not Oak code using the toggle SPI.
To me code in Oak using the toggle SPI should not have to know how a Feature is controlled. This is a deployment choice. Some may hook it up to LaunchDarkly or something similar. This requires additional code that interacts with FeatureToggle.
There was a problem hiding this comment.
ok, what this intended to help with is this use case:
new feature toggle added, quickly run tests (locally) without any container
I also have seen cases where in the code, a sysprop is used to initialize the feature toggle. (would need to cehck whether this was a singular case). If that make sense, it would be good to make that pattern consistent.
Well, then our current approach is in total violation of the DRY rule. We can't maintain both. Either let the documentation link to the AGENTS.md file (hoping it is accurate), or find a way to refresh the file when the documentation changes. |
|
@mreutegg - something like this...? |
…y - make it opt in
| } | ||
| } | ||
|
|
||
| @Test |
There was a problem hiding this comment.
Optional (for local consideration only — not pushing code): defaultOverriddenAsTrue / defaultOverriddenAsFalse already cover explicit boolean overrides. For other oak-feature.* values, SystemPropertySupplier uses Boolean.valueOf(String) semantics: only "true" (case-insensitive) enables the toggle; strings like "yes", "garbage", "1", etc. are treated as false, not as a parse error with log-and-fallback. If you want to document that contract in tests, something like:
/**
* SystemPropertySupplier uses {@link Boolean#valueOf(String)} for boolean props: only
* {@code "true"} (case-insensitive) enables the toggle; values like {@code "yes"} or
* {@code "garbage"} are treated as {@code false}, not as a parse error.
*/
@Test
public void defaultOverriddenWithNonTrueValueStaysDisabled() {
String sysPropName = "oak-feature.my.toggle";
for (String value : new String[] {"garbage", "yes", "1", "on", ""}) {
System.setProperty(sysPropName, value);
try (Feature feature = newFeatureWithSystemPropertyDefault("my.toggle", whiteboard)) {
assertFalse("property value '" + value + "' must not enable the toggle", feature.isEnabled());
} finally {
System.clearProperty(sysPropName);
}
}
}|
Findings outside the diff (impact review follow-up) Documentation ( Commit-Check / branch policy — CI still rejects this PR: branch name |
| * <p> | ||
| * The default state of {@code false} can be overridden by a system property | ||
| * using {@linkplain #newFeatureWithSystemPropertyDefault(String, Whiteboard)}, | ||
| * in which case The property name is derived from the toggle name. This helps to quickly verify |
There was a problem hiding this comment.
| * in which case The property name is derived from the toggle name. This helps to quickly verify | |
| * in which case the property name is derived from the toggle name. This helps to quickly verify |
|




No description provided.