Skip to content

Conversation

Zuzuna54
Copy link

No description provided.

@Zuzuna54 Zuzuna54 requested a review from spoluyan as a code owner June 17, 2025 15:54

### 1. Telegram Ecosystem Integration

The SDK provides specialized support for Telegram applications:
Copy link
Contributor

Choose a reason for hiding this comment

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

what specialised support? as far as i know there is nothing telegram specific in SDK

const { cid } = await this.ddcClient.store(this.bucketId, content);

// Record content hash on blockchain
const tx = this.blockchain.ddcCustomers.setBucketParams(this.bucketId, {
Copy link
Contributor

Choose a reason for hiding this comment

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

export type BucketParams = {
isPublic: boolean;
};

there is no metadata with contentCid etc.

'https://storage-3.mainnet.cere.network',
],
},
activity: {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we really have anything deployed on https://api.stats.cere.network and https://search.cere.network?

Might be it's better to move code pieces into examples directory (that already exists) and make sure they are 100% working?

e.g. there is guide how to execute examples: https://github.com/Cerebellum-Network/cere-ddc-sdk-js/blob/9f634e6d736ca601fa1737bb0a373c53eeead6b8/examples/node/README.md

end

subgraph "Data Layer"
IPFS[IPFS Compatible]
Copy link
Contributor

Choose a reason for hiding this comment

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

what is IPFs compatible?

as far as you now have much more context on system components, could you please go through this doc and make sure there is no trash that is actually not truth and could confuse and people who would learn this docs in details?


## Common Use Cases

### Use Case 1: Telegram Bot with Quest System
Copy link
Contributor

Choose a reason for hiding this comment

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

is really Telegram Bot with Quest System a 'common use case' ?)

}
```

## Deployment Considerations
Copy link
Contributor

Choose a reason for hiding this comment

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

deployment of what? SDK? or some service that developers integrate SDK to?

i think should be removed

end

subgraph "External Services"
ActivitySDK[Activity SDK]
Copy link
Contributor

Choose a reason for hiding this comment

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

is Activity SDK - external service?

Also this diagram very similar to diagram in cere-ddc-sdk-js-ecosystem-integration.md

I think there can be one 'overview' document (or even moved to main Readme.md) + usage/integration doc but need somehow to be aligned with existing 'examples' directory. Either follow the existing approach or align those example to new.

bucketId: BigInt(12345),
network: 'testnet',
},
activityConfig: {
Copy link
Contributor

Choose a reason for hiding this comment

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

i would suggest to rename ddcConfig and activityConfig just to ddc and activity

or if you vote for 'config' postfix, then there should be 'processingConfig' and 'loggingConfig'

main concern here - consistent naming

timestamp: new Date(),
};

const result = await sdk.writeTelegramEvent(questEvent, {
Copy link
Contributor

Choose a reason for hiding this comment

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

what's different between Telegram, and regular event?

Is separate method needed?

timestamp: new Date(),
};

const result = await sdk.writeTelegramMessage(message, {
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like those methods are not aligned with the idea of 'unified' SDK

interface UnifiedResponse {
transactionId: string;
status: 'success' | 'partial' | 'failed';
dataCloudHash?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

what is dataCloudHash?

Is it CID?

},

// Nightingale-specific optimizations
nightingaleConfig: {
Copy link
Contributor

Choose a reason for hiding this comment

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

nightingale is one of the usecases. it shouldn't be in SDK config

},

// Performance tuning
performance: {
Copy link
Contributor

Choose a reason for hiding this comment

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

timeouts are not really about performance.

e.g. when we configure HTTP or GRPC server, it's not 'performance' section.

processing: {
dataCloudWriteMode: 'direct',
indexWriteMode: 'realtime',
priority: 'high',
Copy link
Contributor

Choose a reason for hiding this comment

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

how priority works? didn't found explanation for it

- [UnifiedSDKConfig](#unifiedsdkconfig)
- [UnifiedResponse](#unifiedresponse)
- [ProcessingMetadata](#processingmetadata)
- [TelegramEventData](#telegrameventdata)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think Telegram, Bullish and Nightingale are special cases but our SDK is general purpose that can be used by other devs and actually the repo is open source.

From my point of view, any mentioning of Telegram, Bullish and Nightingale (keywords) should be removed from both code and docs

},
activityConfig: {
endpoint: 'https://api.stats.cere.network',
keyringUri: 'your mnemonic phrase here', // UriSigner compatible
Copy link
Contributor

Choose a reason for hiding this comment

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

UriSigner is one of the options.

E.g. in BullishApp we use CereWalletSigner.

so it should be possible to pass a Signer interface implementation


// ✨ Nightingale Video Stream - Auto-detected
const result3 = await sdk.writeData({
droneId: 'drone_001',
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we follow Event structure? also we could have a strong typing so that writeData accepts e.g. either file or event

});
```

## Migration Guide
Copy link
Contributor

Choose a reason for hiding this comment

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

there was never writeTelegramEvent or writeBullishCampaign so not clear what this Migration Guide is about

@upalinski
Copy link
Contributor

upalinski commented Jul 24, 2025

There is a lot of documentation and diagrams here where i see a lot of duplication. The overview, architecure etc. All are about more or less about the same.

No one will ever keep all this up to date. Even in your PR i wound out dated information documentation about some methods that you had during development but removed then from code but not from docs.

Also some docs are not making sense to me. E.g. some docs about benchmarks - https://github.com/Cerebellum-Network/cere-ddc-sdk-js/blob/9f634e6d736ca601fa1737bb0a373c53eeead6b8/packages/unified/docs/diagrams/11_performance_benchmarks_explanation.md

There is mentioning of auto-scaling triggers... It's about SDK, library. For me it's more like a noise in docs for SDK.

Migration plans.. do they really need to be in docs of SDK? If they make sense to us and not just AI generated trash, then might be move it to SEK but not SDK docs. Or am i missing smth? https://github.com/Cerebellum-Network/cere-ddc-sdk-js/blob/9f634e6d736ca601fa1737bb0a373c53eeead6b8/packages/unified/docs/diagrams/12_migration_plan.mmd

Architecture related docs:
https://github.com/Cerebellum-Network/cere-ddc-sdk-js/blob/9f634e6d736ca601fa1737bb0a373c53eeead6b8/packages/unified/docs/diagrams/1_overall_architecture_explanation.md
https://github.com/Cerebellum-Network/cere-ddc-sdk-js/blob/9f634e6d736ca601fa1737bb0a373c53eeead6b8/packages/unified/docs/components.md
https://github.com/Cerebellum-Network/cere-ddc-sdk-js/blob/9f634e6d736ca601fa1737bb0a373c53eeead6b8/packages/unified/docs/architecture.md
https://github.com/Cerebellum-Network/cere-ddc-sdk-js/blob/9f634e6d736ca601fa1737bb0a373c53eeead6b8/packages/unified/docs/diagrams/0_1_component_descriptions_explanation.md
https://github.com/Cerebellum-Network/cere-ddc-sdk-js/blob/9f634e6d736ca601fa1737bb0a373c53eeead6b8/packages/unified/docs/README.md

At least 5 files that a talking about almost the same.

Security guide. Is it proposal, or already implemented, or what? https://github.com/Cerebellum-Network/cere-ddc-sdk-js/blob/9f634e6d736ca601fa1737bb0a373c53eeead6b8/packages/unified/docs/diagrams/10_security_diagram_explanation.md

Please, clean up all the docs so that there is no duplication, no noise. Execution plans - to SEK. Design proposals to either Notion or some other place. Guides/example + architecture overview is only what should be kept (as from my point of view, we can discuss if it doesn't make sense)

payload: this.transformPayloadForDDC(payload),
options: {
batchOptions: rules.additionalParams.batchOptions,
encryption: rules.additionalParams.encryption,
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have encryption implemented? how to pass any encrpyption params like encryption key or anything else?

encryption: rules.additionalParams.encryption,
ttl: rules.additionalParams.ttl,
...(this.isBullishCampaign(payload) && {
campaignTracking: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

what is campaignTracking?

*/
private transformPayloadForDDC(payload: any): any {
// For Telegram events, create a DagNode structure
if (this.isTelegramEvent(payload)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

no telegram specific logic

}

// For Bullish campaigns, create a DagNode structure with campaign metadata
if (this.isBullishCampaign(payload)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

no bullish specific logic

metadata: {
type: 'bullish_campaign',
campaignId: payload.campaignId,
eventType: payload.eventType,
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need this fields in metadata?

}

// For Nightingale video streams, create multipart structure
if (this.isNightingaleVideoStream(payload)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

no Nightingale specific logic


try {
// Initialize DDC Client with network preset
const networkConfig =
Copy link
Contributor

@upalinski upalinski Jul 24, 2025

Choose a reason for hiding this comment

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

is mainnet supported somehow?

response = await this.executeActivityAction(action);
break;

case 'http-api':
Copy link
Contributor

Choose a reason for hiding this comment

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

what action can we do using http-api?

if (!this.activityClient) {
this.logger('warn', 'Activity SDK not available - skipping activity action');
// Return a mock response to maintain workflow continuity
return {
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't there be an error?

priority: action.priority,
};

return await this.executeActivityAction(batchAction);
Copy link
Contributor

Choose a reason for hiding this comment

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

inside executeDDCACtion we call executeActivityAction. smth is wrong

/**
* Execute HTTP API action
*/
private async executeHTTPAction(action: Action): Promise<any> {
Copy link
Contributor

Choose a reason for hiding this comment

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

can be removed

* Check if action is campaign-related
*/
private isCampaignAction(action: Action): boolean {
return action.options?.campaignTracking || action.options?.questTracking || action.options?.campaignId;
Copy link
Contributor

Choose a reason for hiding this comment

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

questTracking options should be removed

/**
* Process campaign-specific logic after action execution
*/
private async processCampaignSpecificLogic(action: Action, response: any): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure there should be any campaign specific logic

/**
* Process quest update logic
*/
private async processQuestUpdate(payload: any, response: any): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

/**
* Update campaign metrics
*/
private async updateCampaignMetrics(payload: any, response: any): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

private mapDataCloudWriteMode(mode: string): ProcessingRules['dataCloudAction'] {
switch (mode) {
case 'direct':
return 'write_direct';
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of write_direct would be better to support 2 parameters.

e.g.

op: 'write'
mode: 'direct'

instead of merging this 2 parameters into one

@@ -0,0 +1,224 @@
# UnifiedSDK Test Suite
Copy link
Contributor

Choose a reason for hiding this comment

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

previosuly in SDK we used to write e2e tests that run against real infra running in docker compose.

The tests are here: https://github.com/Cerebellum-Network/cere-ddc-sdk-js/tree/main/tests/specs

at least UnifuedSDK spec should be added there, and might be there is no need to have so much unit tests and mocks but rather cover all main scenarious/use cases in that e2e spec.

It would be much easier to support.

Ofc if any unit test make sense to you, you can keep it. But i would suggest to follow existing naming convention. .spec.ts instead of .test.ts

  • might be better to keep spec.ts next to file that we test instead of separate folder. would be easier to navigate from component to it's testing class. I don't insist on this too much, just shared thought

jest.mock('../../Dispatcher');
jest.mock('../../Orchestrator');

describe('UnifiedSDK - Performance & Integration', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

performance test that uses mocks inside. Does it really make sense?

Not clear what exactly this performance test should verify, and taking into consideration the fact that there are mocks for all components under the hood...

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