Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions migrations/20260316120000-token-pool-download-observability.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict';

var dbm;
var type;
var seed;
var fs = require('fs');
var path = require('path');
var Promise;

exports.setup = function(options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
Promise = options.Promise;
};

exports.up = function(db) {
var filePath = path.join(__dirname, 'sqls', '20260316120000-token-pool-download-observability-up.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
})
.then(function(data) {
return db.runSql(data);
});
};

exports.down = function(db) {
var filePath = path.join(__dirname, 'sqls', '20260316120000-token-pool-download-observability-down.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
})
.then(function(data) {
return db.runSql(data);
});
};

exports._meta = {
"version": 1
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ALTER TABLE token_pool_download
DROP COLUMN progress,
DROP COLUMN stage,
DROP COLUMN attempt_count,
DROP COLUMN last_failure_reason,
DROP COLUMN last_failure_at,
DROP COLUMN failure_count,
DROP COLUMN error_reason,
DROP COLUMN failed_at,
DROP COLUMN completed_at,
DROP COLUMN last_heartbeat_at,
DROP COLUMN claimed_at,
DROP COLUMN updated_at,
DROP COLUMN created_at;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ALTER TABLE token_pool_download
ADD COLUMN created_at BIGINT NULL,
ADD COLUMN updated_at BIGINT NULL,
ADD COLUMN claimed_at BIGINT NULL,
ADD COLUMN last_heartbeat_at BIGINT NULL,
ADD COLUMN completed_at BIGINT NULL,
ADD COLUMN failed_at BIGINT NULL,
ADD COLUMN error_reason LONGTEXT NULL,
ADD COLUMN failure_count INT NOT NULL DEFAULT 0,
ADD COLUMN last_failure_at BIGINT NULL,
ADD COLUMN last_failure_reason LONGTEXT NULL,
ADD COLUMN attempt_count INT NOT NULL DEFAULT 0,
ADD COLUMN stage VARCHAR(64) NULL,
ADD COLUMN progress LONGTEXT NULL;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"sentry:sourcemaps": "./node_modules/.bin/sentry-cli sourcemaps inject --org seize-ff --project allowlist-api ./dist && ./node_modules/.bin/sentry-cli sourcemaps upload --org seize-ff --project allowlist-api ./dist"
},
"dependencies": {
"@6529-collections/allowlist-lib": "0.0.130",
"@6529-collections/allowlist-lib": "0.0.131",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify the library version exists on npm and check for any changelog or breaking changes.

# Check if version 0.0.131 exists on npm
echo "=== Checking if version 0.0.131 exists on npm ==="
npm view `@6529-collections/allowlist-lib`@0.0.131 version 2>/dev/null || echo "Version not found on npm registry"

# Show recent versions for context
echo ""
echo "=== Recent versions of the package ==="
npm view `@6529-collections/allowlist-lib` versions --json 2>/dev/null | jq '.[-5:]' || echo "Could not fetch versions"

# List all imports from this library in the codebase to identify dependencies
echo ""
echo "=== Imports from `@6529-collections/allowlist-lib` in codebase ==="
rg -n "from '@6529-collections/allowlist-lib" --type ts | head -30

Repository: 6529-Collections/allowlist-api

Length of output: 4737


🏁 Script executed:

# Check if there's npm registry configuration
echo "=== Checking for .npmrc ==="
cat .npmrc 2>/dev/null || echo "No .npmrc file found"

echo ""
echo "=== Current package.json dependencies (lines around 28) ==="
sed -n '20,35p' package.json

echo ""
echo "=== Checking for lock files ==="
ls -la package-lock.json yarn.lock 2>/dev/null | head -5

echo ""
echo "=== Git log for package.json (recent changes) ==="
git log --oneline -n 10 -- package.json 2>/dev/null || echo "Git history not available"

echo ""
echo "=== Check if this is in a monorepo ==="
find . -maxdepth 3 -name "package.json" -type f | grep -v node_modules | head -10

Repository: 6529-Collections/allowlist-api

Length of output: 1456


🏁 Script executed:

#!/bin/bash
# Check package-lock.json for the library version
echo "=== Checking package-lock.json for `@6529-collections/allowlist-lib` ==="
grep -A 10 '"@6529-collections/allowlist-lib"' package-lock.json | head -20

echo ""
echo "=== Checking if the package resolves in lock file ==="
jq '.packages["node_modules/@6529-collections/allowlist-lib"].version' package-lock.json 2>/dev/null || echo "Could not extract version from package-lock.json"

echo ""
echo "=== Attempting to fetch from GitHub Package Registry ==="
# Try to fetch package info from GitHub registry (requires auth token, but let's check if it's discoverable)
curl -s -H "Accept: application/vnd.npm.install-v1+json" \
  "https://npm.pkg.github.com/@6529-collections/allowlist-lib" 2>/dev/null | jq '.versions | keys | .[-5:]' 2>/dev/null || echo "Could not access GitHub Package Registry (authentication may be required)"

echo ""
echo "=== Check if node_modules has the package installed ==="
ls -la node_modules/@6529-collections/allowlist-lib/ 2>/dev/null | head -5 || echo "Package not in node_modules (expected - sandbox environment)"

Repository: 6529-Collections/allowlist-api

Length of output: 848


Synchronize package.json and package-lock.json for @6529-collections/allowlist-lib.

The package.json declares version 0.0.131, but package-lock.json is still locked to 0.0.124. This mismatch will cause inconsistent dependency resolution across environments. Regenerate the lock file by running npm install (or npm ci after install) to ensure package-lock.json reflects the version specified in package.json, or revert package.json to 0.0.124 if 0.0.131 is not yet available on GitHub Package Registry.

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

In `@package.json` at line 28, The package.json dependency
"@6529-collections/allowlist-lib" is set to "0.0.131" but package-lock.json
still references "0.0.124"; update the lockfile to match by either running npm
install (or npm ci after installing) to regenerate package-lock.json so it
reflects 0.0.131, or if 0.0.131 isn't available, revert the version in
package.json back to "0.0.124" so both files are synchronized.

"@aws-sdk/client-secrets-manager": "^3.334.0",
"@aws-sdk/client-sns": "^3.335.0",
"@nestjs/axios": "^3.0.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApiProperty } from '@nestjs/swagger';
import { TokenPoolDownloadStatus } from '../../../repository/token-pool-download/token-pool-download-status';
import { TokenPoolDownloadStage } from '../../../repository/token-pool-download/token-pool-download-stage';

export class TokenPoolDownloadResponseApiModel {
@ApiProperty({
Expand Down Expand Up @@ -32,8 +33,108 @@ export class TokenPoolDownloadResponseApiModel {
})
readonly status: TokenPoolDownloadStatus;

@ApiProperty({
description: 'Raw persisted status of the token pool download.',
})
readonly rawStatus: TokenPoolDownloadStatus;

@ApiProperty({
description: 'Block number of the token pool consolidation.',
})
readonly consolidateBlockNo: number | null;

@ApiProperty({
required: false,
type: Number,
description: 'Creation timestamp of the token pool download.',
})
readonly createdAt?: number;

@ApiProperty({
required: false,
type: Number,
description: 'Last update timestamp of the token pool download.',
})
readonly updatedAt?: number;

@ApiProperty({
required: false,
type: Number,
description: 'Claim timestamp of the token pool download.',
})
readonly claimedAt?: number;

@ApiProperty({
required: false,
type: Number,
description: 'Last heartbeat timestamp of the token pool download.',
})
readonly lastHeartbeatAt?: number;

@ApiProperty({
required: false,
type: Number,
description: 'Completion timestamp of the token pool download.',
})
readonly completedAt?: number;

@ApiProperty({
required: false,
type: Number,
description: 'Failure timestamp of the token pool download.',
})
readonly failedAt?: number;

@ApiProperty({
required: false,
enum: TokenPoolDownloadStage,
description: 'Current execution stage of the token pool download.',
})
readonly stage?: TokenPoolDownloadStage;

@ApiProperty({
required: false,
type: Object,
description: 'Latest persisted progress details for the token pool download.',
})
readonly progress?: Record<string, unknown>;

@ApiProperty({
description: 'How many times the token pool download has been claimed.',
})
readonly attemptCount: number;

@ApiProperty({
description: 'How many times the snapshot has failed before.',
})
readonly failureCount: number;

@ApiProperty({
required: false,
type: Number,
description: 'Timestamp of the previous failure recorded for this snapshot.',
})
readonly lastFailureAt?: number;

@ApiProperty({
required: false,
description: 'Reason for the previous failure recorded for this snapshot.',
})
readonly lastFailureReason?: string | null;

@ApiProperty({
description: 'Whether the API considers the job stale.',
})
readonly stale: boolean;

@ApiProperty({
required: false,
description: 'Failure or stale-state reason for the token pool download.',
})
readonly errorReason?: string | null;

@ApiProperty({
description: 'Whether the UI may offer an in-place retry for this snapshot.',
})
readonly retryable: boolean;
}
17 changes: 17 additions & 0 deletions src/api/token-pool-download/token-pool-download.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,21 @@ export class TokenPoolDownloadController {
tokenPoolId,
});
}

@ApiOperation({
summary: 'Retry token pool download',
})
@ApiOkResponse({
type: TokenPoolDownloadResponseApiModel,
})
@Post('token-pool/:tokenPoolId/retry')
async retry(
@Param('allowlistId') allowlistId: string,
@Param('tokenPoolId') tokenPoolId: string,
): Promise<TokenPoolDownloadResponseApiModel> {
return await this.tokenPoolDownloadService.retry({
allowlistId,
tokenPoolId,
});
}
}
Loading
Loading