Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
8bca5c0
fix: cover plugin behavior and correct runtime edge cases
ryanbarlow97 Oct 7, 2026
16542e9
fix: cover configuration economy and faction workflows
ryanbarlow97 Oct 7, 2026
277475e
chore: link independently tested coverage foundation
ryanbarlow97 Oct 7, 2026
b92476e
fix: preserve state across reloads and war migrations
ryanbarlow97 Oct 7, 2026
db12ea5
fix: preserve plugin state and reject stale actions
ryanbarlow97 Oct 7, 2026
1e2ad02
Merge reviewed foundation fixes into complete coverage
ryanbarlow97 Oct 7, 2026
9e9d2ee
fix: preserve live definitions after rejected reloads
ryanbarlow97 Oct 7, 2026
38f5038
fix: preserve legacy wars and raid membership during reload
ryanbarlow97 Oct 7, 2026
c4fd66d
Merge branch 'test/coverage-foundation' into test/complete-plugin-cov…
ryanbarlow97 Oct 7, 2026
e4073ce
test: clean up failed faction fixture construction
ryanbarlow97 Oct 7, 2026
de1fab8
fix: retain guild capitals across configuration reloads
ryanbarlow97 Oct 7, 2026
c6cfca6
fix: retain guild capitals across configuration reloads
ryanbarlow97 Oct 7, 2026
5f9ad31
Merge branch 'test/coverage-foundation' into test/complete-plugin-cov…
ryanbarlow97 Oct 7, 2026
b5305f1
fix: restore dependent guild definitions after rejected reloads
ryanbarlow97 Oct 7, 2026
ca01155
fix: restore dependent guild definitions after rejected reloads
ryanbarlow97 Oct 7, 2026
f8f211e
Merge branch 'test/coverage-foundation' into test/complete-plugin-cov…
ryanbarlow97 Oct 7, 2026
63b0a65
Merge remote-tracking branch 'origin/main' into test/complete-plugin-…
ryanbarlow97 Oct 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 9 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main]
pull_request:
branches: [main]
branches: [main, 'test/coverage-foundation']

permissions:
contents: read
Expand Down Expand Up @@ -74,3 +74,11 @@ jobs:
name: unit-test-reports-${{ github.run_id }}-${{ github.run_attempt }}
path: target/surefire-reports/
if-no-files-found: error

- name: Upload coverage reports
if: ${{ !cancelled() && hashFiles('target/site/jacoco/jacoco.xml') != '' }}
uses: actions/upload-artifact@v7
with:
name: coverage-reports-${{ github.run_id }}-${{ github.run_attempt }}
path: target/site/jacoco/
if-no-files-found: error
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ documentation.

The suite in `src/test` uses JUnit 5 and Mockito, mocking the Paper and plugin
APIs rather than starting a server. It checks plugin logic, not behaviour on a
live Paper server. Surefire writes reports to `target/surefire-reports/`. No
coverage gate is enforced.
live Paper server. Surefire writes reports to `target/surefire-reports/`. JaCoCo
writes HTML and XML reports to `target/site/jacoco/`; `verify` requires 100%
production line coverage with no
class or package exclusions. This is a line coverage gate, not a branch coverage
guarantee. CI uploads both test and coverage reports.

## License

Expand Down
36 changes: 35 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<version>main-SNAPSHOT</version>

<properties>
<argLine></argLine>
<maven.compiler.release>21</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.proc>full</maven.compiler.proc>
Expand Down Expand Up @@ -184,6 +185,38 @@
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.15</version>
<executions>
<execution><goals><goal>prepare-agent</goal></goals></execution>
<execution>
<id>coverage-report</id>
<phase>verify</phase>
<goals><goal>report</goal></goals>
</execution>
<execution>
<id>coverage-check</id>
<phase>verify</phase>
<goals><goal>check</goal></goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>MISSEDCOUNT</value>
<maximum>0</maximum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand All @@ -209,7 +242,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<argLine>-javaagent:${org.mockito:mockito-core:jar} -Xshare:off -Dnet.bytebuddy.experimental=true -Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
<argLine>@{argLine} -javaagent:${org.mockito:mockito-core:jar} -Xshare:off -Dnet.bytebuddy.experimental=true -Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
<failIfNoTests>true</failIfNoTests>
</configuration>
</plugin>
</plugins>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/tfminecraft/simplefactions/Cache.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import net.tfminecraft.simplefactions.war.battle.enums.DefenderRespawnMode;

public class Cache {
private Cache() {}

public static String mapRef;
/** Chapter slug for a future Archive prefill. Not the live upload folder. */
public static String chapterId = "unknown";
Expand Down
18 changes: 16 additions & 2 deletions src/main/java/net/tfminecraft/simplefactions/SimpleFactions.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,24 @@ public class SimpleFactions extends JavaPlugin{
private final VehicleMaintenanceDecayTask vehicleMaintenanceDecayTask =
new VehicleMaintenanceDecayTask();

private boolean startupComplete;

@Override
public void onEnable() {
startupComplete = false;
config = getConfig();
plugin = this;
FactionManager.inv = inventoryManager;
createFolders();
createConfigs();
try {
loadConfigs();
} catch (RuntimeException error) {
getLogger().log(java.util.logging.Level.SEVERE, "Cannot load SimpleFactions configuration; disabling before restoring saved state", error);
getServer().getPluginManager().disablePlugin(this);
return;
}
registerListeners();
loadConfigs();
registerRpCharactersIntegrationHooks();
vehicleRegistryPersistence = new VehicleRegistryPersistence(
new File(getDataFolder(), "Cache"),
Expand Down Expand Up @@ -365,6 +374,7 @@ public void onEnable() {
}
inventoryManager.start();
vehicleMaintenanceDecayTask.start();
startupComplete = true;
}
@Override
public void onDisable() {
Expand All @@ -376,8 +386,12 @@ public void onDisable() {
CampaignViewRefreshService.stop();
BattleManager.shutdown();
net.tfminecraft.simplefactions.war.battle.persistence.BattlePersistenceService.stopAutosave();
net.tfminecraft.simplefactions.war.battle.persistence.BattlePersistenceService.saveAll();
sessionManager.end();
if (!startupComplete) {
net.tfminecraft.simplefactions.identity.LeaderCharacters.reset();
return;
}
net.tfminecraft.simplefactions.war.battle.persistence.BattlePersistenceService.saveAll();
net.tfminecraft.simplefactions.inactivity.InactivityService.save();
saveFactionsForShutdown();
for(War w : WarManager.get()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ public List<LevyEntry> getLevies() {
if(total+count >= subject.getMembers().size()) {
count = subject.getMembers().size() - total;
}
total+=count;
if(count > 0) r.setSentToOverlord(count);
else continue;
count = Math.max(0, count);
total += count;
r.setSentToOverlord(count);
}
levies.add(new LevyEntry(subject, total));
for(LevyEntry e : subjectLevies) {
Expand Down
Loading