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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ verbatim as the body of the matching GitHub release.

| Version | Date | Notes |
|---|---|---|
| v0.2.5 | 2026-11-23 | [changelog/v0.2.5.md](changelog/v0.2.5.md) |
| v0.2.4 | 2026-11-23 | [changelog/v0.2.4.md](changelog/v0.2.4.md) |
| v0.2.3 | 2026-11-20 | [changelog/v0.2.3.md](changelog/v0.2.3.md) |
| v0.2.2 | 2026-11-17 | [changelog/v0.2.2.md](changelog/v0.2.2.md) |
Expand Down
19 changes: 19 additions & 0 deletions changelog/v0.2.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# v0.2.5

One fix: the GEMINI and VERTEX provider types could not be created.

## Fixed

- **Creating a `GEMINI` or `VERTEX` provider no longer fails.** V1's
`providers_type_check` constraint only allowed `OPENAI` and `ANTHROPIC`, and v0.2.3
added the two new wire formats to the enum and the admin API without a migration for
the constraint. `POST /admin/providers` with `"type":"GEMINI"` (or `VERTEX`) answered
500 `internal_error` on Postgres, and the console's Add Provider dialog failed the same
way. The new V21 migration finds the check constraint through `information_schema`
(its name differs between Postgres and H2) and replaces it with one that lists all four
types.
- `ProviderTypeConstraintTest` inserts one provider per wire format, so a constraint that
drifts behind the enum fails the build instead of production.

Nothing else changed. v0.2.4's release notes cover the seeding change; deployments that
already run v0.2.4 only need this for native Gemini or Vertex.
2 changes: 1 addition & 1 deletion deploy/dokploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ database. The console is always a plain Application.
3. Compose path: `deploy/dokploy/compose.yml`.
4. **Trigger Type: On Tag**, with auto-deploy enabled. The gateway is a production
service; a pull request or a push to `Develop` must not restart it. A release tag
(`v0.2.4`) is the only thing that deploys — see "When it deploys" below.
(`v0.2.5`) is the only thing that deploys — see "When it deploys" below.
5. **Environment** (the compose file references all of these):

```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/SPRING-AI.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on Spring AI; the gateway never depends on it.
<dependency>
<groupId>io.github.an1ndra</groupId>
<artifactId>path-spring-ai</artifactId>
<version>0.2.4</version>
<version>0.2.5</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion path-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.an1ndra</groupId>
<artifactId>path-parent</artifactId>
<version>0.2.4</version>
<version>0.2.5</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
58 changes: 58 additions & 0 deletions path-gateway/src/main/java/db/migration/V21__Provider_types.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package db.migration;

import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

/**
* Widens the provider `type` check constraint to the wire formats the code supports.
*
* V1 only knew OPENAI and ANTHROPIC; v0.2.3 added GEMINI and VERTEX to the enum without a
* migration, so creating either provider failed with a constraint violation on Postgres
* and H2 alike (the admin API answered 500). The constraint's name depends on the
* database (Postgres derives `providers_type_check`, H2 generates `CONSTRAINT_n`), so the
* migration finds it through information_schema instead of guessing.
*/
public class V21__Provider_types extends BaseJavaMigration {

private static final String TABLE = "providers";

@Override
public void migrate(Context context) throws Exception {
Connection connection = context.getConnection();

for (String name : checkConstraints(connection)) {
try (Statement statement = connection.createStatement()) {
statement.execute("alter table " + TABLE + " drop constraint " + quote(name));
}
}

try (Statement statement = connection.createStatement()) {
statement.execute("alter table " + TABLE + " add constraint providers_type_check "
+ "check (type in ('OPENAI', 'ANTHROPIC', 'GEMINI', 'VERTEX'))");
}
}

private List<String> checkConstraints(Connection connection) throws Exception {
List<String> names = new ArrayList<>();
String sql = "select constraint_name from information_schema.table_constraints "
+ "where lower(table_name) = '" + TABLE + "' and constraint_type = 'CHECK'";
try (Statement statement = connection.createStatement();
ResultSet rows = statement.executeQuery(sql)) {
while (rows.next()) {
names.add(rows.getString(1));
}
}
return names;
}

/** Identifiers are read from the catalog, not user input; still quote them safely. */
private String quote(String identifier) {
return "\"" + identifier.replace("\"", "\"\"") + "\"";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.anindra.path;

import com.anindra.path.domain.Provider;
import com.anindra.path.domain.ProviderType;
import com.anindra.path.repo.ProviderRepository;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import static org.assertj.core.api.Assertions.assertThat;

/**
* V1's {@code providers_type_check} only allowed OPENAI and ANTHROPIC, so inserting a
* GEMINI or VERTEX provider failed with a constraint violation even though the enum and
* the admin API accepted both. V21 widens the constraint; this asserts every wire format
* the code knows about can actually be stored.
*/
@SpringBootTest(properties = {
"spring.datasource.url=jdbc:h2:mem:providertypes;MODE=PostgreSQL;DB_CLOSE_DELAY=-1",
"spring.jpa.hibernate.ddl-auto=validate",
"gateway.admin-token=test-admin",
"gateway.bootstrap-demo-key=false",
"gateway.master-key-path=./target/test-master.key"
})
class ProviderTypeConstraintTest {

@Autowired
private ProviderRepository providers;

@Test
void everyWireFormatFitsTheCheckConstraint() {
for (ProviderType type : ProviderType.values()) {
String slug = "type-" + type.name().toLowerCase();
providers.saveAndFlush(
new Provider(slug, type.name(), type, "https://example.test/v1"));
}

assertThat(providers.findAll())
.extracting(Provider::getType)
.containsExactlyInAnyOrder(ProviderType.values());
}
}
2 changes: 1 addition & 1 deletion path-spring-ai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.an1ndra</groupId>
<artifactId>path-parent</artifactId>
<version>0.2.4</version>
<version>0.2.5</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>io.github.an1ndra</groupId>
<artifactId>path-parent</artifactId>
<version>0.2.4</version>
<version>0.2.5</version>
<packaging>pom</packaging>
<name>path-parent</name>
<description>Build parent for Path, the provider-agnostic LLM gateway, and its Spring AI adapter</description>
Expand Down
Loading