Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ jobs:
- name: Verify published artifact boundaries
run: bash scripts/verify-artifacts.sh

- name: Execute packaged SDK consumer
run: bash scripts/test-runtime-minimum.sh ${{ matrix.java }}

- name: Check README initialization
run: bash scripts/test-readme-initialization.sh

example:
name: Featurevisor example-1
runs-on: ubuntu-latest
Expand Down Expand Up @@ -72,7 +78,7 @@ jobs:
run: |
mkdir example-1
cd example-1
npx --yes @featurevisor/cli@3 init --example=1
npx --yes @featurevisor/cli@latest init --example=1
npm install
npx featurevisor build
npx featurevisor test --onlyFailures
Expand Down
17 changes: 1 addition & 16 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,8 @@ jobs:
id: version
shell: bash
run: |
if [[ ! "$GITHUB_REF_NAME" =~ ^v4\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
echo "Expected a Featurevisor Java v4 semantic version tag" >&2
exit 1
fi
bash scripts/verify-release.sh "$GITHUB_REF_NAME"
version="${GITHUB_REF_NAME#v}"
if ! grep -Fq "<revision>$version</revision>" pom.xml; then
echo "Tag $GITHUB_REF_NAME does not match the Maven revision" >&2
exit 1
fi
if ! grep -Fq "<version>$version</version>" README.md; then
echo "README installation version does not match $GITHUB_REF_NAME" >&2
exit 1
fi
if ! grep -Fq "version = \"$version\"" featurevisor-sdk/src/main/java/com/featurevisor/cli/CLI.java; then
echo "CLI version does not match $GITHUB_REF_NAME" >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Publishing Featurevisor Java $version"

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
24
461 changes: 287 additions & 174 deletions README.md

Large diffs are not rendered by default.

264 changes: 264 additions & 0 deletions conformance/openfeature-provider.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
{
"kind": "featurevisor.openfeature-provider",
"schemaVersion": 1,
"datafile": {
"schemaVersion": "2",
"revision": "provider-conformance",
"segments": {},
"features": {
"checkout": {
"bucketBy": "userId",
"variations": [
{ "value": "on", "variables": { "config": "{\"enabled\":true}", "nullable": "null" } }
],
"variablesSchema": {
"config": { "type": "json", "defaultValue": "{}" },
"nullable": { "type": "json", "defaultValue": "null" }
},
"force": [
{
"conditions": { "attribute": "userId", "operator": "equals", "value": "forced" },
"enabled": true,
"variation": "on"
}
],
"traffic": [{ "key": "all", "segments": "*", "percentage": 100000, "variation": "on" }]
},
"disabled": {
"bucketBy": "userId",
"variations": [],
"force": [
{
"conditions": { "attribute": "blocked", "operator": "equals", "value": true },
"enabled": false
}
],
"traffic": []
},
"accountTargeted": {
"bucketBy": "accountId",
"variations": [],
"force": [
{
"conditions": { "attribute": "accountId", "operator": "equals", "value": "" },
"enabled": true
}
],
"traffic": []
},
"targetOnly": {
"bucketBy": "userId",
"variations": [],
"force": [
{
"conditions": { "attribute": "userId", "operator": "equals", "value": "forced" },
"enabled": true
}
],
"traffic": []
},
"conditional": {
"bucketBy": "userId",
"conditions": { "feature": "checkout", "enabled": false },
"traffic": [{ "key": "all", "conditions": "*", "percentage": 100000 }]
}
},
"variables": {
"settings": { "type": "json", "defaultValue": "{\"region\":\"eu\"}" },
"nullable": { "type": "json", "defaultValue": "null" },
"settingsAlias": { "type": "json", "compose": "settings" },
"jsonText": { "type": "json", "defaultValue": "\"null\"" },
"jsonTextAlias": { "type": "json", "compose": "jsonText" },
"screen": {
"type": "object",
"compose": [
{ "key": "enabled", "feature": "checkout" },
{ "key": "settings", "variable": "settings" }
]
},
"restricted": {
"type": "boolean",
"defaultValue": true,
"disabledValue": false,
"conditions": { "attribute": "allowed", "operator": "equals", "value": true }
},
"screenOverride": {
"type": "object",
"compose": "screen",
"overrideProgram": [
{
"key": "regional",
"conditions": "*",
"operations": [{ "op": "set", "path": ["settings", "region"], "value": "us" }],
"onMatch": 1,
"onMiss": 1
}
]
},
"brokenAlias": { "type": "object", "compose": "brokenAlias" }
}
},
"cases": [
{
"name": "forced flag",
"flagKey": "checkout",
"type": "boolean",
"default": false,
"context": { "targetingKey": "forced" },
"expected": { "value": true, "reason": "TARGETING_MATCH" }
},
{
"name": "variation selector",
"flagKey": "checkout:variation",
"type": "string",
"default": "fallback",
"context": { "targetingKey": "forced" },
"expected": { "value": "on", "reason": "TARGETING_MATCH", "variant": "on" }
},
{
"name": "feature JSON",
"flagKey": "checkout:config",
"type": "object",
"default": {},
"context": { "targetingKey": "forced" },
"expected": { "value": { "enabled": true } }
},
{
"name": "global JSON",
"flagKey": "variable:settings",
"type": "object",
"default": {},
"context": {},
"expected": { "value": { "region": "eu" }, "reason": "DEFAULT" }
},
{
"name": "feature JSON null",
"flagKey": "checkout:nullable",
"type": "object",
"default": { "fallback": true },
"context": { "targetingKey": "forced" },
"expected": { "value": { "fallback": true } }
},
{
"name": "global JSON null",
"flagKey": "variable:nullable",
"type": "object",
"default": { "fallback": true },
"context": {},
"expected": { "value": { "fallback": true }, "reason": "DEFAULT" }
},
{
"name": "disabled flag",
"flagKey": "disabled",
"type": "boolean",
"default": true,
"context": { "blocked": true },
"expected": { "value": false, "reason": "TARGETING_MATCH" }
},
{
"name": "missing flag",
"flagKey": "missing",
"type": "boolean",
"default": false,
"context": {},
"expected": { "value": false, "reason": "ERROR", "errorCode": "FLAG_NOT_FOUND" }
},
{
"name": "type mismatch",
"flagKey": "checkout:config",
"type": "string",
"default": "fallback",
"context": { "targetingKey": "forced" },
"expected": { "value": "fallback", "reason": "ERROR", "errorCode": "TYPE_MISMATCH" }
},
{
"name": "composed object",
"flagKey": "variable:screen",
"type": "object",
"default": {},
"context": { "targetingKey": "forced" },
"expected": {
"value": { "enabled": true, "settings": { "region": "eu" } },
"reason": "TARGETING_MATCH"
}
},
{
"name": "string alias to JSON object",
"flagKey": "variable:settingsAlias",
"type": "object",
"default": {},
"context": {},
"expected": { "value": { "region": "eu" }, "reason": "TARGETING_MATCH" }
},
{
"name": "string alias decodes JSON exactly once",
"flagKey": "variable:jsonTextAlias",
"type": "string",
"default": "fallback",
"context": {},
"expected": { "value": "null", "reason": "TARGETING_MATCH" }
},
{
"name": "composed override",
"flagKey": "variable:screenOverride",
"type": "object",
"default": {},
"context": { "targetingKey": "forced" },
"expected": {
"value": { "enabled": true, "settings": { "region": "us" } },
"reason": "TARGETING_MATCH"
}
},
{
"name": "unmet variable root conditions",
"flagKey": "variable:restricted",
"type": "boolean",
"default": true,
"context": {},
"expected": { "value": false, "reason": "DISABLED" }
},
{
"name": "unmet feature root conditions",
"flagKey": "conditional",
"type": "boolean",
"default": true,
"context": { "targetingKey": "forced" },
"expected": { "value": false, "reason": "DISABLED" }
},
{
"name": "composition dependency error",
"flagKey": "variable:brokenAlias",
"type": "object",
"default": { "fallback": true },
"context": {},
"expected": { "value": { "fallback": true }, "reason": "ERROR", "errorCode": "GENERAL" }
}
],
"targetingCases": [
{
"name": "absent preserves field",
"context": { "userId": "forced" },
"expectedUserId": "forced",
"expectedValue": true
},
{
"name": "empty overrides field",
"context": { "targetingKey": "", "userId": "forced" },
"expectedUserId": "",
"expectedValue": false
},
{
"name": "nonempty overrides field",
"context": { "targetingKey": "other", "userId": "forced" },
"expectedUserId": "other",
"expectedValue": false
}
],
"customTargetingCase": {
"flagKey": "accountTargeted",
"context": { "targetingKey": "", "accountId": "old" },
"targetingKeyField": "accountId",
"expectedValue": true,
"expectedReason": "TARGETING_MATCH"
}
}
Loading
Loading