Skip to content

Conversation

@johankristianss
Copy link
Collaborator

No description provided.

johankristianss and others added 8 commits January 1, 2026 21:58
Handler Refactoring:
- Move GetStatistics, AddFunction, RemoveFunction, AddExecutor,
  AddAttribute, SetOutput from controller command queue to direct
  database calls in handlers
- Each handler now defines its own minimal Server interface
- Remove unused controller adapters from server_adapter.go
- Update tests to use direct DB calls

Database Connection Pool:
- Add configurable connection pool settings via environment variables:
  COLONIES_DB_MAX_OPEN_CONNS, COLONIES_DB_MAX_IDLE_CONNS,
  COLONIES_DB_CONN_MAX_LIFETIME, COLONIES_DB_CONN_MAX_IDLE_TIME
- Add STATE-only indexes for PROCESSES and PROCESSGRAPHS tables
- Add connection pool settings to docker-compose.yml

Cleanup TODOs:
- Add TODO comments to ResetDatabase, RemoveAllProcesses,
  RemoveAllProcessGraphs documenting orphaned channel cleanup
  issues in clustered deployments

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Bug fixes:
- Fix progress bar leak in Download when Quiet=true - pw was created
  but never stopped, causing goroutine leak
- Fix DownloadSnapshot not checking error from GetFileByID before
  using result, which could cause nil pointer dereference

Tests:
- Add error path tests for CalcChecksumsAndCompare
- Add tests for printSyncPlan with empty/nil sync plans
- Add edge case tests for RemoveFilesNotInDir
- Add invalid checksum handling tests
- Add CalcEtag error handling tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The old-style reconciliation embedded Old/New blueprints in the process
FunctionSpec. This is replaced by the cron-based approach that passes
blueprintName via KwArgs and fetches blueprints from the server.

Changes:
- Remove Reconciliation field from FunctionSpec struct
- Remove RECONCILIATION column from database schema
- Simplify process handler to only use FuncName="reconcile" approach
- Remove obsolete tests for embedded reconciliation

The Reconciliation type itself is kept as it's still used for computing
diffs when updating blueprints (to detect spec changes and bump generation).

Note: Existing databases need recreation or manual column drop.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add TestGetVersion for HandleVersion (was at 0% coverage)
- Add TestGetStatisticsUnauthorized for auth failure path
- Add TestGetClusterInfoUnauthorized for auth failure path

Improves server handler coverage from 56.5% to 65.9%.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Blueprint Architecture:
- Remove BlueprintHandler struct and Handler field from Blueprint
- Blueprint instances no longer override handler config from definition
- BlueprintDefinition.Spec.Handler is now the single source of truth
- Server uses definition handler for executor type and function name

FunctionSpec Cleanup:
- Remove unused Blueprint field from FunctionSpec struct
- Database still writes empty string to BLUEPRINT column for compatibility
- Skip deserialization of blueprint data from database

Handler Refactoring:
- Rename defaultExecutorType to executorType (not overridable)
- Set NodeName to executorType-functionName format for workflow DAGs
- Use BlueprintDefinition.Spec.Handler.FunctionName instead of hardcoding

CLI Updates:
- Update blueprint commands to get handler from BlueprintDefinition
- Remove handler display from blueprint table (not in Blueprint anymore)

Tests:
- Remove TestBlueprintInFunctionSpec (field removed)
- Update handler tests to verify new NodeName format
- Remove tests for blueprint handler override behavior

Cleanup:
- Delete TODO.md (completed tasks)
- Delete CHANGES.md (outdated)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove duplicate StaleExecutorDuration declaration in root.go
- Update server_adapter.go to match simplified Controller interface:
  - Remove GetGenerator, ResolveGenerator, GetGenerators from generatorControllerAdapter
  - Remove GetCron, GetCronByName, GetCrons from cronControllerAdapter
  - Add missing CronDB() method to ServerAdapter
- Remove ProcessGraphDB-related code from server handlers unit tests:
  - MockProcessGraphDB no longer needed (workflow stats removed from global stats)
  - Remove four workflow counting error tests

These changes align the codebase after rebasing onto main, which moved
some handler operations from controller methods to direct DB calls.

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
johankristianss and others added 7 commits January 1, 2026 22:27
- Add TestCloseWithContext to verify successful close with context
- Add TestCloseWithContextCancelled to verify cancelled context behavior
- Fix colonies_controller_test.go: change := to = for already declared err
- Fix colonies_controller_worker_test.go: set staleExecutorDuration field
  before calling cleanupStaleExecutors() (method no longer takes parameter)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The ProcessNotFound tests were expecting StatusInternalServerError (500)
but the handler correctly returns StatusNotFound (404) when process is nil.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- TestHandleRemoveFunction_FunctionNotFound: expect 404 (NotFound) not 400
- TestHandleRemoveFunction_GetFunctionError: expect 400 (BadRequest) not 403

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Process handler tests:
- Fix TestHandleGetProcess_NotFound: expect 404 (NotFound) not 500
- Fix TestHandleRemoveProcess_Success: set process state to PENDING
  (handler rejects removing RUNNING processes)
- Fix TestHandleRemoveAllProcesses: use processDB mock instead of
  controller (handler now uses ProcessDB directly)
- Add removeAllProcessesErr field to MockProcessDB

ProcessGraph handler tests:
- Add MockProcessGraphDB with all required interface methods
- Add ProcessGraphDB() method to MockServer

Makefile:
- Enable fs package tests (uncommented)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename TestHandleRemoveProcessGraph_ControllerError to _DBError
- Rename TestHandleRemoveAllProcessGraphs_ControllerError to _DBError
- Use processGraphDB.removeErr and removeAllErr instead of controller
- Update RemoveAllWaitingProcessGraphsByColonyName mock to return error

The handlers now use ProcessGraphDB directly instead of Controller.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update test to expect "reconcile_worker" (from BlueprintDefinition)
instead of hardcoded "reconcile". The handler uses the FunctionName
configured in the BlueprintDefinition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add the following packages to the test target:
- pkg/server/handlers/blueprint
- pkg/server/handlers/channel
- pkg/server/handlers/location
- pkg/client
- pkg/client/backends
- pkg/server/registry
- pkg/validate
- pkg/channel

These were being tested by coverage (go list ./pkg/...) but not by
make test, causing test failures to go undetected until coverage ran.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

❌ Patch coverage is 58.42105% with 79 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.19%. Comparing base (bc14acb) to head (a4baf82).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
pkg/database/postgresql/database.go 45.45% 12 Missing and 18 partials ⚠️
pkg/server/handlers/blueprint/handlers.go 58.97% 12 Missing and 4 partials ⚠️
pkg/backends/gin/eventhandler.go 26.66% 8 Missing and 3 partials ⚠️
pkg/fs/fs_client.go 16.66% 4 Missing and 1 partial ⚠️
pkg/server/handlers/generator/handlers.go 0.00% 0 Missing and 5 partials ⚠️
pkg/database/postgresql/attributes.go 73.33% 0 Missing and 4 partials ⚠️
pkg/database/postgresql/processes.go 40.00% 0 Missing and 3 partials ⚠️
pkg/server/handlers/cron/handlers.go 0.00% 0 Missing and 3 partials ⚠️
pkg/client/process_client.go 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #172      +/-   ##
==========================================
- Coverage   70.49%   70.19%   -0.31%     
==========================================
  Files         239      239              
  Lines       19327    19475     +148     
==========================================
+ Hits        13625    13670      +45     
+ Misses       3844     3550     -294     
- Partials     1858     2255     +397     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@johankristianss johankristianss merged commit 6cfd94d into main Jan 2, 2026
1 of 3 checks passed
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