Skip to content

Add Slate-aware config generation#355

Merged
paras-agarwal-meesho merged 2 commits intodevelopfrom
feat/slate-aware-config
Mar 12, 2026
Merged

Add Slate-aware config generation#355
paras-agarwal-meesho merged 2 commits intodevelopfrom
feat/slate-aware-config

Conversation

@paras-agarwal-meesho
Copy link
Copy Markdown
Contributor

@paras-agarwal-meesho paras-agarwal-meesho commented Mar 10, 2026

What type of PR is this?

  • 🍕 Feature
  • 🐛 Bug Fix
  • ⚙️ Config Change
  • 📝 CHANGELOG/README Update
  • 🎨 Linting
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🔁 Version Bump
  • ⏩ Revert

Description

🔁 Pull Request Template – BharatMLStack

Context:

Inferflow already supports a slate_component boolean on PredatorComponentConfig and NumerixComponentConfig that controls whether a component operates at the target level (individual items) or slate level (grouped items). However, Horizon's config onboarding flow had no awareness of this field — it was missing from every layer (UI, API structs, config builder, DB models, etcd models, adaptors, and shared schema client), causing it to always default to false and making it impossible to onboard slate-aware components through Horizon.

Describe your changes:

Added the slate_component boolean field across all layers of Horizon's Inferflow config onboarding pipeline, React UI (toggle switches in Onboard, Edit, and Clone modals), handler request structs (Ranker, ReRanker, PredatorComponent, NumerixComponent), config builder (GetPredatorComponents, GetNumerixComponents), SQL DB models, etcd models, all 8 adaptor functions, and the shared configschemaclient types, ensuring the flag is correctly propagated end-to-end from user input to the final etcd config that Inferflow consumes. No DB or etcd migration is needed since configs are stored as JSON and the missing field defaults to false.

  • Horizon (backend)

    • Models: Added SlateComponent bool to Ranker, ReRanker, NumerixComponent, and Predator-related structs in:
      • horizon/internal/inferflow/handler/models.go
      • horizon/internal/inferflow/etcd/models.go
      • horizon/internal/repositories/sql/inferflow/models.go
      • horizon/pkg/configschemaclient/types.go (NumerixComponent, PredatorComponent)
    • Config flow: Propagate SlateComponent in:
      • horizon/internal/inferflow/handler/adaptor.go (when mapping to config schema client types)
      • horizon/internal/inferflow/handler/config_builder.go (when building config from DB/etcd)
    • Ensures stored config and config served to Inferflow runtime carry the slate-component flag end-to-end.
  • Trufflebox UI (frontend)

    • InferflowConfigForm.jsx: Added “Slate Component” checkbox for each ranker and each re-ranker; value is bound to ranker.slate_component and reRanker.slate_component and included in submit payloads.
    • OnboardInferflowConfigModal.jsx, EditInferflowConfigModal.jsx, CloneInferflowConfigModal.jsx: Default and map slate_component: false for rankers and re-rankers when initializing or transforming payloads so existing flows remain unchanged and new configs can opt in to slate component.

Checklist before requesting a review

  • I have reviewed my own changes?
  • Relevant or critical functionality is covered by tests?
  • Monitoring needs have been evaluated?
  • Any necessary documentation updates have been considered?

📂 Modules Affected

  • horizon (Real-time systems / networking)
  • online-feature-store (Feature serving infra)
  • trufflebox-ui (Admin panel / UI)
  • infra (Docker, CI/CD, GCP/AWS setup)
  • docs (Documentation updates)
  • Other: ___________

✅ Type of Change

  • Feature addition
  • Bug fix
  • Infra / build system change
  • Performance improvement
  • Refactor
  • Documentation
  • Other: ___________

📊 Benchmark / Metrics (if applicable)

Key Requirement Doc

Pod Type:

  • H0
  • H1
  • H2

Why KRD is not required?
KRD is not required for this change

Added Tests

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

If yes, what is the strategy?

  • Manual
  • Unit Tests
  • API/Integration Tests

Updated by ReadyToReviewBot for @paras-agarwal-meesho

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Slate Component toggle controls to InferFlow configuration forms, enabling users to configure slate-based rendering for rankers and re-rankers in deployments.
  • Updates

    • Standardized service naming to lowercase "inferflow" across all UI elements and API communications for improved consistency.
    • New rankers and re-rankers are automatically initialized with Slate Component disabled by default.

@readytoreview
Copy link
Copy Markdown

readytoreview bot commented Mar 10, 2026

PR Validation Passed

PR description validation passed

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 10, 2026

Walkthrough

Adds a new boolean field SlateComponent (JSON slate_component) to multiple backend structs, propagates it through DB/ETCD/domain conversion logic, and exposes it in the frontend as a per-ranker toggle and as initialized fields when creating/cloning configs.

Changes

Cohort / File(s) Summary
Backend ETCD & domain models
horizon/internal/inferflow/etcd/models.go, horizon/internal/inferflow/handler/models.go, horizon/pkg/configschemaclient/types.go
Added SlateComponent bool (json:"slate_component") to NumerixComponent, PredatorComponent, and related domain structs.
Backend SQL models
horizon/internal/repositories/sql/inferflow/models.go
Added SlateComponent bool to NumerixComponent, PredatorComponent, OnboardRanker, and OnboardReRanker DB model structs.
Handler conversions & builders
horizon/internal/inferflow/handler/adaptor.go, horizon/internal/inferflow/handler/config_builder.go
Updated adaptors and builder code to propagate SlateComponent between DB, domain, and ETCD representations; populated field in GetPredatorComponents and GetNumerixComponents.
Frontend — form UI
trufflebox-ui/src/pages/InferFlow/.../InferflowConfigForm.jsx
Added a Slate Component toggle (FormControlLabel + Switch) bound to ranker.slate_component and reRanker.slate_component with handlers.
Frontend — modals / data init
trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/CloneInferflowConfigModal.jsx, .../EditInferflowConfigModal.jsx, .../OnboardInferflowConfigModal.jsx
Initialize slate_component: false for new ranker and re-ranker entries and include it in clone/onboard payloads; adjusted some UI strings and MP host fetch query to service_name=inferflow (lowercase) and corresponding log/messages.
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Dynamic Configuration Validation ✅ Passed No files matching application-dyn-*.yml pattern were modified in this PR, so the validation check passes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

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 (3)
trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/EditInferflowConfigModal.jsx (1)

254-256: ⚠️ Potential issue | 🟠 Major

Use lowercase inferflow in the deployable lookup.

This request still sends service_name=InferFlow. If the discovery filter is case-sensitive, the host list comes back empty and operators cannot pick an Inferflow host.

Suggested fix
-        `${URL_CONSTANTS.REACT_APP_HORIZON_BASE_URL}/api/v1/horizon/deployable-discovery/deployables?service_name=InferFlow`,
+        `${URL_CONSTANTS.REACT_APP_HORIZON_BASE_URL}/api/v1/horizon/deployable-discovery/deployables?service_name=inferflow`,

Based on learnings: Within the BharatMLStack horizon codebase, ensure that service names (inferflow, predator, numerix) are stored in lowercase in database tables and are consistently used in lowercase throughout the code.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/EditInferflowConfigModal.jsx`
around lines 254 - 256, The request building in EditInferflowConfigModal.jsx
uses a capitalized service_name parameter ("InferFlow") which can cause empty
results if the discovery filter is case-sensitive; update the axios.get call
that constructs the URL (the template string invoking
URL_CONSTANTS.REACT_APP_HORIZON_BASE_URL and path
/api/v1/horizon/deployable-discovery/deployables) to use service_name=inferflow
(lowercase) instead, and search the component for any other occurrences of
"InferFlow" to replace with lowercase "inferflow" for consistency with the
horizon DB naming convention.
trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/OnboardInferflowConfigModal.jsx (1)

177-179: ⚠️ Potential issue | 🟠 Major

Use lowercase inferflow for host discovery.

This lookup is still filtering deployables with service_name=InferFlow. If the backend expects normalized lowercase service names, onboarding will fail to populate the host dropdown.

Suggested fix
-        `${URL_CONSTANTS.REACT_APP_HORIZON_BASE_URL}/api/v1/horizon/deployable-discovery/deployables?service_name=InferFlow`,
+        `${URL_CONSTANTS.REACT_APP_HORIZON_BASE_URL}/api/v1/horizon/deployable-discovery/deployables?service_name=inferflow`,

Based on learnings: Within the BharatMLStack horizon codebase, ensure that service names (inferflow, predator, numerix) are stored in lowercase in database tables and are consistently used in lowercase throughout the code.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/OnboardInferflowConfigModal.jsx`
around lines 177 - 179, The host discovery request filters by service name using
a capitalized value; update the axios GET call in
OnboardInferflowConfigModal.jsx (the request that builds the URL via
URL_CONSTANTS.REACT_APP_HORIZON_BASE_URL and calls axios.get) to use the
normalized lowercase service name "inferflow" for the service_name query
parameter (or derive the value via .toLowerCase() from any variable used) so the
backend matches stored lowercase service names; also sweep other
deployable/service_name usages in this component to ensure they consistently use
lowercase.
trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/CloneInferflowConfigModal.jsx (1)

247-249: ⚠️ Potential issue | 🟠 Major

Query deployables with lowercase inferflow.

The clone modal uses service_name=InferFlow here as well. If the filter is case-sensitive, cloned configs won't be able to resolve available Inferflow hosts.

Suggested fix
-        `${URL_CONSTANTS.REACT_APP_HORIZON_BASE_URL}/api/v1/horizon/deployable-discovery/deployables?service_name=InferFlow`,
+        `${URL_CONSTANTS.REACT_APP_HORIZON_BASE_URL}/api/v1/horizon/deployable-discovery/deployables?service_name=inferflow`,

Based on learnings: Within the BharatMLStack horizon codebase, ensure that service names (inferflow, predator, numerix) are stored in lowercase in database tables and are consistently used in lowercase throughout the code.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/CloneInferflowConfigModal.jsx`
around lines 247 - 249, The query in CloneInferflowConfigModal uses
service_name=InferFlow which can fail if the Horizon API is case-sensitive;
update the axios.get call that builds the URL (the code using
URL_CONSTANTS.REACT_APP_HORIZON_BASE_URL and axios.get) to use a lowercase
service_name value ("inferflow") and audit any other uses of "InferFlow" in this
component (or nearby functions) to consistently pass "inferflow" so database/API
filters match canonical lowercase service names.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/CloneInferflowConfigModal.jsx`:
- Around line 247-249: The query in CloneInferflowConfigModal uses
service_name=InferFlow which can fail if the Horizon API is case-sensitive;
update the axios.get call that builds the URL (the code using
URL_CONSTANTS.REACT_APP_HORIZON_BASE_URL and axios.get) to use a lowercase
service_name value ("inferflow") and audit any other uses of "InferFlow" in this
component (or nearby functions) to consistently pass "inferflow" so database/API
filters match canonical lowercase service names.

In
`@trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/EditInferflowConfigModal.jsx`:
- Around line 254-256: The request building in EditInferflowConfigModal.jsx uses
a capitalized service_name parameter ("InferFlow") which can cause empty results
if the discovery filter is case-sensitive; update the axios.get call that
constructs the URL (the template string invoking
URL_CONSTANTS.REACT_APP_HORIZON_BASE_URL and path
/api/v1/horizon/deployable-discovery/deployables) to use service_name=inferflow
(lowercase) instead, and search the component for any other occurrences of
"InferFlow" to replace with lowercase "inferflow" for consistency with the
horizon DB naming convention.

In
`@trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/OnboardInferflowConfigModal.jsx`:
- Around line 177-179: The host discovery request filters by service name using
a capitalized value; update the axios GET call in
OnboardInferflowConfigModal.jsx (the request that builds the URL via
URL_CONSTANTS.REACT_APP_HORIZON_BASE_URL and calls axios.get) to use the
normalized lowercase service name "inferflow" for the service_name query
parameter (or derive the value via .toLowerCase() from any variable used) so the
backend matches stored lowercase service names; also sweep other
deployable/service_name usages in this component to ensure they consistently use
lowercase.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 000df829-eccb-4437-a927-9c618ce072aa

📥 Commits

Reviewing files that changed from the base of the PR and between ef0a830 and 8c7cbc1.

📒 Files selected for processing (10)
  • horizon/internal/inferflow/etcd/models.go
  • horizon/internal/inferflow/handler/adaptor.go
  • horizon/internal/inferflow/handler/config_builder.go
  • horizon/internal/inferflow/handler/models.go
  • horizon/internal/repositories/sql/inferflow/models.go
  • horizon/pkg/configschemaclient/types.go
  • trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/CloneInferflowConfigModal.jsx
  • trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/EditInferflowConfigModal.jsx
  • trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/InferflowConfigForm.jsx
  • trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/OnboardInferflowConfigModal.jsx

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/OnboardInferflowConfigModal.jsx (1)

33-40: Extract default ranker/re-ranker factories to avoid schema drift.

These shapes now need to stay in sync across the initial state and the add handlers. Centralizing them in small factory helpers will make the next payload-field change much harder to miss.

Proposed refactor
+  const createEmptyRanker = () => ({
+    model_name: '',
+    end_point: '',
+    calibration: '',
+    batch_size: '',
+    deadline: '110',
+    entity_id: [],
+    slate_component: false,
+    inputs: [{
+      name: '',
+      features: [],
+      data_type: '',
+      dims: ''
+    }],
+    outputs: [{
+      name: '',
+      data_type: '',
+      model_scores_dims: '',
+      model_scores: []
+    }]
+  });
+
+  const createEmptyReRanker = () => ({
+    eq_variables: {},
+    score: '',
+    data_type: 'DataTypeFP32',
+    eq_id: '',
+    entity_id: [],
+    slate_component: false
+  });
+
   const [formData, setFormData] = useState({
     real_estate: '',
     tenant: '',
     config_identifier: '',
-    rankers: [{
-      model_name: '',
-      end_point: '',
-      calibration: '',
-      batch_size: '',
-      deadline: '110',
-      entity_id: [],
-      slate_component: false,
-      inputs: [{
-        name: '',
-        features: [],
-        data_type: '',
-        dims: ''
-      }],
-      outputs: [{
-        name: '',
-        data_type: '',
-        model_scores_dims: '',
-        model_scores: []
-      }]
-    }],
+    rankers: [createEmptyRanker()],
     re_rankers: [],
     response: {
       prism_logging_perc: 1,
@@
   const addRanker = () => {
     const newIndex = formData.rankers.length;
     setFormData(prev => ({
       ...prev,
-      rankers: [...prev.rankers, {
-        model_name: '',
-        end_point: '',
-        calibration: '',
-        batch_size: '',
-        deadline: '110',
-        entity_id: [],
-        slate_component: false,
-        inputs: [{
-          name: '',
-          features: [],
-          data_type: '',
-          dims: ''
-        }],
-        outputs: [{
-          name: '',
-          data_type: '',
-          model_scores_dims: '',
-          model_scores: []
-        }]
-      }]
+      rankers: [...prev.rankers, createEmptyRanker()]
     }));
@@
   const addReRanker = () => {
     const newIndex = formData.re_rankers.length;
     setFormData(prev => ({
       ...prev,
-      re_rankers: [...prev.re_rankers, {
-        eq_variables: {},
-        score: '',
-        data_type: 'DataTypeFP32',
-        eq_id: '',
-        entity_id: [],
-        slate_component: false
-      }]
+      re_rankers: [...prev.re_rankers, createEmptyReRanker()]
     }));

Also applies to: 431-438, 472-478

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/OnboardInferflowConfigModal.jsx`
around lines 33 - 40, The ranker/re-ranker default object literal used in the
component state and add handlers (the rankers array with keys model_name,
end_point, calibration, batch_size, deadline, entity_id, slate_component) should
be centralized into small factory helpers (e.g., createDefaultRanker(),
createDefaultReranker()) and imported/used wherever the initial state and the
add-item handlers reference those shapes (including the add handlers around the
existing blocks at ~lines 431-438 and 472-478) so the schema is defined in one
place and both the initial rankers in OnboardInferflowConfigModal and the
functions that push new items use the same factory to avoid drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/OnboardInferflowConfigModal.jsx`:
- Around line 33-40: The ranker/re-ranker default object literal used in the
component state and add handlers (the rankers array with keys model_name,
end_point, calibration, batch_size, deadline, entity_id, slate_component) should
be centralized into small factory helpers (e.g., createDefaultRanker(),
createDefaultReranker()) and imported/used wherever the initial state and the
add-item handlers reference those shapes (including the add handlers around the
existing blocks at ~lines 431-438 and 472-478) so the schema is defined in one
place and both the initial rankers in OnboardInferflowConfigModal and the
functions that push new items use the same factory to avoid drift.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c19f7d3c-cb67-4ef0-ae72-8f74feaa44fd

📥 Commits

Reviewing files that changed from the base of the PR and between 8c7cbc1 and 965f6c7.

📒 Files selected for processing (3)
  • trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/CloneInferflowConfigModal.jsx
  • trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/EditInferflowConfigModal.jsx
  • trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/OnboardInferflowConfigModal.jsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/CloneInferflowConfigModal.jsx
  • trufflebox-ui/src/pages/InferFlow/DiscoveryRegistry/InferflowRegistry/EditInferflowConfigModal.jsx

@paras-agarwal-meesho paras-agarwal-meesho merged commit 719e1f6 into develop Mar 12, 2026
12 checks passed
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.

2 participants