Skip to content

feat: add ignore-prefix filter for resolve api#1115

Open
sauraww wants to merge 1 commit into
mainfrom
feat/ignore-prefix
Open

feat: add ignore-prefix filter for resolve api#1115
sauraww wants to merge 1 commit into
mainfrom
feat/ignore-prefix

Conversation

@sauraww

@sauraww sauraww commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Problem

The existing prefix filter acts only as an allow-list. Callers cannot retrieve resolved configuration while excluding keys belonging to specific prefixes.

This affects both the Resolve API and the Detailed Resolve API.

Solution

Added an optional, repeatable ignore_prefix query parameter.

  • Without prefix, all resolved keys are returned except those matching ignore_prefix.
  • When both filters are provided, the result is the prefix allow-list minus keys matching ignore_prefix.
  • Matching default and override keys are removed.
  • Contexts whose overrides become empty after filtering are pruned.
  • Existing behavior remains unchanged when ignore_prefix is absent.

The Smithy model, OpenAPI documentation, and generated Rust, TypeScript, Python, Java, and Haskell SDKs have also been updated.

Environment variable changes

None.

Pre-deployment activity

None.

Post-deployment activity

None.

Consumers wanting to use this feature should upgrade to an SDK version containing the new ignore_prefix request field.

API changes

Endpoint Method Request Response
/config/resolve GET / POST Added optional repeatable ignore_prefix query parameter Existing resolved-config response with matching keys excluded
/config/resolve/detailed GET / POST Added optional repeatable ignore_prefix query parameter Existing detailed resolved-config response with matching keys excluded

Examples

Exclude multiple prefixes:

/config/resolve?ignore_prefix=internal.&ignore_prefix=debug.

Combine it with the existing allow-list:

/config/resolve?prefix=payments.&ignore_prefix=payments.private.

This returns keys beginning with payments., excluding keys beginning with payments.private..

The request body and response schemas remain unchanged.

Possible issues in the future

  • Supplying an empty value, such as ignore_prefix=, matches every key and can produce an empty result.
  • Broad or overlapping ignored prefixes may remove more configuration keys than intended.
  • Older generated SDK versions will not expose the new field, although callers can still use the query parameter directly.
  • Contexts containing only ignored override keys are intentionally excluded after filtering.

Validation

  • Added tests for multiple ignored prefixes.
  • Added tests for non-matching and empty filter lists.
  • Added tests for combined allow-list and ignore-prefix behavior.
  • Verified the server and dependent Rust crates compile.
  • Verified the generated Rust and TypeScript SDKs build.
  • Verified the generated Python SDK syntax.
  • Successfully generated the Smithy model and OpenAPI documentation.

Copilot AI review requested due to automatic review settings July 21, 2026 04:46
@sauraww
sauraww requested a review from a team as a code owner July 21, 2026 04:46
@semanticdiff-com

semanticdiff-com Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  docs/docs/api/get-resolved-config.ParamsDetails.json  84% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionAsyncClient.java  50% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionClient.java  50% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/GetDetailedResolvedConfigInput.java  50% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/model/GetResolvedConfigInput.java  50% smaller
  crates/superposition/src/resolve/handlers.rs  22% smaller
  crates/context_aware_config/src/api/config/helpers.rs  13% smaller
  crates/superposition_types/src/config.rs  11% smaller
  crates/superposition_sdk/src/operation/get_detailed_resolved_config.rs  11% smaller
  crates/superposition_sdk/src/operation/get_resolved_config.rs  11% smaller
  crates/context_aware_config/src/api/config/handlers.rs  4% smaller
  clients/haskell/sdk/Io/Superposition/Model/GetDetailedResolvedConfigInput.hs Unsupported file format
  clients/haskell/sdk/Io/Superposition/Model/GetResolvedConfigInput.hs Unsupported file format
  clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionAsyncClientImpl.java  0% smaller
  clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionClientImpl.java  0% smaller
  clients/javascript/sdk/src/commands/GetDetailedResolvedConfigCommand.ts  0% smaller
  clients/javascript/sdk/src/commands/GetResolvedConfigCommand.ts  0% smaller
  clients/javascript/sdk/src/models/models_0.ts  0% smaller
  clients/javascript/sdk/src/protocols/Aws_restJson1.ts  0% smaller
  clients/python/sdk/superposition_sdk/_private/schemas.py  0% smaller
  clients/python/sdk/superposition_sdk/models.py  0% smaller
  clients/python/sdk/superposition_sdk/serialize.py  0% smaller
  crates/superposition_sdk/src/client/get_detailed_resolved_config.rs  0% smaller
  crates/superposition_sdk/src/client/get_resolved_config.rs  0% smaller
  crates/superposition_sdk/src/operation/get_detailed_resolved_config/_get_detailed_resolved_config_input.rs Unsupported file format
  crates/superposition_sdk/src/operation/get_detailed_resolved_config/builders.rs Unsupported file format
  crates/superposition_sdk/src/operation/get_resolved_config/_get_resolved_config_input.rs Unsupported file format
  crates/superposition_sdk/src/operation/get_resolved_config/builders.rs Unsupported file format
  crates/superposition_types/src/api/config.rs  0% smaller
  crates/superposition_types/src/config/tests.rs  0% smaller
  crates/superposition_types/src/overridden.rs  0% smaller
  docs/docs/api/Superposition.openapi.json  0% smaller
  docs/docs/api/get-detailed-resolved-config.ParamsDetails.json  0% smaller
  docs/docs/api/get-detailed-resolved-config.api.mdx Unsupported file format
  docs/docs/api/get-resolved-config.api.mdx Unsupported file format
  smithy/models/config.smithy Unsupported file format

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 81998107-6cdb-42b0-b8c0-4a17809c98ab

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds optional ignore_prefix support to resolved-config APIs, SDK models and serializers, OpenAPI documentation, and backend filtering. Ignored prefixes are applied after prefix filtering for both standard and detailed resolution.

Changes

Ignore-prefix configuration flow

Layer / File(s) Summary
API contract and configuration filtering
smithy/models/config.smithy, crates/superposition_types/..., crates/context_aware_config/..., docs/docs/api/*
Defines ignore_prefix for both resolution operations, filters matching keys from configuration data, and updates generated API documentation.
Rust SDK input and request wiring
crates/superposition_sdk/src/operation/..., crates/superposition_sdk/src/client/...
Adds input accessors and fluent-builder methods, then serializes repeated ignore_prefix query parameters.
Generated client model and serialization updates
clients/haskell/sdk/..., clients/java/sdk/..., clients/javascript/sdk/..., clients/python/sdk/...
Adds the field to client models, builders, deserializers, examples, and query serializers; Java registry and authentication declarations are reordered.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SDKClient
  participant ResolvedConfigEndpoint
  participant apply_resolution_filters
  participant Config
  SDKClient->>ResolvedConfigEndpoint: Send prefix and ignore_prefix query values
  ResolvedConfigEndpoint->>apply_resolution_filters: Build resolution query
  apply_resolution_filters->>Config: Apply prefix then ignored-prefix filters
  Config-->>ResolvedConfigEndpoint: Return filtered configuration
  ResolvedConfigEndpoint-->>SDKClient: Return resolved configuration
Loading

Possibly related PRs

Suggested reviewers: copilot, datron

Poem

I’m a rabbit with prefixes tucked neat,
Hiding unwanted keys from the beat.
SDKs carry the list,
Requests won’t resist,
Configs bloom clean, fresh, and sweet.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.16% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding an ignore-prefix filter to the resolve API.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ignore-prefix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds an ignore_prefix query parameter to the “resolve config” APIs so callers can exclude configuration keys that start with specific prefixes, and propagates the new parameter through server-side filtering, Smithy/OpenAPI docs, and generated SDKs.

Changes:

  • Add ignore_prefix query parameter to GetResolvedConfig and GetDetailedResolvedConfig (Smithy + OpenAPI/docs).
  • Implement ignored-prefix filtering in Config and apply it in the resolve API handler.
  • Regenerate/extend multi-language SDKs (Rust, Python, JS, Java, Haskell) to support ignore_prefix.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
smithy/models/config.smithy Adds ignore_prefix to operations
docs/docs/api/Superposition.openapi.json Documents new query parameter
docs/docs/api/get-resolved-config.ParamsDetails.json Params detail includes ignore_prefix
docs/docs/api/get-resolved-config.api.mdx Regenerated API doc payload
docs/docs/api/get-detailed-resolved-config.ParamsDetails.json Params detail includes ignore_prefix
docs/docs/api/get-detailed-resolved-config.api.mdx Regenerated API doc payload
crates/superposition_types/src/overridden.rs Adds ignored-prefix map filter helper
crates/superposition_types/src/config/tests.rs Adds tests for ignored-prefix filtering
crates/superposition_types/src/config.rs Adds Config::filter_by_ignored_prefix
crates/superposition_types/src/api/config.rs Adds ignore_prefix to query struct
crates/superposition_sdk/src/operation/get_resolved_config/builders.rs Rust SDK fluent builder support
crates/superposition_sdk/src/operation/get_resolved_config/_get_resolved_config_input.rs Rust SDK input adds field + builder
crates/superposition_sdk/src/operation/get_resolved_config.rs Rust SDK serializes ignore_prefix
crates/superposition_sdk/src/operation/get_detailed_resolved_config/builders.rs Rust SDK fluent builder support
crates/superposition_sdk/src/operation/get_detailed_resolved_config/_get_detailed_resolved_config_input.rs Rust SDK input adds field + builder
crates/superposition_sdk/src/operation/get_detailed_resolved_config.rs Rust SDK serializes ignore_prefix
crates/superposition_sdk/src/client/get_resolved_config.rs Rust SDK client docs mention new param
crates/superposition_sdk/src/client/get_detailed_resolved_config.rs Rust SDK client docs mention new param
crates/context_aware_config/src/api/config/helpers.rs Server applies ignored-prefix filter
clients/python/sdk/superposition_sdk/serialize.py Python SDK serializes ignore_prefix
clients/python/sdk/superposition_sdk/models.py Python models include ignore_prefix
clients/python/sdk/superposition_sdk/_private/schemas.py Python schema indices updated
clients/javascript/sdk/src/protocols/Aws_restJson1.ts JS SDK serializes ignore_prefix
clients/javascript/sdk/src/models/models_0.ts JS models include ignore_prefix
clients/javascript/sdk/src/commands/GetResolvedConfigCommand.ts JS command docs include field
clients/javascript/sdk/src/commands/GetDetailedResolvedConfigCommand.ts JS command docs include field
clients/java/sdk/src/main/java/io/juspay/superposition/model/GetResolvedConfigInput.java Java model adds ignorePrefix
clients/java/sdk/src/main/java/io/juspay/superposition/model/GetDetailedResolvedConfigInput.java Java model adds ignorePrefix
clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionClientImpl.java Generated ordering change
clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionClient.java Generated ordering change
clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionAsyncClientImpl.java Generated ordering change
clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionAsyncClient.java Generated ordering change
clients/haskell/sdk/Io/Superposition/Model/GetResolvedConfigInput.hs Haskell model adds ignore_prefix
clients/haskell/sdk/Io/Superposition/Model/GetDetailedResolvedConfigInput.hs Haskell model adds ignore_prefix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +258 to +262
if let Some(ignore_prefix) = &query_filters.ignore_prefix {
*config = config
.clone()
.filter_by_ignored_prefix(&ignore_prefix.iter().cloned().collect());
}

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
smithy/models/config.smithy (1)

503-505: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Add ignore_prefix to GetResolvedConfigWithIdentifier.

The GetResolvedConfigWithIdentifier operation shares the same underlying resolution logic (ResolveConfigQuery in the backend) as GetResolvedConfig. Consider adding the ignore_prefix parameter here as well to ensure consistent filtering capabilities across all resolve endpoints and to expose the option to generated SDK clients.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@smithy/models/config.smithy` around lines 503 - 505, Add the ignore_prefix
query parameter to GetResolvedConfigWithIdentifier alongside the existing prefix
parameter, matching the parameter definition and annotations used by
GetResolvedConfig. Ensure it is included in the operation’s generated SDK
interface and passed through the shared ResolveConfigQuery resolution flow.
🧹 Nitpick comments (1)
crates/context_aware_config/src/api/config/helpers.rs (1)

257-263: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Avoid an unnecessary clone of the Config object.

Currently, the Config object is cloned twice if ignore_prefix is present. You can avoid the second costly clone by threading the ownership of the filtered configuration directly.

♻️ Proposed refactor to eliminate the extra clone
-    *config = apply_prefix_filter_to_config(&query_filters.prefix, config.clone())?;
-    if let Some(ignore_prefix) = &query_filters.ignore_prefix {
-        *config = config
-            .clone()
-            .filter_by_ignored_prefix(&ignore_prefix.iter().cloned().collect());
-    }
-    apply_context_id_filter(config, &query_filters.context_id)
+    let mut temp_config = apply_prefix_filter_to_config(&query_filters.prefix, config.clone())?;
+    if let Some(ignore_prefix) = &query_filters.ignore_prefix {
+        let prefixes = ignore_prefix.iter().cloned().collect();
+        temp_config = temp_config.filter_by_ignored_prefix(&prefixes);
+    }
+    apply_context_id_filter(&mut temp_config, &query_filters.context_id)?;
+    *config = temp_config;
+    Ok(())
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/context_aware_config/src/api/config/helpers.rs` around lines 257 -
263, Update the ignore_prefix branch in apply_context_id_filter’s surrounding
configuration-filtering flow to consume the already-owned filtered Config rather
than cloning it again before filter_by_ignored_prefix. Preserve the existing
ignore-prefix behavior and pass the resulting Config through
apply_context_id_filter unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@smithy/models/config.smithy`:
- Around line 503-505: Add the ignore_prefix query parameter to
GetResolvedConfigWithIdentifier alongside the existing prefix parameter,
matching the parameter definition and annotations used by GetResolvedConfig.
Ensure it is included in the operation’s generated SDK interface and passed
through the shared ResolveConfigQuery resolution flow.

---

Nitpick comments:
In `@crates/context_aware_config/src/api/config/helpers.rs`:
- Around line 257-263: Update the ignore_prefix branch in
apply_context_id_filter’s surrounding configuration-filtering flow to consume
the already-owned filtered Config rather than cloning it again before
filter_by_ignored_prefix. Preserve the existing ignore-prefix behavior and pass
the resulting Config through apply_context_id_filter unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cc9cfd0d-88fa-4b69-b2ed-50b00019b405

📥 Commits

Reviewing files that changed from the base of the PR and between 3cffb2b and 90d7835.

📒 Files selected for processing (34)
  • clients/haskell/sdk/Io/Superposition/Model/GetDetailedResolvedConfigInput.hs
  • clients/haskell/sdk/Io/Superposition/Model/GetResolvedConfigInput.hs
  • clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionAsyncClient.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionAsyncClientImpl.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionClient.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/client/SuperpositionClientImpl.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/GetDetailedResolvedConfigInput.java
  • clients/java/sdk/src/main/java/io/juspay/superposition/model/GetResolvedConfigInput.java
  • clients/javascript/sdk/src/commands/GetDetailedResolvedConfigCommand.ts
  • clients/javascript/sdk/src/commands/GetResolvedConfigCommand.ts
  • clients/javascript/sdk/src/models/models_0.ts
  • clients/javascript/sdk/src/protocols/Aws_restJson1.ts
  • clients/python/sdk/superposition_sdk/_private/schemas.py
  • clients/python/sdk/superposition_sdk/models.py
  • clients/python/sdk/superposition_sdk/serialize.py
  • crates/context_aware_config/src/api/config/helpers.rs
  • crates/superposition_sdk/src/client/get_detailed_resolved_config.rs
  • crates/superposition_sdk/src/client/get_resolved_config.rs
  • crates/superposition_sdk/src/operation/get_detailed_resolved_config.rs
  • crates/superposition_sdk/src/operation/get_detailed_resolved_config/_get_detailed_resolved_config_input.rs
  • crates/superposition_sdk/src/operation/get_detailed_resolved_config/builders.rs
  • crates/superposition_sdk/src/operation/get_resolved_config.rs
  • crates/superposition_sdk/src/operation/get_resolved_config/_get_resolved_config_input.rs
  • crates/superposition_sdk/src/operation/get_resolved_config/builders.rs
  • crates/superposition_types/src/api/config.rs
  • crates/superposition_types/src/config.rs
  • crates/superposition_types/src/config/tests.rs
  • crates/superposition_types/src/overridden.rs
  • docs/docs/api/Superposition.openapi.json
  • docs/docs/api/get-detailed-resolved-config.ParamsDetails.json
  • docs/docs/api/get-detailed-resolved-config.api.mdx
  • docs/docs/api/get-resolved-config.ParamsDetails.json
  • docs/docs/api/get-resolved-config.api.mdx
  • smithy/models/config.smithy

@sauraww
sauraww force-pushed the feat/ignore-prefix branch 2 times, most recently from 582b53d to aa08fd4 Compare July 23, 2026 10:00
Comment thread smithy/models/config.smithy Outdated
@documentation("Excludes configuration keys that start with any of the supplied prefixes. When combined with prefix, exclusion is applied to the allow-listed keys.")
@httpQuery("ignore_prefix")
@notProperty
ignore_prefix: StringList

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if we are adding something like this, then it's an incomplete feature if we dont expand it the plain get config, list experiments, get experiment config, list default configs, list contexts

features on key level filtering specially like prefix should expand to all the usecases

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

And also to providers , i was thinking to do that in the second phase.
I will close the api coverage in this PR , we can do the provider changes in the next PR.
Didn't want to make this PR big.

@sauraww
sauraww force-pushed the feat/ignore-prefix branch from aa08fd4 to 62a260d Compare July 24, 2026 05:15
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.

3 participants