Velox Codebase Review TODO
Static review performed on 2026-07-05.
Scope:
- Reviewed the repository statically.
- Focused on first-party Velox code.
- Did not modify product code.
- Did not run a Delphi build or runtime tests.
- Vendor code was not treated as a normal refactoring target.
High Risk
REST API timeout can free an action while it is still executing
Files:
Classes\Service\vxManagerREST.pasClasses\Service\vxActionThread.pas
Evidence:
TvxRESTItem.ExecuteGETstarts atClasses\Service\vxManagerREST.pas:134.TvxRESTItem.ExecutePOSTstarts atClasses\Service\vxManagerREST.pas:194.- Both methods wait for
FIVE_MINS_MILLI. - On timeout they may call
FreeAndNil(lThread.Action)while the worker thread can still be running. TRESTActionThread.Executestarts atClasses\Service\vxActionThread.pas:626and can still be insideFAction.Execute.- Local variable
lActionis declared but not initialized beforeAssigned(lAction)checks.
Risk:
- Use-after-free.
- Access violations.
- Corrupted flow/action state.
- Database or connection cleanup running against objects still in use.
Suggested direction:
- Replace the timeout cleanup path with cooperative cancellation.
- Ensure the action lifetime is owned by one component.
- Initialize locals defensively.
- Do not free
lThread.Actionuntil the thread has actually finished.
REST endpoint dictionary is not consistently thread-safe
File:
Classes\Service\vxManagerREST.pas
Evidence:
SyncActionadds toFEndpointsatClasses\Service\vxManagerREST.pas:431.FreeOldRESTItemsiteratesFEndpointsatClasses\Service\vxManagerREST.pas:611.FreeOldRESTItemsremoves fromFEndpointsduring that iteration atClasses\Service\vxManagerREST.pas:618.- Request lookup uses locking, but update/removal paths do not appear to use the same locking consistently.
Risk:
- Race conditions while API requests are active.
- Collection-modified exceptions.
- Incorrect REST endpoint routing after sync.
Suggested direction:
- Use one consistent lock for all reads and writes to
FEndpoints. - Avoid removing dictionary items while enumerating the same dictionary.
- Consider building a removal list, then removing after enumeration.
Flow/action cancellation uses TerminateThread
Files:
Classes\Service\vxManagerExecution.pasClasses\vxExecutionMonitor.pasForms\frmMain.pasForms\frmLogs.pas
Evidence:
TvxExecutionItem.ForcefullyTerminatecallsTerminateThreadatClasses\Service\vxManagerExecution.pas:477.TvxExecutionMonitor.ForcefullyTerminateThreadscallsTerminateThreadatClasses\vxExecutionMonitor.pas:130.- Designer shutdown calls forceful termination at
Forms\frmMain.pas:1688. - Log UI can forcefully terminate an execution item at
Forms\frmLogs.pas:510.
Risk:
- Locks may remain held.
- COM state may not unwind correctly.
- Database connections may leak or remain in an invalid state.
- Module/action state may be partially updated.
Suggested direction:
- Move toward proper cooperative cancellation.
- Ensure actions and transports periodically check cancellation state.
- Reserve hard termination only for process shutdown fallback, if it must remain at all.
Core runtime classes and methods are high complexity
Files:
Classes\vxModule.pasClasses\vxActionMan.pasVeloxService\classMain.pasVeloxAPIService\classMain.pasClasses\Service\vxManagerREST.pasForms\frmSetupActions.pas
Evidence:
TvxModulestarts atClasses\vxModule.pas:86.TvxActionManstarts atClasses\vxActionMan.pas:299.TvxActionMan.ExecuteOncestarts atClasses\vxActionMan.pas:1994.TVeloxWorker.ServiceExecutestarts atVeloxService\classMain.pas:178.TVeloxWorker.OnIPCExecuteRequeststarts atVeloxService\classMain.pas:449.TVeloxAPIWorker.ServiceExecutestarts atVeloxAPIService\classMain.pas:193.TSetupActions.RefreshActionDetailsstarts atForms\frmSetupActions.pas:980.Forms\LinkedAction\frmSetupActions.pasis ignored by repository guidance and is not counted in active runtime/UI complexity.
Risk:
- Changes are hard to reason about.
- New runtime behavior can accidentally affect persistence, logging, threading, or UI behavior.
- Testing burden is high.
Suggested direction:
- Avoid broad rewrites.
- When touching these areas, make narrow changes and add focused regression coverage where possible.
- Extract behavior only when there is a clear ownership boundary.
32/64-bit pointer truncation in Code Library tree node links
Files:
Forms\frmCodeLibrary.pas
Evidence:
- Code Library node pointer variables are declared as
integer. - A node pointer is read with
Fields[Ord(cfNodePointer)].AsInteger. - That integer value is later cast back to
TvxCodeNode.
Risk:
- This is a direct pointer-to-32-bit-integer-to-pointer round trip.
- On 64-bit builds, object pointers can be truncated.
- Failure modes include access violations, incorrect tree navigation, or memory corruption when a selected Code Library item is opened.
Suggested direction:
- Do not store object pointers through
Integer/AsInteger. - Prefer a real object reference owner model, a lookup key, or pointer-width-safe storage such as
NativeIntwhere a pointer-sized cast is unavoidable. - Add explicit 64-bit Designer coverage for opening, searching, selecting, and refreshing Code Library nodes.
Medium Risk
Database update version 311 dispatches version 310
Files:
Classes\GUI\vxDBUpdate.pasClasses\GUI\vxDBUpdateVersion.pas
Evidence:
TVxDBUpdate.UpdateDatabasestarts atClasses\GUI\vxDBUpdate.pas:224.- Version
310dispatchesTVxDBUpdateVersion310atClasses\GUI\vxDBUpdate.pas:243. - Version
311also dispatchesTVxDBUpdateVersion310atClasses\GUI\vxDBUpdate.pas:244. TVxDBUpdateVersion311exists atClasses\GUI\vxDBUpdateVersion.pas:199.TVxDBUpdateVersion311.Updateexists atClasses\GUI\vxDBUpdateVersion.pas:1534.
Risk:
- Future database upgrades for version 311 may not run.
- Customers may have schema drift if that version becomes active.
Suggested direction:
- Confirm whether version 311 should dispatch
TVxDBUpdateVersion311. - If yes, update the dispatcher when ready.
TvxConnection.GetConfigNum is empty
File:
Classes\vxCon.pas
Evidence:
TvxConnection.ConfigNumThreadSafereturnsFConfigNumatClasses\vxCon.pas:366.TvxConnection.GetConfigNumstarts atClasses\vxCon.pas:452and has an empty body.
Risk:
- Calls through the non-thread-safe
ConfigNumproperty may return an undefined or default value. - Behavior may differ depending on which accessor is used.
Suggested direction:
- Confirm intended accessor behavior.
- If
GetConfigNumshould return the same field, implement it explicitly.
WinAPI ProcessIdToSessionId declaration is not 64-bit safe
File:
Classes\Tools\vxShell.pas
Evidence:
ProcessIdToSessionIdis declared withpSessionId: DWORD.GetSessionIdfromProccessIdcalls it withDWORD(@sessionId).- The Windows API expects the second parameter to be a pointer to
DWORD, not a 32-bit integer containing a pointer value.
Risk:
- On 64-bit builds, casting an address to
DWORDtruncates the pointer. - If this helper is used by service/session launching logic, the failure mode can be intermittent and machine-specific.
Suggested direction:
- Change the declaration to use a pointer-width-safe type such as
PDWORDor avarparameter. - Regression-test service/user-session helper paths in both 32-bit and 64-bit binaries.
Config template save result can hide earlier failures
File:
Classes\vxConfigTemplate.pas
Evidence:
TvxConfigTemplate.SaveAllModulesstarts atClasses\vxConfigTemplate.pas:592.- The method repeatedly assigns
FResult := Save.... - Final
Result := FResultoccurs atClasses\vxConfigTemplate.pas:692.
Risk:
- An early failed save can be overwritten by a later successful save.
- Template/config export may report success when part of the save failed.
Suggested direction:
- Accumulate failures instead of replacing the result each time.
- Preserve enough context to identify which save step failed.
TvxRESTManager.DisableAction is an active stub
File:
Classes\Service\vxManagerREST.pas
Evidence:
TvxRESTManager.DisableActionstarts atClasses\Service\vxManagerREST.pas:705.- The implementation body is commented out.
- There is no active
Resultassignment.
Risk:
- If called, the method is effectively a no-op.
- Boolean result is undefined.
Suggested direction:
- Either implement it or remove/replace call paths after confirming usage.
- If retained as intentionally unsupported, return an explicit value and log/raise appropriately.
VeloxService and VeloxAPIService duplicate service infrastructure
Files:
VeloxService\classMain.pasVeloxAPIService\classMain.pas
Evidence:
- Both services have similar startup, shutdown, IPC, user/password, config key, test mode, and display name logic.
- VeloxService helpers start around
VeloxService\classMain.pas:58. - VeloxAPIService helpers start around
VeloxAPIService\classMain.pas:55.
Risk:
- Fixes can be applied to one service and missed in the other.
- Future SSL/config changes may require duplicated work.
Suggested direction:
- Keep behavior aligned deliberately.
- Consider a shared service helper layer if the duplication becomes a source of defects.
Low-level ZIP and IBM MQ integration code needs 64-bit and Unicode regression coverage
Files:
Classes\Tools\vxZip.pasClasses\Transports\vxTransportIBMMQ.pas
Evidence:
vxZip.pasis a large hand-maintained ZIP implementation with historical comments about x64 support and compiler workarounds, extensive pointer arithmetic, and many ANSI/PAnsiChar Windows API calls.vxTransportIBMMQ.pasuses fixed-size buffers and IBM MQ API calls; queue-manager, connection-name, and channel-name values are copied into fixed arrays beforeMQCONNX.
Risk:
- These areas are close to operating-system or vendor ABI boundaries where 32/64-bit, character encoding, buffer length, and calling convention mistakes can become stability issues.
- ZIP handling can affect file transport reliability.
- MQ handling can affect production message delivery.
- It is unclear from static review alone whether the MQ connection-name buffer is populated from the intended configuration value.
Suggested direction:
- Build a focused regression set for 32-bit and 64-bit ZIP operations, including large archives and Unicode filenames.
- Test IBM MQ connections and message send/receive flows with both 32-bit and 64-bit client libraries.
- Treat changes here as high-risk unless backed by integration tests or a test MQ environment.
Action setup trial fork is ignored
Files:
Forms\frmSetupActions.pasForms\LinkedAction\frmSetupActions.pas
Evidence:
Forms\frmSetupActions.pasdefines the active Flow setup form.Forms\LinkedAction\frmSetupActions.pasis in an ignored trial/test/backup folder per repository guidance.- Main action form class starts at
Forms\frmSetupActions.pas:25. - Main
RefreshActionDetailsstarts atForms\frmSetupActions.pas:980.
Risk:
- Repository search results can still find the ignored fork.
Suggested direction:
- Treat
Forms\frmSetupActions.pasas the active setup source. - Ignore
Forms\LinkedAction\unless a task explicitly targets trial/test/backup code.
Action and SQL connection pools use list scans
Files:
Classes\vxActionPool.pasClasses\vxSQLConPool.pas
Evidence:
TvxActionPoolItemhas a comment:MAKE TDICTIONARYatClasses\vxActionPool.pas:28.TvxSQLConItemhas a comment:MAKE TDICTIONARYatClasses\vxSQLConPool.pas:32.GetActionand related paths scan lists atClasses\vxActionPool.pas:97.- SQL connection lookup scans lists at
Classes\vxSQLConPool.pas:101andClasses\vxSQLConPool.pas:283.
Risk:
- Performance may degrade as action/config/thread counts grow.
- Lock duration may increase under service load.
Suggested direction:
- Consider dictionary-backed lookup where identity keys are stable.
- Keep thread ownership and lifecycle behavior unchanged when changing lookup structure.
Module loading is globally serialized
File:
Classes\vxModule.pas
Evidence:
LoadModuleTemplatestarts atClasses\vxModule.pas:1483.- A global critical section is acquired at
Classes\vxModule.pas:1553. - The comment indicates this is related to ReportBuilder thread safety.
Risk:
- Service throughput may be limited when many flows/actions load modules concurrently.
- Long module load paths block unrelated module loads.
Suggested direction:
- Treat this as intentional until ReportBuilder/module thread-safety is better understood.
- If performance becomes a problem, investigate narrower locking around the unsafe component only.
Log database separation is not yet implemented
Files:
Classes\vxCon.pasClasses\dmSystemDB.pas
Evidence:
TvxConnection.SQLLreturnsSQLCatClasses\vxCon.pas:577.- Comments state that log connections currently use the active config connection.
- This matches the known future direction to split config and log databases.
Risk:
- Future log database work must carefully separate connection ownership, transaction behavior, and configuration.
Suggested direction:
- Keep this documented as intentional current behavior.
- When implemented, audit all callers of
SQLL,SQLC, and active config/log database access.
Low Risk
Large utility routines are difficult to change safely
Files:
Classes\Tools\vxZip.pasClasses\Tools\vxDateTools.pasClasses\vxAPI.pas
Evidence:
CompressExstarts atClasses\Tools\vxZip.pas:665.UncompressExstarts atClasses\Tools\vxZip.pas:1911.vxStringtoDateTimestarts atClasses\Tools\vxDateTools.pas:321.vxStringtoDateTimeValidstarts atClasses\Tools\vxDateTools.pas:571.TvxAPI.CreateOpenAPISchemastarts atClasses\vxAPI.pas:262.
Risk:
- Isolated utility code is not necessarily a runtime problem.
- The risk is mainly regression risk when changing these routines.
Suggested direction:
- Add targeted tests before changing behavior.
- Avoid refactoring unless needed for a specific defect or feature.
Ignored dead or experimental folders are documented
Folders:
_BACKUPClasses\_NEW
Evidence:
Classes\_NEW\velox_json_new\vxJSONEngine.pasexists.Classes\_NEW\velox_json_new\vxFileEngineJSON.pasexists.Classes\_NEW\vxFileEngineJSON.pasexists.- The reviewed references appeared self-contained within the experimental folder.
Risk:
- Repository search results include inactive code.
Suggested direction:
- Status is documented in
AGENTS.md:_BACKUP,Classes\_NEW,Forms\Action, andForms\LinkedActioncan be ignored unless a task explicitly targets them.
Duplicate Code Areas
- Velox service startup/shutdown/helper logic in
VeloxService\classMain.pasandVeloxAPIService\classMain.pas. - Action setup form behavior in active
Forms\frmSetupActions.pas; theForms\LinkedActionfork is ignored by repository guidance. - REST GET/POST execution flow in
Classes\Service\vxManagerREST.pas.
Dead Code / Stub Areas
Classes\Service\vxManagerREST.pas:TvxRESTManager.DisableAction.Classes\_NEW: ignored by repository guidance._BACKUP: ignored by repository guidance.
Thread Safety Concerns
- REST endpoint dictionary locking in
Classes\Service\vxManagerREST.pas. - REST timeout/action ownership in
Classes\Service\vxManagerREST.pasandClasses\Service\vxActionThread.pas. - Forceful thread termination in
Classes\Service\vxManagerExecution.pasandClasses\vxExecutionMonitor.pas. - Global module load critical section in
Classes\vxModule.pas.
32-bit / 64-bit Concerns
- High risk:
Forms\frmCodeLibrary.passtores object pointers through 32-bit integer fields before casting them back toTvxCodeNode. - Medium risk:
Classes\Tools\vxShell.paspasses a pointer toProcessIdToSessionIdthrough aDWORD. - Medium risk:
Classes\Tools\vxZip.pasmixes pointer arithmetic, ANSI APIs, and legacy ZIP code; it needs explicit Win64 and Unicode filename coverage. - Medium risk:
Classes\Transports\vxTransportIBMMQ.pasdepends on external IBM MQ structures and client libraries; verify structure packing, string encoding, and 32/64-bit client compatibility. - Low risk: several UI forms store small integer indexes in
TListItem.Data; these should use pointer-width-aware casts for clarity, although the reviewed cases do not appear to store real object pointers.
Performance Concerns
- List-based lookups in
Classes\vxActionPool.pas. - List-based lookups in
Classes\vxSQLConPool.pas. - Five-minute synchronous REST wait path in
Classes\Service\vxManagerREST.pas. - Global serialized module loading in
Classes\vxModule.pas.
Areas Difficult to Maintain
TvxModuleand module persistence/loading.TvxActionManexecution orchestration.- Velox service startup/shutdown/IPC logic.
- REST API execution and endpoint synchronization.
- Designer action setup forms.
- Config template save/import/export logic.
Open Questions
- Should database version
311dispatchTVxDBUpdateVersion311now, or is version 311 not yet active? - Is
TvxConnection.GetConfigNumunused, or should it returnFConfigNumlikeConfigNumThreadSafe? - Which code paths currently call
TvxRESTManager.DisableAction? - What is the desired cancellation model for long-running actions, transports, scripts, and database operations?
- Is the Code Library expected to be fully supported in 64-bit Designer builds?
- Which IBM MQ client bitness and version combinations are supported in production?
- What ZIP filename encodings must be supported for customer integrations?