fix: read version and updated_at from SQL columns in config repository
The findByApplication query only read config_val JSONB, ignoring the version and updated_at SQL columns. The JSON blob contained version 0 from the original save, so agents saw no config and fell back to defaults. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,10 +22,13 @@ public class PostgresApplicationConfigRepository {
|
|||||||
|
|
||||||
public Optional<ApplicationConfig> findByApplication(String application) {
|
public Optional<ApplicationConfig> findByApplication(String application) {
|
||||||
List<ApplicationConfig> results = jdbc.query(
|
List<ApplicationConfig> results = jdbc.query(
|
||||||
"SELECT config_val FROM application_config WHERE application = ?",
|
"SELECT config_val, version, updated_at FROM application_config WHERE application = ?",
|
||||||
(rs, rowNum) -> {
|
(rs, rowNum) -> {
|
||||||
try {
|
try {
|
||||||
return objectMapper.readValue(rs.getString("config_val"), ApplicationConfig.class);
|
ApplicationConfig cfg = objectMapper.readValue(rs.getString("config_val"), ApplicationConfig.class);
|
||||||
|
cfg.setVersion(rs.getInt("version"));
|
||||||
|
cfg.setUpdatedAt(rs.getTimestamp("updated_at").toInstant());
|
||||||
|
return cfg;
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
throw new RuntimeException("Failed to deserialize application config", e);
|
throw new RuntimeException("Failed to deserialize application config", e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user