bulltrackers-module 1.0.447 โ 1.0.448
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/functions/computation-system/workflows/datafeederpipelineinstructions.md +32 -0
- package/functions/generic-api/user-api/helpers/data_helpers.js +8 -8
- package/functions/generic-api/user-api/helpers/dev_helpers.js +2 -1
- package/functions/generic-api/user-api/helpers/on_demand_fetch_helpers.js +1 -1
- package/functions/generic-api/user-api/helpers/review_helpers.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Below is a quick-reference guide for testing the **Data Feeder Pipeline** using the Google Cloud Console UI.
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# ๐งช Workflow Testing Guide
|
|
6
|
+
|
|
7
|
+
When triggering a manual execution in the **GCP Workflows Console**, use the following JSON objects in the **Input** field to bypass the schedule and test specific components.
|
|
8
|
+
|
|
9
|
+
### How to Run a Test
|
|
10
|
+
|
|
11
|
+
1. Go to the **Workflows** page in your GCP Console.
|
|
12
|
+
2. Click on `data-feeder-pipeline`.
|
|
13
|
+
3. Click the **Execute** button at the top.
|
|
14
|
+
4. Paste the relevant **JSON Input** from the table below into the input box.
|
|
15
|
+
|
|
16
|
+
### Test Commands
|
|
17
|
+
|
|
18
|
+
| Component to Test | JSON Input | Description |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| **Market Data** | `{"target_step": "market"}` | Runs `price-fetcher`, `insights-fetcher`, and `market-data-indexer`. |
|
|
21
|
+
| **Rankings** | `{"target_step": "rankings"}` | Runs the `fetch-popular-investors` function specifically. |
|
|
22
|
+
| **Social Orchestrator** | `{"target_step": "social"}` | Runs the midnight social task and the midnight data indexer. |
|
|
23
|
+
| **Global Sync** | `{"target_step": "global"}` | Triggers the `root-data-indexer` with no target date (Full Scan). |
|
|
24
|
+
| **Full Pipeline** | `{}` | Runs the entire 24-hour cycle from the beginning (Standard Run). |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
### ๐ก Pro-Tips for Testing
|
|
29
|
+
|
|
30
|
+
* **Variable Checking:** After an execution finishes, click the **Details** tab in the execution logs to see the final values of variables like `sleep_midnight` or `sleep_loop` to verify the UTC alignment math worked correctly.
|
|
31
|
+
* **Permissions:** Ensure your user account or the service account running the workflow has the `roles/workflows.invoker` role to trigger these tests.
|
|
32
|
+
* **Timeouts:** If testing the full loop, remember that the workflow will "pause" at the `sys.sleep` steps. You can see the status as **Active** while it waits for the next 3-hour window.
|
|
@@ -165,7 +165,7 @@ async function checkIfUserIsPI(db, userCid, config, logger = null) {
|
|
|
165
165
|
const { getDevOverride } = require('./dev_helpers');
|
|
166
166
|
const devOverride = await getDevOverride(db, userCid, config, logger);
|
|
167
167
|
|
|
168
|
-
if (devOverride && devOverride.pretendToBePI) {
|
|
168
|
+
if (devOverride && devOverride.enabled && devOverride.pretendToBePI) {
|
|
169
169
|
// Generate fake ranking entry for dev testing
|
|
170
170
|
const fakeRankEntry = {
|
|
171
171
|
CustomerId: Number(userCid),
|
|
@@ -588,7 +588,7 @@ async function getUserPortfolio(req, res, dependencies, config) {
|
|
|
588
588
|
const { getEffectiveCid, getDevOverride } = require('./dev_helpers');
|
|
589
589
|
const effectiveCid = await getEffectiveCid(db, userCid, config, logger);
|
|
590
590
|
const devOverride = await getDevOverride(db, userCid, config, logger);
|
|
591
|
-
const isImpersonating = devOverride && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
591
|
+
const isImpersonating = devOverride && devOverride.enabled && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
592
592
|
|
|
593
593
|
// If impersonating, check if the effective CID is a Popular Investor
|
|
594
594
|
// PIs store data in pi_portfolios_overall, not signed_in_users
|
|
@@ -784,7 +784,7 @@ async function getUserVerification(req, res, dependencies, config) {
|
|
|
784
784
|
const { getEffectiveCid, getDevOverride } = require('./dev_helpers');
|
|
785
785
|
const effectiveCid = await getEffectiveCid(db, userCid, config, logger);
|
|
786
786
|
const devOverride = await getDevOverride(db, userCid, config, logger);
|
|
787
|
-
const isImpersonating = devOverride && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
787
|
+
const isImpersonating = devOverride && devOverride.enabled && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
788
788
|
|
|
789
789
|
const { signedInUsersCollection } = config;
|
|
790
790
|
|
|
@@ -852,7 +852,7 @@ async function getUserComputations(req, res, dependencies, config) {
|
|
|
852
852
|
const { getEffectiveCid, getDevOverride } = require('./dev_helpers');
|
|
853
853
|
const effectiveCid = await getEffectiveCid(db, userCid, config, logger);
|
|
854
854
|
const devOverride = await getDevOverride(db, userCid, config, logger);
|
|
855
|
-
const isImpersonating = devOverride && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
855
|
+
const isImpersonating = devOverride && devOverride.enabled && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
856
856
|
|
|
857
857
|
const insightsCollection = config.unifiedInsightsCollection || 'unified_insights';
|
|
858
858
|
const resultsSub = config.resultsSubcollection || 'results';
|
|
@@ -1884,7 +1884,7 @@ async function checkIfUserIsPopularInvestor(req, res, dependencies, config) {
|
|
|
1884
1884
|
const { getEffectiveCid, getDevOverride } = require('./dev_helpers');
|
|
1885
1885
|
const effectiveCid = await getEffectiveCid(db, userCid, config, logger);
|
|
1886
1886
|
const devOverride = await getDevOverride(db, userCid, config, logger);
|
|
1887
|
-
const isImpersonating = devOverride && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
1887
|
+
const isImpersonating = devOverride && devOverride.enabled && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
1888
1888
|
|
|
1889
1889
|
// Use effective CID (impersonated or actual) to check PI status
|
|
1890
1890
|
const rankEntry = await checkIfUserIsPI(db, effectiveCid, config, logger);
|
|
@@ -1899,7 +1899,7 @@ async function checkIfUserIsPopularInvestor(req, res, dependencies, config) {
|
|
|
1899
1899
|
}
|
|
1900
1900
|
|
|
1901
1901
|
// Check if this is a dev override (pretendToBePI)
|
|
1902
|
-
const isDevOverride = devOverride && devOverride.pretendToBePI;
|
|
1902
|
+
const isDevOverride = devOverride && devOverride.enabled && devOverride.pretendToBePI;
|
|
1903
1903
|
|
|
1904
1904
|
// Return ranking data
|
|
1905
1905
|
return res.status(200).json({
|
|
@@ -2226,7 +2226,7 @@ async function getSignedInUserPIPersonalizedMetrics(req, res, dependencies, conf
|
|
|
2226
2226
|
const { getEffectiveCid, getDevOverride } = require('./dev_helpers');
|
|
2227
2227
|
const effectiveCid = await getEffectiveCid(db, userCid, config, logger);
|
|
2228
2228
|
const devOverride = await getDevOverride(db, userCid, config, logger);
|
|
2229
|
-
const isImpersonating = devOverride && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
2229
|
+
const isImpersonating = devOverride && devOverride.enabled && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
2230
2230
|
|
|
2231
2231
|
// Use effective CID (impersonated or actual) to check PI status
|
|
2232
2232
|
const rankEntry = await checkIfUserIsPI(db, effectiveCid, config, logger);
|
|
@@ -2240,7 +2240,7 @@ async function getSignedInUserPIPersonalizedMetrics(req, res, dependencies, conf
|
|
|
2240
2240
|
}
|
|
2241
2241
|
|
|
2242
2242
|
// Check if this is a dev override (pretendToBePI)
|
|
2243
|
-
const isDevOverride = devOverride && devOverride.pretendToBePI;
|
|
2243
|
+
const isDevOverride = devOverride && devOverride.enabled && devOverride.pretendToBePI;
|
|
2244
2244
|
|
|
2245
2245
|
// If dev override (pretendToBePI), generate sample data
|
|
2246
2246
|
if (isDevOverride) {
|
|
@@ -291,7 +291,8 @@ async function getEffectiveCid(db, userCid, config, logger = null) {
|
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
const devOverride = await getDevOverride(db, userCid, config, logger);
|
|
294
|
-
if
|
|
294
|
+
// Only use impersonation if dev override is enabled
|
|
295
|
+
if (devOverride && devOverride.enabled && devOverride.impersonateCid) {
|
|
295
296
|
if (logger && logger.log) {
|
|
296
297
|
logger.log('INFO', `[getEffectiveCid] DEV OVERRIDE: User ${userCid} impersonating CID ${devOverride.impersonateCid}`);
|
|
297
298
|
} else {
|
|
@@ -32,7 +32,7 @@ async function requestPiFetch(req, res, dependencies, config) {
|
|
|
32
32
|
const { getEffectiveCid, getDevOverride } = require('./dev_helpers');
|
|
33
33
|
const effectiveCid = await getEffectiveCid(db, userCid, config, logger);
|
|
34
34
|
const devOverride = await getDevOverride(db, userCid, config, logger);
|
|
35
|
-
const isImpersonating = devOverride && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
35
|
+
const isImpersonating = devOverride && devOverride.enabled && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
36
36
|
|
|
37
37
|
// Use effective CID for the request (impersonated or actual)
|
|
38
38
|
const requestUserCid = Number(effectiveCid);
|
|
@@ -189,7 +189,7 @@ async function submitReview(req, res, dependencies, config) {
|
|
|
189
189
|
const { getEffectiveCid, getDevOverride } = require('./dev_helpers');
|
|
190
190
|
const effectiveCid = await getEffectiveCid(db, userCid, config, logger);
|
|
191
191
|
const devOverride = await getDevOverride(db, userCid, config, logger);
|
|
192
|
-
const isImpersonating = devOverride && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
192
|
+
const isImpersonating = devOverride && devOverride.enabled && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
193
193
|
|
|
194
194
|
// Block self-reviews
|
|
195
195
|
if (Number(effectiveCid) === Number(piCid)) {
|
|
@@ -403,7 +403,7 @@ async function checkReviewEligibility(req, res, dependencies, config) {
|
|
|
403
403
|
const { getEffectiveCid, getDevOverride } = require('./dev_helpers');
|
|
404
404
|
const effectiveCid = await getEffectiveCid(db, userCid, config, logger);
|
|
405
405
|
const devOverride = await getDevOverride(db, userCid, config, logger);
|
|
406
|
-
const isImpersonating = devOverride && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
406
|
+
const isImpersonating = devOverride && devOverride.enabled && devOverride.impersonateCid && effectiveCid !== Number(userCid);
|
|
407
407
|
|
|
408
408
|
// Block self-reviews (user cannot review themselves)
|
|
409
409
|
if (Number(effectiveCid) === Number(piCid)) {
|