Skip to content

feat(core): the bridges' namespaces on the new core: cart, catalog, search with its AI agent, client, notifications, stories, predict, loyalty, sliders, reviews - #238

Open
Xyzcancer wants to merge 44 commits into
masterfrom
feat/DEV-4686-namespace-base
Open

Xyzcancer wants to merge 44 commits into
masterfrom
feat/DEV-4686-namespace-base

Conversation

@Xyzcancer

@Xyzcancer Xyzcancer commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Bridges get the data namespaces on the new core, behind @_spi(Bridge): an app that imports REES46 does not see them, and on the old core every call ends with notInitialized without a request (core_flag_mismatch in the log), as on Android. Each method has a completion called once on the main thread and an async throws twin, and fails with the contract's Rees46.SdkError.

  • cart; the catalog: products, collections, recommendations, search (blank, instant, full and the AI search: agentEnabled, agentDialog, agent);
  • the client: profile, subscriptions, segments; notifications: the push events through the queue, the push token, the callbacks;
  • stories, predict, loyalty, sliders with the banner events tracking.bannerView and bannerClick; reviews: NPS, CSAT and CES polls, the reviews of a product or an order.
  • The polls and the search agent go to API v3 (Rees46Config.appDomain, app.rees46.ru by default), everything else to the API host.

Left out: the methods that need shop_secret (clearing the cart, the notification history, loyalty bonuses, certificates and checkout, writing product reviews) and loyalty.getPromoCode, which the contract does not have yet. Nothing existing is deprecated.

… core and ends with its value or Rees46.SdkError, its completion once on the main thread

NamespaceRequests is the one path of the namespaces: the request goes through
the new core's pipeline, waits for the shop to be usable within its timeout and
is not repeated; it ends with the value or the contract's error (http, network,
timeout, decoding, shopBlocked, cancelled, notInitialized). A 2xx whose body
says status error is decoding. The completion is called once on the main
thread; the async form throws, and cancelling its task ends the call as
cancelled, also while it waits for /init. On the old core every call is
notInitialized without a request, logged as core_flag_mismatch, as on Android.

Answers are read with Codable leniently: a number as a string and back, a
missing, null or unfit field as empty, an unknown enum value as empty, a list
without the elements that do not read.

One loader of the contract's fixtures serves the package and the demo tests.
…art.get on the new core

CartAPI and PersonalizationSDK.cart are behind @_spi(Bridge): an app that
imports REES46 does not see them. get() reads both shapes of the answer,
data.items and payload.cart_items; a line without uniqid is left out, one
without quantity is one. CartItem gives the bridges id and quantity.

The cases are proposed in the contract's fixture format, the same as Android's,
until sdk/fixtures has cart.json.
…46.ru unless the shop's cluster has its own

The methods of the namespaces that call API v3 go there; none does yet, and
popups and stories v3 keep their own settings of the host. An empty host is
the default. The instance keeps the host it was made with: another one in a
later initialize is invalid_config with already_initialized.
…out holding a thread

deleteUserCredentials() async, behind @_spi(Bridge), returns once the
customer's data is wiped, as the synchronous one does, on either core. It is
not public: beside the synchronous method it would take over an app's calls
from async code, which would then need await.
…ds a list in data.items or payload.cart_items, as on Android

A 2xx without a body is a success with an empty result (sdk/core/network.md):
cart.get gives an empty list. An empty object, or one without a list of lines
in either shape, is decoding; data.items that is not a list falls back to
payload.cart_items. A blank uniqid is no id.
…, the host of API v3, through the new core with the same common fields
…ls' dictionaries on appDomain, and the reviews of a product or of an order on the API, with sdk.reviews on the new core
… with sdk.predict.getProbabilityToPurchase on the new core
…d their status and the promotions that fit with sdk.loyalty on the new core
… tracking.bannerView and bannerClick through the new core's queue
…, a product's counters and a category's page with sdk.products on the new core

ProductsAPI and PersonalizationSDK.products are behind @_spi(Bridge). The
contract's models are nested in the facade (Rees46.Product, ProductCategory,
ProductsListResponse, CategoryResponse, the facets, SortBy, the requests), so
the released top-level Product, Category and the rest stay as they are;
ProductCountersResponse is the released model, read leniently.

A field the answer does not have is nil; an old price of 0 is none. getInfo
answers an unknown id with nil and takes the id from uniqid. getList sends
the price range and the sorting, lists joined by "," without spaces, numbers
without a needless fraction, filters as JSON; limit, page and prices are
checked before anything is sent. getCategory is the listing with the category
alone in categories, as the server's category/{id} is.
…ections.get on the new core

The collection id goes encoded in the path; the request names the customer by
the device id alone, without contacts or location. An answer without products
is decoding.
…mendations.get on the new core

RecommendationRequest sends the product as item_id and the category as
category, extended by default and without resize_image. Without extended the
same RecommendationResponse carries the ids alone in itemIds; a block on pause
is an empty one, recommends that is not a list is decoding. withLocations
needs extended.
…k.search on the new core

blank, instant and full answer with their own models: SearchBlankResponse
(no last_products is false), SearchInstantResponse with the redirect, and
SearchFullResponse with the facets. Full search sends the direction as order,
the page as page and the brands to leave out as excluded_brands, the names of
the documentation; excluded_merchants goes only with locations, in both
searches. SwiftLint covers the new folders.
… and over the stub server

products.json, collections.json, recommendations.json and search.json are in
the contract's format, until sdk/fixtures has them. The package tests build
every call's request and read every answer of them; the demo's tests send
each method through the new core, see the old core refuse each one by name,
and an argument refused before anything is sent.
…the push token and set the shop's push callbacks through sdk.notifications on the new core
… namespaces

# Conflicts:
#	DemoApp/REES46.xcodeproj/project.pbxproj
#	Tests/REES46CoreTests/Fixtures/proposed/README.md
# Conflicts:
#	.swiftlint.yml
#	DemoApp/REES46.xcodeproj/project.pbxproj
#	REES46/Classes/Core/Core.swift
#	REES46/Classes/Core/CoreV2.swift
#	REES46/Classes/Core/Network/NetworkClient.swift
#	Tests/REES46CoreTests/Fixtures/proposed/README.md
…uments and the old core through one shared check each, with the same errors and logs as before
@Xyzcancer Xyzcancer changed the title feat(core): the bridges' namespaces on the new core, with sdk.cart.get first, and Rees46Config.appDomain feat(core): the bridges' namespaces on the new core: cart, notifications, stories, predict, loyalty, sliders, reviews Nov 17, 2026
… currency is left out of its answer, as on Android

The card without one of them is decoding. A brand needs a name and a count, a
location an id and a name, a colour or a size of the facets its count; a price
interval without from starts at 0. An empty list where the answer has an
object — the server's empty object — is an empty map, filters and resized
images among them.
…is decoding unless the block is on pause, as on Android

recommends holds whole products or their ids whatever was asked: itemIds are
the products' ids, or the ids of the simple answer.
… is an empty one, and a popular item needs its link, as on Android
…mpared whole as Android compares them

products.json, collections.json, recommendations.json and search.json are
the files of android-sdk feat/DEV-4694-catalog (96b232f9) as they are, so both
SDKs test the same cases. A result and a request's own fields are compared
whole: a field without a value counts as missing on either side.
…rder's products with sdk.profile on the new core

ProfileAPI and PersonalizationSDK.profile are behind @_spi(Bridge); the models
are nested in the facade (Rees46.Profile, ProfileUpdateRequest, ProfileKid,
ProfileCar), the gender is the released Gender, m and f on the wire.

set sends only the fields given: externalId as both id and external_id,
birthday as YYYY-MM-DD, cars as auto, the custom properties at the top level,
no advertising id. It refuses before anything is sent a request without a
field, an empty identifier, a date that is not a day of the calendar, a
negative age, a custom key out of [a-z0-9_] or one of the request's or the
SDK's own fields, and a value that is not JSON. getLastOrder reads the list
at the top of the answer as Rees46.Product. A profile set on its way tells
popups v3, as setProfileData does.
…tions and subscribe to a product's price or stock with sdk.subscriptions on the new core

manage sends the contacts and the flags given, 24 of them with wallet_chain
and wallet_transactional; without a flag it is refused. check reads the 24
flags and web_push, mobile_push and the email's states as
Rees46.SubscriptionStatus, false when missing. The subscriptions to a product
send it as item_id and its variant in properties, which the old
subscribeForBackInStock lost; the unsubscriptions send item_ids as one value
joined by ",", an empty list for every product, and no price. The SDK does not
check the format of an email or a phone: the server does. A manage on its way
tells popups v3.
…ead their segments and the device's A/B group with sdk.segments

add and remove send segment_id as a number, as the API has it, and tell
popups v3; get reads the list GET segments/get answers, which iOS had no
method for, as Rees46.Segment with its type as the server writes it. They run
on the new core; getAbGroup is the device's group on either core.
…res and over the stub server

profile.json, subscriptions.json and segments.json are the files of
android-sdk feat/DEV-4698-client (ea72dd13) as they are, compared whole as on
Android. The package tests build every call's request and read every answer
of them; the demo's tests send each method through the new core, see the old
core refuse each one by name, and the A/B group stay the device's.
…, the host of API v3, through the new core with the same common fields
…ntDialog and agent on appDomain, and read agentEnabled from the last /init

agentEnabled is true when search.blank_mode of the instance's last /init
answer on the new core is agent; any other value, none and the old core are
false. It is read at once on any thread.

agentDialog and agent go to api/v3/storefront/search/agent on
Rees46Config.appDomain with the common fields: the dialog as a GET with
session_id and location, a message as a JSON POST with a read timeout of 60
seconds, as the agent may answer in up to 40 seconds and two more tries of its
model. An empty message or one over 500 characters, counted as the server
counts them, is refused before anything is sent; 400, 402, 404, 429 and 503
are http with their code. The models are nested in the facade
(Rees46.AgentDialogResponse, AgentResponse, AgentSession, AgentMessage,
AgentProduct); the role is an open set, an old price of 0 is none.
…over the stub server

search.json is the file of android-sdk feat/DEV-4620-agent-search (935b0168)
as it is: the catalog's cases and the agent's — the requests, the refused
messages, the answers and errors. The package tests add the host, the read
timeout and the count of a message, and agentEnabled from an answer of /init;
the demo's tests see the agent's requests reach appDomain — the shop's own one
too — with the read timeout of a message, agentEnabled follow /init, and the
old core refuse the agent.
…mespaces refuse blank arguments through the one shared check, with the same errors as before
@Xyzcancer Xyzcancer changed the title feat(core): the bridges' namespaces on the new core: cart, notifications, stories, predict, loyalty, sliders, reviews feat(core): the bridges' namespaces on the new core: cart, catalog, search with its AI agent, client, notifications, stories, predict, loyalty, sliders, reviews Nov 17, 2026
…ability-to-purchase on the shop's appDomain and reads its payload, since the API host's path answers 503 for good
…s "" so the server erases it, keeps an empty email, phone or loyaltyId as invalidArgument, and refuses a birthday that is not an existing date of the years 1000 to 2999
…hich the server would erase the stored date with
…erver does, and the ids of reviews are 64-bit
…http(503) for a customer in the control group of search, and its ids are 64-bit
…sers/probability-to-purchase on the shop's appDomain on both cores, by the device id alone, and reads its payload, a customer the server does not know being a success with an empty clientId
…s/get sends as an object of the parameter's name, into the same list as the other answers, in the card's order
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.

1 participant