Skip to content

Commit e3808b1

Browse files
hack-cleanup: AxonFlowException catch + Maven mirror composite action (#152)
Hack-audit pass on the QF-14 Java workstream. Two leftover shortcuts flagged in the deep review: 1. examples/basic Basic.java caught `RuntimeException` for the community-fail-open path. The SDK exception hierarchy is rooted at `AxonFlowException extends RuntimeException`, so catching `RuntimeException` was overly broad — would have swallowed any non-SDK runtime error (NullPointerException from a SDK regression, IllegalStateException from a misuse, etc.) and printed it as "non-success". Tightened to `AxonFlowException`. The smoke now propagates non-SDK runtime errors to the JVM default handler, which exits non-zero and surfaces the stack trace. 2. The Maven mirror config block (~13 lines) was duplicated 5 times across ci.yml + integration.yml. Extracted to a composite action `.github/actions/setup-maven`. All 5 sites now reference `uses: ./.github/actions/setup-maven`. ~65 lines of YAML duplication removed; if the mirror URL ever rotates, one change instead of five. Verified: mvn install (parent + example) clean.
1 parent fdb3729 commit e3808b1

4 files changed

Lines changed: 35 additions & 79 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Setup Maven mirror
2+
description: |
3+
Configure ~/.m2/settings.xml with the Maven Central repo1 mirror. Used by
4+
every Maven CI job to pin against the same fast mirror and avoid the
5+
occasional Maven Central CDN flake the SDK builds have hit historically.
6+
runs:
7+
using: composite
8+
steps:
9+
- name: Configure Maven mirror
10+
shell: bash
11+
run: |
12+
mkdir -p ~/.m2
13+
cat > ~/.m2/settings.xml << 'EOF'
14+
<?xml version="1.0" encoding="UTF-8"?>
15+
<settings>
16+
<mirrors>
17+
<mirror>
18+
<id>central-mirror</id>
19+
<name>Maven Central Mirror (repo1)</name>
20+
<url>https://repo1.maven.org/maven2</url>
21+
<mirrorOf>central</mirrorOf>
22+
</mirror>
23+
</mirrors>
24+
</settings>
25+
EOF

.github/workflows/ci.yml

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,7 @@ jobs:
3232
cache: 'maven'
3333

3434
- name: Configure Maven mirror
35-
run: |
36-
mkdir -p ~/.m2
37-
cat > ~/.m2/settings.xml << 'EOF'
38-
<?xml version="1.0" encoding="UTF-8"?>
39-
<settings>
40-
<mirrors>
41-
<mirror>
42-
<id>central-mirror</id>
43-
<name>Maven Central Mirror (repo1)</name>
44-
<url>https://repo1.maven.org/maven2</url>
45-
<mirrorOf>central</mirrorOf>
46-
</mirror>
47-
</mirrors>
48-
</settings>
49-
EOF
35+
uses: ./.github/actions/setup-maven
5036

5137
- name: Build with Maven
5238
run: |
@@ -113,21 +99,7 @@ jobs:
11399
cache: 'maven'
114100

115101
- name: Configure Maven mirror
116-
run: |
117-
mkdir -p ~/.m2
118-
cat > ~/.m2/settings.xml << 'EOF'
119-
<?xml version="1.0" encoding="UTF-8"?>
120-
<settings>
121-
<mirrors>
122-
<mirror>
123-
<id>central-mirror</id>
124-
<name>Maven Central Mirror (repo1)</name>
125-
<url>https://repo1.maven.org/maven2</url>
126-
<mirrorOf>central</mirrorOf>
127-
</mirror>
128-
</mirrors>
129-
</settings>
130-
EOF
102+
uses: ./.github/actions/setup-maven
131103

132104
- name: Check code formatting
133105
run: |
@@ -162,21 +134,7 @@ jobs:
162134
cache: 'maven'
163135

164136
- name: Configure Maven mirror
165-
run: |
166-
mkdir -p ~/.m2
167-
cat > ~/.m2/settings.xml << 'EOF'
168-
<?xml version="1.0" encoding="UTF-8"?>
169-
<settings>
170-
<mirrors>
171-
<mirror>
172-
<id>central-mirror</id>
173-
<name>Maven Central Mirror (repo1)</name>
174-
<url>https://repo1.maven.org/maven2</url>
175-
<mirrorOf>central</mirrorOf>
176-
</mirror>
177-
</mirrors>
178-
</settings>
179-
EOF
137+
uses: ./.github/actions/setup-maven
180138

181139
- name: Package JAR
182140
run: |

.github/workflows/integration.yml

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,7 @@ jobs:
4747
cache: 'maven'
4848

4949
- name: Configure Maven mirror
50-
run: |
51-
mkdir -p ~/.m2
52-
cat > ~/.m2/settings.xml << 'EOF'
53-
<?xml version="1.0" encoding="UTF-8"?>
54-
<settings>
55-
<mirrors>
56-
<mirror>
57-
<id>central-mirror</id>
58-
<name>Maven Central Mirror (repo1)</name>
59-
<url>https://repo1.maven.org/maven2</url>
60-
<mirrorOf>central</mirrorOf>
61-
</mirror>
62-
</mirrors>
63-
</settings>
64-
EOF
50+
uses: ./.github/actions/setup-maven
6551

6652
# `-DskipUnitTests=true` is now a real toggle (bound to surefire's
6753
# <skipTests> via pom.xml); previously it was a no-op flag and unit
@@ -103,21 +89,7 @@ jobs:
10389
cache: 'maven'
10490

10591
- name: Configure Maven mirror
106-
run: |
107-
mkdir -p ~/.m2
108-
cat > ~/.m2/settings.xml << 'EOF'
109-
<?xml version="1.0" encoding="UTF-8"?>
110-
<settings>
111-
<mirrors>
112-
<mirror>
113-
<id>central-mirror</id>
114-
<name>Maven Central Mirror (repo1)</name>
115-
<url>https://repo1.maven.org/maven2</url>
116-
<mirrorOf>central</mirrorOf>
117-
</mirror>
118-
</mirrors>
119-
</settings>
120-
EOF
92+
uses: ./.github/actions/setup-maven
12193

12294
# 3-attempt retry for transient Maven Central flakes — same pattern
12395
# ci.yml's `Build with Maven` and `Run unit tests` use.

examples/basic/src/main/java/com/getaxonflow/examples/Basic.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.getaxonflow.sdk.AxonFlow;
2121
import com.getaxonflow.sdk.AxonFlowConfig;
2222
import com.getaxonflow.sdk.exceptions.AuthenticationException;
23+
import com.getaxonflow.sdk.exceptions.AxonFlowException;
2324
import com.getaxonflow.sdk.exceptions.ConnectionException;
2425
import com.getaxonflow.sdk.exceptions.PolicyViolationException;
2526
import com.getaxonflow.sdk.types.ClientRequest;
@@ -108,9 +109,9 @@ private static void proxyLLMCallStep(AxonFlow client, String clientId) {
108109
// These are real failures: bad creds or stack down. Fail loud.
109110
System.err.println("proxyLLMCall failed: " + e.getMessage());
110111
System.exit(1);
111-
} catch (RuntimeException e) {
112-
// Other runtime failures (e.g. agent returns non-2xx because no
113-
// LLM provider is configured) — log and continue. Tightening
112+
} catch (AxonFlowException e) {
113+
// Other SDK-level failures (e.g. agent returns non-2xx because
114+
// no LLM provider is configured) — log and continue. Tightening
114115
// this further requires capability detection from /health,
115116
// tracked in axonflow-sdk-java#146.
116117
System.out.println(" proxyLLMCall non-success: " + e.getMessage());
@@ -131,7 +132,7 @@ private static void listConnectorsStep(AxonFlow client) {
131132
} catch (AuthenticationException | ConnectionException e) {
132133
System.err.println("listConnectors failed: " + e.getMessage());
133134
System.exit(1);
134-
} catch (RuntimeException e) {
135+
} catch (AxonFlowException e) {
135136
System.out.println(" listConnectors non-success: " + e.getMessage());
136137
}
137138
}

0 commit comments

Comments
 (0)