Skip to content

fix(docs-site): return 404 for non-existent routes#159

Merged
eskp merged 1 commit intostagingfrom
fix/docs-site-404-handling
Jan 21, 2026
Merged

fix(docs-site): return 404 for non-existent routes#159
eskp merged 1 commit intostagingfrom
fix/docs-site-404-handling

Conversation

@eskp
Copy link
Copy Markdown

@eskp eskp commented Jan 21, 2026

Summary

  • Add dynamicParams = false to prevent dynamic route rendering for non-existent paths
  • Add try/catch around metadata generation for safety

Problem

Bots and users accessing non-existent routes (e.g., /.env, /js/*.js, /admin/roles/3) caused MODULE_NOT_FOUND errors because Nextra tried to dynamically import MDX files that don't exist.

Solution

Setting dynamicParams = false tells Next.js to return a proper 404 for any routes not pre-generated by generateStaticParams.

Test plan

  • Build passes locally
  • Verify 404 returned for non-existent routes after deployment
  • Confirm error logs no longer show MODULE_NOT_FOUND spam

Add dynamicParams = false to prevent Next.js from trying to
dynamically render routes not generated by generateStaticParams.

This fixes MODULE_NOT_FOUND errors when bots/users access
non-existent paths like /admin/roles/3, /.env, /js/*.js, etc.
@eskp eskp merged commit 9669f9f into staging Jan 21, 2026
1 check failed
@eskp eskp deleted the fix/docs-site-404-handling branch January 21, 2026 01:08
eskp added a commit that referenced this pull request Jan 22, 2026
* feat: KEEP-1229 Add workflow profiling and analysis scripts

- Add scripts/analyze-steps.ts for static code analysis of step functions
- Add scripts/profile-step.ts for CPU profiling individual steps
- Add scripts/workflow-runner-profiled.ts for profiled workflow execution
- Add scripts/reset-password.ts utility for password resets
- Add @noble/hashes and prom-client dependencies

* feat: Remove allowlist

* feat: add database-backed metrics collection

Workflow runner jobs exit before Prometheus can scrape them, causing
metrics to be lost. This module queries execution statistics directly
from the database to provide persistent metrics.

- getWorkflowStatsFromDb(): queries workflow_executions table for
  status counts and duration histogram data
- getStepStatsFromDb(): queries workflow_execution_logs table for
  step-level metrics by type and status

* refactor: use DB-sourced gauges for workflow metrics

Replace Counter/Histogram metrics with Gauge metrics for workflow
executions and steps. These gauges are populated from the database
on each Prometheus scrape via updateDbMetrics().

Metrics now use original names (no _db suffix):
- keeperhub_workflow_executions_total{status}
- keeperhub_workflow_execution_errors_total
- keeperhub_workflow_execution_duration_ms_bucket{le}
- keeperhub_workflow_step_executions_total{step_type,status}
- keeperhub_workflow_step_errors_total{step_type}
- keeperhub_workflow_step_duration_ms_bucket{le}

This ensures metrics persist even when workflow runner jobs exit
before Prometheus can scrape them.

* feat: sync DB metrics before each Prometheus scrape

Call updateDbMetrics() before returning metrics to ensure fresh
workflow execution data from the database on each scrape.

* feat: add DB-sourced saturation metrics

Add additional metrics that can be derived from the database:
- workflow_queue_depth: pending workflow count from DB
- workflow_concurrent_count: running workflow count from DB
- user_active_daily: distinct users with active sessions in 24h

These metrics now reflect actual database state rather than
relying on in-process counters that may not be scraped.

* docs: update metrics reference for DB-sourced metrics

- Add Data Sources section explaining DB vs API process metrics
- Add Source column to all metric tables
- Document db-metrics.ts functions
- Update Prometheus metric names table with correct types
- Add DB-Sourced Metrics section explaining why DB queries are needed

* feat: add user and organization stats queries to db-metrics

Add getUserStatsFromDb() and getOrgStatsFromDb() functions to query
user and organization statistics from the database for Prometheus metrics.

User stats: total, verified, anonymous, with_workflows, with_integrations
Org stats: total, members_total, members_by_role, invitations_pending, with_workflows

* feat: add user and organization Prometheus gauges

Add DB-sourced gauges for user and organization metrics:
- keeperhub_user_total, keeperhub_user_verified_total, etc.
- keeperhub_org_total, keeperhub_org_members_by_role, etc.

Update updateDbMetrics() to populate these gauges on each scrape.

* docs: add user and organization metrics to reference

Add section 5 documenting user and organization metrics.
Update Prometheus metric names table, instrumentation files,
and DB-sourced metrics section with new tables queried.

* feat: add workflow, schedule, integration, and infra stats queries

Add new DB query functions for comprehensive metrics coverage:
- getWorkflowDefinitionStatsFromDb(): total, public, private, anonymous
- getScheduleStatsFromDb(): total, enabled, by last_status
- getIntegrationStatsFromDb(): total, managed, by type
- getInfraStatsFromDb(): API keys, chains, wallets, sessions

* feat: add Prometheus gauges for workflow, schedule, integration metrics

Add DB-sourced gauges:
- Workflow definitions: total, by visibility, anonymous
- Schedules: total, enabled, by last status
- Integrations: total, managed, by type
- Infrastructure: API keys, chains, wallets, sessions

Update updateDbMetrics() to populate all new gauges on each scrape.

* docs: add workflow, schedule, integration, infra metrics to reference

Add documentation for new metric categories:
- Workflow Definition Metrics (total, visibility, anonymous)
- Schedule Metrics (total, enabled, by status)
- Integration Metrics (total, managed, by type)
- Infrastructure Metrics (API keys, chains, wallets, sessions)

Update Prometheus metric names table and DB-sourced metrics section.

* docs: add architecture context to metrics reference

Add section explaining user/org/wallet model and expected metric
relationships:
- org.total ≈ para_wallet.total (1:1)
- user.total ≥ org.total (shared orgs via invites)
- user.anonymous = users without orgs (trial mode)
- Web3 steps require org + wallet

* docs: add missing metrics to Prometheus reference table

Add 15 missing metrics to the Prometheus Metric Names table:
- Histogram metrics: api.status.latency_ms, plugin.action.duration_ms,
  ai.generation.duration_ms, external.service.latency_ms
- Counter metrics: plugin.invocations.total, ai.tokens.consumed,
  api.errors.total, external.service.errors, db.query.slow_count
- Gauge metrics: duration histogram sum/count variants,
  db.pool.utilization

* docs: prune metrics reference to match implementation

Remove unimplemented metrics from documentation:
- api.requests.total, ai.tokens.consumed (never incremented)
- api.errors.total, external.service.errors (never called)
- db.pool.utilization, db.query.slow_count (dead code)
- external.service.latency_ms (never called)

Add cancelled status support to workflow execution stats.

Update Data Sources table and add note about DB histogram-as-gauge
semantics for Prometheus tooling compatibility.

* fix: reset label-based gauges to prevent stale Prometheus data

Reset orgMembersByRole, scheduleByLastStatus, integrationByType,
stepExecutionsTotal, and stepErrorsTotal gauges before repopulating
to prevent labels from lingering when categories are removed.

Also clarify collector behavior in docs: Prometheus uses DB snapshots
while console logger receives runtime increments.

* fix: silence Prometheus warnings for DB-sourced metrics and fix docs

- Add dbSourcedMetrics set to silently skip workflow/step metrics
  in Prometheus mode (they're populated via DB scrape instead)
- Fix api.webhook.latency_ms labels: add execution_id
- Fix api.status.latency_ms labels: add status_code, execution_status
- Add api.errors.total back to docs (emitted by webhook handler)

* refactor: remove dead metric code

Remove unused metrics infrastructure:
- apiRequests counter and counterMap entry (api.requests.total)
- aiTokensConsumed counter and counterMap entry (ai.tokens.consumed)
- startApiMetrics function and helper (never called by routes)
- API_REQUESTS_TOTAL and AI_TOKENS_CONSUMED from MetricNames

* refactor: remove dead external service metrics and fix DB-sourced allowlist

- Add workflow.queue.depth and workflow.concurrent.count to dbSourcedMetrics
  set to silence Prometheus warnings (these are populated from DB)
- Remove externalServiceLatency histogram (never used in production)
- Remove externalServiceErrors counter (never used in production)
- Remove recordExternalServiceCall function from plugin instrumentation
- Remove externalService parameter from recordPluginMetrics
- Remove EXTERNAL_SERVICE_ERRORS from MetricNames
- Remove dead startApiMetrics tests from api-metrics.test.ts
- Clean up plugin-metrics tests

* docs: add observability & metrics section to README

Link to metrics reference doc with brief overview of what's tracked:
- Workflow execution performance
- API latency
- Plugin action metrics
- User & organization stats
- Infrastructure metrics

* feat: Allow user to reassign email for para wallet

* Remove unused dialog

* Add pricing model documentation and smart contract specs (#105)

* Add pricing model documentation and smart contract specs

- Add billing section to docs with pricing and credits pages
- Document NFT-based tier system (Developer/Team/Company/Enterprise)
- Document credit system for workflow runs and gas payments
- Add smart contract specifications for KeeperHubTiers and KeeperHubCredits
- New orgs receive 2,500 free credits
- Credits never expire, no rollover complexity
- All payments via smart contract (ETH, USDC, USDT, USDS)

* Apply 50% price bump and add competitor comparison

- Team: $225/yr, $675 lifetime (was $199/$599)
- Company: $675/yr, $2,025 lifetime (was $449/$1,349)
- Add "How We Compare" section with Zapier, n8n, Pabbly comparison
- Update smart contract pricing configuration

* Hide billing section from docs sidebar

* Fix docs navbar border and sidebar ordering

- Add full-width navbar border using pseudo-element
- Rename Documentation to Overview in sidebar
- Move FAQ to end of sidebar
- Hide internal spec files from sidebar (organization-*, etc.)

* Fix pagefind on Alpine by adding libc6-compat to builder stage

* Revert "Fix pagefind on Alpine by adding libc6-compat to builder stage"

This reverts commit 4cea31e.

* style: fix lint formatting in metrics files

* Revert "Add pricing model documentation and smart contract specs (#105)" (#127)

This reverts commit e1844da.

* fix: resolve lint errors in metrics code

- Rename unused WORKFLOW_LABELS/STEP_LABELS to _WORKFLOW_LABELS/_STEP_LABELS
- Add default case to status switch statement
- Extract parseStepDurationBuckets helper to reduce cognitive complexity
- Fix test file formatting (remove extra blank line)

* feat: KEEP-869 add ERC20 token balance and transfer steps

Add workflow steps for ERC20 token operations:
- check-token-balance: Query balanceOf with auto-fetch of symbol/decimals/name
- transfer-token: ERC20 transfer with balance validation before send

Add shared contract infrastructure:
- lib/contracts/abis/erc20.json: OpenZeppelin IERC20Metadata ABI
- lib/contracts/abis/multicall3.json: Multicall3 ABI for batch calls
- lib/contracts/tokens.ts: Common token addresses per chain

* feat: KEEP-869 Add multi-token ERC20 support to wallet UI

- Add organization_tokens table for tracking ERC20 tokens per org
- Add /api/user/wallet/tokens API (GET, POST, DELETE)
- Add /api/user/wallet/balances API for fetching all balances
- Update wallet-overlay.tsx with multi-token display
- Update wallet-dialog.tsx with matching token features
- Add mainnet/testnet toggle switch
- Add scrollable balance lists
- Add "Add Token" and remove token functionality
- Update README with new Web3 steps

* refactor: KEEP-869 Extract wallet utilities and reduce component complexity

- Create shared wallet utilities in lib/wallet/:
  - types.ts: Shared types for wallet functionality
  - fetch-balances.ts: RPC balance fetching utilities
  - use-wallet-balances.ts: Custom hook for balance management

- Refactor wallet-overlay.tsx:
  - Extract sub-components for balance display
  - Extract section components (WalletInfoSection, BalanceListSection, NoWalletSection)
  - Use shared useWalletBalances hook

- Refactor wallet-dialog.tsx:
  - Extract sub-components for balance display
  - Extract section components
  - Use shared fetch utilities

- Remove all biome-ignore comments by properly reducing complexity

* chore: add migration for organization_tokens table (KEEP-869)

* chore: update drizzle metadata for migration 0009

* fix: lint and format issues

* feat: KEEP-869 Add token selection UI with supported and custom token support

Implement comprehensive token selection for workflow steps with both
system-supported stablecoins and custom ERC20 token addresses.

Token Selection UI (token-select-field.tsx):
- New component with toggle between "Supported Tokens" and "Custom Token" modes
- Multi-select dropdown for supported tokens (stablecoins from database)
- Custom token input with real-time ERC20 validation via RPC
- Visual badges showing selected tokens with removal capability
- Network-aware: resets selection when network changes

API Endpoints:
- GET /api/supported-tokens: Returns supported tokens, optionally filtered by
  network or chainId. Returns all tokens when no params provided.
- GET /api/validate-token: Validates ERC20 contract address and fetches
  symbol, name, decimals from blockchain

Shared Types (keeperhub/lib/wallet/types.ts):
- Consolidate token types as single source of truth
- SupportedToken: System-wide stablecoins from database
- CustomToken: User-provided addresses with validated symbols
- TokenFieldValue: Workflow config structure for token selection
- SupportedTokenBalance: Balance display with loading state

Wallet Dialog & Overlay Updates:
- Display supported token (stablecoin) balances alongside native balances
- Rate limiting mitigation: sequential RPC calls with 200ms delays
- Exponential backoff retry for 429 errors (up to 3 retries)
- Batch processing to avoid overwhelming RPC endpoints

Step Handler Updates:
- check-token-balance.ts: Support both supported and custom tokens,
  fetch balances for all selected tokens in parallel
- transfer-token.ts: Parse TokenFieldValue config, prioritize supported
  tokens then custom tokens for single-token transfer

Database & Seeding:
- Add supported_tokens table reference in schema
- seed-tokens.ts: Seed stablecoins (USDC, USDT, DAI) for all chains
- fix-dai-logo.ts: Utility to update DAI logo URLs

Plugin Registry:
- Add "token-select" field type to ActionConfigFieldBase
- Add networkField prop for network-aware token fetching

* feat: KEEP-869 Improve token UI and replace DAI with USDS

Token Selection UI improvements:
- Rename "Supported Tokens (Stablecoins)" to "Stablecoins"
- Rename "Custom Token Address" to "Import Token Address"
- Remove "Supported:" prefix from token badges (just show symbol)
- Change custom token format from "Custom: SYMBOL" to "SYMBOL (imported)"

Performance improvements:
- Lazy load token balances separately from wallet/chain data
- Wallet dialog now loads chains first (fast), then fetches balances in background
- Users see loading spinners while balances fetch instead of blocked UI

Stablecoin updates:
- Replace DAI with USDS (Sky/MakerDAO's new stablecoin) on Ethereum mainnet
- Remove DAI from testnets (USDS not deployed there yet)
- Rename fix-dai-logo.ts to fix-usds-logo.ts

Next.js config:
- Add raw.githubusercontent.com to allowed image domains for token logos

Database:
- Add migration 0010 for supported_tokens table

* hotfix: Re-instate missing mode tabs

* Fix docs navbar border and sidebar ordering (#128)

* Fix docs navbar border and sidebar ordering

- Add full-width navbar border using pseudo-element
- Rename Documentation to Overview in sidebar
- Move FAQ to end of sidebar
- Hide internal spec files from sidebar (organization-*, etc.)

* Remove non-existent organization and wallet files from hidden sections

These files were moved to specs/ and no longer exist in docs/

* Lint fix

* Remove billing from hidden sections since directory was deleted

* Remove billing from hidden sections since directory was deleted

* Fix pagefind build by adding libc6-compat to builder stage

* Revert "Fix pagefind build by adding libc6-compat to builder stage"

This reverts commit fb4b838.

* Add Claude Code agents and skills configuration

- Add 7 agent definitions (deployer, designer, developer, planner, reviewer, tester, writer)
- Add 3 skills (deploy-service, feature-dev, interview)
- Update claude.md configuration

* chore: KEEP 1218 Update Para env in production to prod

* Resolve duplicate Wallet email editor function

* refactor: KEEP-1229 Organize profiling scripts and add npm commands

- Move profiling scripts to scripts/workflow_runtime_analysis/
- Add calibrate-wasm-fuel.ts for WASM fuel metering analysis
- Add npm scripts: profile:analyze, profile:step, profile:workflow, profile:calibrate

* KEEP-1176 Wallet links and withdraw

* Fix linting errors

* fix: KEEP-869 Use shared RPC config for token seeding

- Add CHAIN_CONFIG mapping and getRpcUrlByChainId() to rpc-config.ts
- Update seed-chains.ts to use shared config
- Update seed-tokens.ts to use CHAIN_RPC_CONFIG instead of hardcoded public RPCs

This fixes token seeding in staging where public RPCs were being
rate-limited or blocked. Both seed scripts now use the same RPC
resolution: CHAIN_RPC_CONFIG -> env vars -> public defaults.

* chore: KEEP 1176 Return create wallet error to user

* chore: KEEP-1244 Speed up wallet loading

* Keep 1166 migrate events tracker and worker to the new app and improve resiliency (#118)

* Enhance trigger configuration and node components

- Added support for "Event" trigger type in TriggerConfig with corresponding fields for network, contract address, contract ABI, and event type.
- Updated TriggerNode to include an icon for the "Event" trigger type using the Boxes icon.
- Refactored trigger icon selection logic to use a mapping for better maintainability.

* Enhance TemplateAutocomplete to support trigger output fields

- Integrated keeperhub trigger output fields function for both "Event" and other trigger types in the getCommonFields function.
- Improved handling of output fields based on the trigger type configuration.

* Add ABI Event Select Field component and integrate into field renderer

- Introduced `AbiEventSelectField` component to dynamically parse ABI and display available events in a dropdown.
- Updated `abi-with-auto-fetch-field` to enhance functionality with additional hooks and state management.
- Registered the new component in the field renderer for seamless integration into the workflow configuration.

* Add trigger output fields for Event and other trigger types

- Introduced `getEventTriggerOutputFields` function to dynamically generate output fields based on ABI and event name.
- Added `getTriggerOutputFields` function to handle output fields for various trigger types including Event, Webhook, and Schedule.
- Enhanced the WorkflowTriggerEnum to include the new Event trigger type for better type safety in workflow configurations.

* Refactor import statement in trigger-node component for clarity

* Add Redis service for caching

- Adjusted formatting for consistency in service profiles.
- Added Redis service for caching with appropriate configurations for development and minikube profiles.

* Add internal API endpoint for fetching active Event-type workflows

- Created a new endpoint in `route.ts` to retrieve enabled workflows with Event trigger type.
- Implemented authentication using an internal API token from the environment configuration.
- Added logic to filter workflows based on their active status and trigger type.
- Included error handling for missing or invalid tokens and workflow parsing issues.
- Updated `.env.example` to include a placeholder for the new internal API token.

* Add 'enabled' column to workflows table and update schema

- Introduced a new boolean column 'enabled' to the workflows table with a default value of false.
- Updated the schema definition in schema.ts to reflect the addition of the 'enabled' field.
- Added a new SQL migration file for the database update.

* Update README.md to include internal API token and environment setup instructions

- Added a section for the internal API token required for worker services.
- Updated environment setup instructions to include the command for copying the example environment file.
- Enhanced service descriptions in the architecture section for clarity.

* Update package dependencies to include @radix-ui/react-switch and adjust ws version in pnpm-lock.yaml

* Add workflow enabled toggle functionality and UI component

- Introduced a new 'enabled' field in the workflow data model to manage workflow activation state.
- Added a Switch component for enabling/disabling workflows in the workflow toolbar.
- Updated the workflow editor to handle the new 'enabled' state and persist changes via API.
- Enhanced the workflow state management to include the enabled status.

* Refactor network mapping in GET request handler for improved readability

* Update workflow toolbar to conditionally display activation switch based on trigger type

- Modified the toolbar to show the workflow activation switch only when the trigger type is set to EVENT.
- Updated the label of the switch to reflect the current activation state (Activate/Deactivate) for better user clarity.

* Add initial implementation of event worker service

- Created Dockerfile for the worker service with environment variable support.
- Added package.json and package-lock.json for dependency management.
- Implemented worker.js to handle API interactions and data synchronization.
- Introduced configuration files for environment variables and logging.
- Developed httpService for API requests with authorization handling.
- Set up Express server with endpoints for data retrieval and workflow execution.

* Add initial implementation of smart contract event tracker

- Introduced the main application structure for tracking and synchronizing smart contract events using Node.js and Redis.
- Created Dockerfile for containerized deployment with environment variable support.
- Added package.json and package-lock.json for dependency management.
- Implemented core functionality for event handling, synchronization, and logging.
- Developed a modular architecture with support for multiple blockchain networks and extensibility for future integrations.
- Included README.md with project overview, features, installation instructions, and architecture details.

* Add core event handling and synchronization features

- Introduced a new child handler for processing event messages and managing workflow events.
- Implemented an abstract chain class for handling blockchain interactions, specifically for Ethereum Sepolia.
- Created an event handler factory to build specific chain handlers based on event configurations.
- Added utility functions for fetching active workflows and managing Redis synchronization.
- Updated existing files for improved module imports and consistency in naming conventions.
- Added a .gitignore file to exclude sensitive files and directories from version control.

* Fix linting issues

* Refactor event synchronization logic to improve modularity

- Introduced a syncModule for handling Redis synchronization within the event processing workflow.
- Updated the removeExcessProcesses and handleActiveWorkflows functions to accept an options object for better parameter management.
- Enhanced error handling and logging during the synchronization process.
- Improved code readability and maintainability by restructuring function signatures and adding detailed JSDoc comments.

* Rename variable in input mapping function for improved readability

* Add environment configuration for KEEPERHUB integration

- Introduced a new .env.example file to define environment variables for KEEPERHUB API integration.
- Updated worker.js and http-service.js to replace API_URL with KEEPERHUB_API_URL for fetching workflows and executing tasks.
- Modified environment.js to include KEEPERHUB_API_URL and KEEPERHUB_API_KEY for improved configuration management.

* Add .env.example file for environment variable configuration

- Created a new .env.example file to outline necessary environment variables for the application, including API_URL, WORKER_URL, Redis configuration, JWT credentials, and Etherscan API key.
- This addition aids in setting up the development environment and ensures proper configuration management.

* Refactor API_URL to KEEPERHUB_API_URL for improved integration

- Updated .env.example and environment.js to replace API_URL with KEEPERHUB_API_URL for better clarity in configuration.
- Modified abstract-chain.js and eth-sepolia-blockchain.js to utilize the new KEEPERHUB_API_URL for API requests, enhancing the integration with KEEPERHUB services.

* Refactor event handling and workflow execution for improved performance

- Updated handleEventMessage function to be asynchronous, allowing for better handling of event messages.
- Enhanced EthereumSepoliaBlockchain class by adding a new method to convert BigInt values to strings for JSON serialization.
- Improved event listener logic to ensure proper cleanup and prevent duplicate processing.
- Refactored process management in WorkflowHandler to include detailed logging and error handling during workflow termination and Redis key removal.

* Enhance HTTP service to support additional headers in API requests

- Updated the post method in HttpService to accept extra headers, improving flexibility for API interactions.
- Modified the workflow execution endpoint in worker.js to include an internal execution header, facilitating better tracking of execution context.

* Implement event processing enhancements in EthereumSepoliaBlockchain class

- Added methods to extract event arguments and build payloads from logs, improving event handling.
- Refactored the event log processing logic to streamline workflow execution and enhance readability.
- Introduced detailed logging for matched events and improved error handling during event processing.

* Update Dockerfiles to replace API_URL with KEEPERHUB_API_URL for consistency

- Modified Dockerfile.main and Dockerfile.worker to change the ARG and ENV variable from API_URL to KEEPERHUB_API_URL, aligning with recent integration improvements.

* Add KEEPERHUB_API_KEY environment variable with KEEPERHUB services

* Refactor workflow components and add custom keeperhub code

- Removed unnecessary whitespace in README.md.
- Added comments indicating custom keeperhub fields in various workflow-related files.
- Introduced a new Switch component for UI consistency.
- Updated the schema to include keeperhub-specific fields, enhancing integration capabilities.
- Improved code organization and readability across multiple components.

* Update Dockerfile.worker to streamline file copying for worker setup

- Modified the Dockerfile to copy package.json, worker.js, and the src directory, ensuring all necessary files are included for the worker environment setup.

* Add KEEPERHUB_API_KEY to environment variables in production and staging configurations

* Update label in trigger configuration from "Event Type" to "Event Name" for clarity

* Add GitHub workflows and Helm values for sc-event-tracker and sc-event-worker

- GitHub Actions workflows for both services (staging/prod)
- Helm values for Kubernetes deployments
- No service account required for these services
- References SSM parameters from keeperhub-events infrastructure

* Refactor event handling by introducing EvmChain class

- Replaced EthereumSepoliaBlockchain with a new EvmChain class for improved blockchain handling.
- Added methods for processing events, managing Redis transactions, and extracting event arguments.
- Enhanced event listener functionality and logging for better traceability and performance.

* Add NODE_ENV and KEEPERHUB_API_KEY to environment configurations

- Updated .env.example files for both sc-event-tracker and sc-event-worker to include NODE_ENV.
- Modified Dockerfiles to define NODE_ENV and KEEPERHUB_API_KEY as build arguments and environment variables.
- Adjusted Redis synchronization logic to incorporate NODE_ENV for better container identification and management.

* Update README and API token references to KEEPERHUB_API_KEY

- Changed references from INTERNAL_API_TOKEN to KEEPERHUB_API_KEY in README.md and route.ts for consistency.
- Added spacing in README.md for improved readability in the Action Nodes and Metrics sections.

* Refactor Redis configuration in EvmChain class to use environment variables

- Updated Redis connection parameters to utilize constants from the environment configuration file for better maintainability.
- Enhanced transaction key generation to include NODE_ENV for improved context in Redis keys.

* Add ETHERSCAN_API_KEY and PORT as environment variables in Dockerfiles

- Introduced ETHERSCAN_API_KEY in sc-event-tracker Dockerfile for enhanced API integration.
- Added PORT variable in sc-event-worker Dockerfile to allow for configurable service port.
- Updated environment variable definitions to improve flexibility and maintainability.

* Refactor logging in event tracker to use centralized logger

- Replaced console.log statements with logger methods across multiple files for consistent logging practices.
- Enhanced error handling by utilizing logger.error for error messages.
- Improved traceability of events and errors in the EvmChain and child-handler classes.

* Add missin DB snapshoot due to last migration

* Fix linting

---------

Co-authored-by: Simon KP <simon@techops.services>

* Add internal service authentication for MCP, events, and scheduler (#137)

* Add internal service authentication for MCP, events, and scheduler

- Add internal-service-auth.ts with timing-safe API key comparison
- Replace X-Internal-Execution header with proper X-Service-Key auth
- Update workflow execute route to use internal service auth
- Update schedule-executor to use SCHEDULER_SERVICE_API_KEY
- Add MCP, events, and scheduler service API keys to staging values

* Fix formatting

* Add internal service API keys to docker-compose dev profile

* Fix docker-compose dev profile to use localstack hostname

* chore: KEEP-1235 Remove organizations from user menu

* Restructure deployment workflows and standardize branch naming (#145)

* Restructure deployment workflows and standardize branch naming

- Rename deploy.yaml to deploy-keeperhub.yaml for clarity
- Create separate deploy-job-spawner.yaml workflow with workflow_run trigger
- Move deploy/prod and deploy/staging to deploy/keeperhub/prod and deploy/keeperhub/staging
- Update prod values.yaml to use /keeper-app/ paths for etherscan and sendgrid
- Standardize sc-event-tracker and sc-event-worker to use prod branch instead of main

* Use /keeperhub/ path for prod etherscan and sendgrid SSM parameters

* Refactor deployment workflows and rename job-spawner to scheduler (#146)

* Standardize AWS credentials in event service workflows

Use simple secrets.AWS_ACCESS_KEY_ID pattern instead of conditional

* Move scheduler and workflow-runner builds to job-spawner workflow

- Remove scheduler and workflow-runner build steps from deploy-keeperhub
- Add scheduler and workflow-runner build steps to deploy-job-spawner
- Update path triggers for job-spawner workflow

* Rename job-spawner to scheduler

- Rename deploy-job-spawner.yaml to deploy-scheduler.yaml
- Rename deploy/job-spawner/ to deploy/scheduler/
- Update SERVICE_NAME from keeperhub-job-spawner to keeperhub-scheduler
- Update comments and log messages

* fix: rename event services for consistent K8s naming (#147)

- Rename SERVICE_NAME from sc-event-tracker to keeperhub-events-tracker
- Rename SERVICE_NAME from sc-event-worker to keeperhub-events-worker
- Fix WORKER_URL to use correct K8s service name (keeperhub-events-worker-common)
- Fix KEEPERHUB_API_URL to use correct K8s service name (keeperhub-common)

The previous WORKER_URL pointed to sc-event-worker-staging which didn't exist
(K8s service is named {release}-common, not {service.name}).

* fix: rename EVENTS_SERVICE_API_KEY to KEEPERHUB_API_KEY

The code in app/api/workflows/events/route.ts expects KEEPERHUB_API_KEY
but the values.yaml had it named EVENTS_SERVICE_API_KEY.

* feat: KEEP-869 Fix balance precision and add TEMPO pathUSD display

- Add BigInt-safe formatWeiToBalance to prevent precision loss on large values
- Display unlimited testnet balances as "∞" symbol
- Show pathUSD as primary balance for TEMPO chain instead of native token
- Add TEMPO stablecoins (pathUSD, AlphaUSD, BetaUSD, ThetaUSD) to seed script
- Fix withdraw modal to handle unlimited balance validation
- Add comprehensive unit tests for balance formatting (51 tests)

* fix: use EVENTS_SERVICE_API_KEY for events service auth

The events worker sends KEEPERHUB_API_KEY in X-Internal-Token header.
Keeperhub should validate against EVENTS_SERVICE_API_KEY (both load
from the same SSM parameter).

* chore: remove default Node.js metrics from Prometheus output

* chore: KEEP 1236 Fix organization slug bug

* feat: KEEP-869 Unified stablecoin display with individual withdraw buttons

- Show stablecoins inside same card as chain header for all chains
- Add individual withdraw button for each stablecoin with positive balance
- Replace infinity symbol with zero for testnet mock balances
- Remove unused SupportedTokenBalanceDisplay component
- Update tests to reflect new mock balance behavior

* docs: remove Node.js default metrics from reference doc

Node.js default metrics (heap size, event loop lag, etc.) were
disabled in the Prometheus collector to keep the metrics output
focused on application-level observability.

* Add keeperhub logo to invitation

* Fix linting

* feat: KEEP-1215 add explorer links to web3 step outputs

- Add transactionLink to transfer-token, transfer-funds, write-contract outputs
- Add addressLink to check-balance, check-token-balance outputs
- Add explorerConfigs to drizzle schema for db.query access

* feat: KEEP-1215 add explorer links to workflow run history UI

- Add copy and external link icons next to node names in run history
- Show transactionLink for tx nodes (transfer-token, transfer-funds, write-contract)
- Show addressLink for balance/read nodes (check-balance, check-token-balance, read-contract)
- Add addressLink to read-contract step output

* hotfix: KEEP-1252 Remove Autofetch ABI

* feat: KEEP-1240 nonce management and gas estimation

- Add NonceManager with PostgreSQL advisory locks for distributed coordination
- Add AdaptiveGasStrategy with EIP-1559 fee optimization and retry escalation
- Add TransactionManager for unified transaction lifecycle management
- Add database tables for wallet_locks and pending_transactions
- Add gasConfig JSONB column to chains table for per-chain gas settings
- Integrate nonce/gas management into web3 action steps
- Add comprehensive unit and e2e tests
- Update biome config to disable problematic lint rules

* chore: KEEP-1240 increase volatility sample size to 40 blocks

* feat: KEEP-1229 Add unified profiling framework and docker profile

- Add profile-workflows docker compose profile with js-sandbox
- Fix import paths after moving scripts to subdirectory
- Add bootstrap script to patch server-only for CLI execution
- Add comprehensive report generator (pnpm profile:report)
- Add README documenting the profiling framework
- Update calibrate script to use port 3001 by default

Scripts:
- profile:analyze - Static AST analysis
- profile:step - V8 CPU profiling per step
- profile:workflow - Full workflow execution profiling
- profile:calibrate - WASM fuel calibration
- profile:report - Unified comprehensive report

* fix: KEEP-1240 add missing 0013 migration snapshot to journal

* chore: KEEP-1240 exclude drizzle/meta from biome linting

* fix: KEEP-1229 resolve lint issues in profiling scripts

* Keep 1242 allow proxy pattern (#157)

* Initial spec document

* Enhance ABI fetching from Etherscan with proxy detection support. Refactor fetch functions for improved clarity and error handling. Update API response to include proxy information and implementation address.

* Add source code fetching functionality to Etherscan API integration. Introduce new types for source code responses and enhance error handling for API calls.

* Implement proxy ABI handling in AbiWithAutoFetchField component. Add state management for proxy-related data and enhance UI to display proxy contract alerts. Update fetch logic to support proxy ABI retrieval and toggle functionality.

* Enhance Etherscan source code fetching to support Diamond contracts. Add new fields for contract name, diamond status, and facet addresses in the response. Update fetch logic to parse and return facet addresses when applicable.

* Implement Diamond contract support in AbiWithAutoFetchField component. Add DiamondProxyAlert for facet selection and enhance state management for diamond-related data. Update fetch logic to handle diamond proxy and direct contract ABIs, improving user experience with appropriate alerts and selection options.

* Enhance ABI fetching to support Diamond contracts with improved RPC detection. Introduce functions for fetching contract names and facet addresses, and update response structure to include diamond-related data. Refactor error handling and logging for better debugging.

* Enhance logging in workflow execution and update environment configuration to include EVENTS_SERVICE_API_KEY. Modify HTTP service to use EVENTS_SERVICE_API_KEY for internal token and service key headers.

* Update environment configuration in values.yaml files for production and staging to replace KEEPERHUB_API_KEY with EVENTS_SERVICE_API_KEY, ensuring consistent naming and parameter references across environments.

* Add EVENTS_SERVICE_API_KEY to Dockerfile.worker environment configuration

* Refactor Diamond contract handling in AbiWithAutoFetchField component. Replace DiamondProxyAlert with DiamondUnsupportedAlert to indicate unsupported proxy contracts. Update state management and error handling for proxy fields, ensuring proper configuration updates when dealing with proxy contracts.

* Add ProxyContractAlert component to handle proxy contract notifications in AbiWithAutoFetchField. Introduce getExplorerAddressUrl utility for generating blockchain explorer URLs. Refactor ABI fetching logic to streamline state management and improve user experience with proxy contracts.

* Refactor AbiWithAutoFetchField to improve chain fetching and proxy ABI handling. Introduce useMemo for explorer URL generation and streamline state management for proxy contracts. Enhance error handling and logging during ABI fetch operations.

* Remove client explorer file. Use chains config with fetched data for readability

* Refactor ABI fetching logic to improve input validation and streamline proxy detection. Introduce separate functions for validating inputs, detecting Diamond contracts via RPC, and handling Etherscan explorer proxy detection. Enhance error handling and logging throughout the process.

* Change EVENTS_SERVICE_API_KEY to KEEPERHUB_API_KEY in values

* Resolve conflict and maintain auto fetch removal

* Remove all instances of EVENTS_SERVICE_API_KEY on client

---------

Co-authored-by: taitsengstock <taitsengstock@gmail.com>

* fix(docs-site): return 404 for non-existent routes (#159)

Add dynamicParams = false to prevent Next.js from trying to
dynamically render routes not generated by generateStaticParams.

This fixes MODULE_NOT_FOUND errors when bots/users access
non-existent paths like /admin/roles/3, /.env, /js/*.js, etc.

* fix(docs-site): add middleware to prevent Nextra errors on invalid routes

Add middleware to intercept invalid top-level routes before they reach
the page component, preventing Nextra's importPage from logging errors.
Valid routes are whitelisted; invalid routes return 404 cleanly.

* Enhance schedule dispatcher to include enabled workflows

- Updated the database schema to include workflows in the dispatcher.
- Modified the query to fetch enabled schedules for both enabled workflows and schedules.

* Enhance workflow validation and overlay functionality

- Added a new `handleValidate` function to check for broken references, missing fields, and integrations before executing workflows.
- Integrated the `WorkflowIssuesOverlay` to display validation issues with customizable action labels.
- Updated the workflow toolbar to conditionally show an enable/disable switch based on the trigger type.

* Fix linting

* fix: KEEP-1253 ensure workflow.enabled is checked during execution

- Add workflow.enabled check in schedule-executor.ts to prevent execution
  of disabled workflows after they've been dispatched to SQS
- Add workflow.enabled check in job-spawner.ts to prevent spawning k8s
  jobs for disabled workflows
- Update deploy/local/hybrid/deploy.sh to use POSTGRES_DB from .env for
  worktree database name consistency
- Fix api-key-auth.test.ts with proper Vitest skip mechanism and lint
  compliance
- Fix web3-steps.test.ts by adding explorerConfigs mock to db mock

* test: KEEP-1253 add integration and e2e tests for disabled workflow handling

Unit tests (schedule-executor.test.ts):
- validates workflow is enabled before execution
- allows execution when workflow is enabled
- skips execution when workflow disabled after dispatch (race condition)

E2E tests (full-pipeline.test.ts):
- should skip execution for disabled workflow (job-spawner check)
- should handle race condition: workflow disabled after dispatch but before execution
- should allow execution for enabled workflow

* fix: lint errors in docs-site after rebase

* feature: KEEP-1164 Workflow templates

* Update spec

* Change Admin Service to Hub Service

* feat: KEEP-1164 Featured workflows on Hub page

* Add small diagram for each workflow template

* Fit up build linting issues, Remove display Image from fields

* fix: KEEP-1253 add workflow.enabled check to runner and fix tests

- Add defense-in-depth check in workflow-runner.ts for disabled workflows
- Update E2E test to verify runner cancels disabled workflow execution
- Remove trivial unit tests that only tested boolean logic
- Add enabled: true to test workflow inserts (schema defaults to false)
- Fix unused variable and formatting in workflow-toolbar.tsx

* Linting fix

* Update HTTP service to include X-Internal-Token in request headers

* fix: KEEP-1258 Chain seeding always updates existing records from env vars

* perf: KEEP-1257 Optimize scheduler Docker image with minimal dependencies

* fix: KEEP-1258 Align jsonKeys with AWS Parameter Store

* chore: KEEP-1258 Add eth-mainnet alias for consistency with AWS keys

* Resolve linting Issue on staging

* Remove fields that are causing lint error

---------

Co-authored-by: Jacob Sussmilch <suisuss@protonmail.com>
Co-authored-by: taitsengstock <taitsengstock@gmail.com>
Co-authored-by: Chong Yang <chong@techops.services>
Co-authored-by: Joel Orzet <joelorzt@gmail.com>
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