fix: clear stale APPROVED state when online version is older than submitted
- Add AppStoreService.clearStoreReview() to remove a store's review entry from storeReviewStatus JSON (used for false-positive cleanup) - refreshStoreReviewStatus: when existing state is APPROVED but polled onlineVersionCode < submittedCode, clear the stale state instead of leaving the misleading nonCurrentRelease flag in place Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
这个提交包含在:
父节点
8f2f29170e
当前提交
0c9fd338eb
@ -860,6 +860,24 @@ public class AppStoreService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a store's review entry from the version's storeReviewStatus.
|
||||||
|
* Used when a previously-written state is discovered to be a false positive
|
||||||
|
* (e.g. an old online version was incorrectly marked as nonCurrentRelease).
|
||||||
|
*/
|
||||||
|
public AppVersionEntity clearStoreReview(String versionId, String storeType) throws Exception {
|
||||||
|
synchronized (lockFor(versionId)) {
|
||||||
|
AppVersionEntity v = versionRepo.findById(versionId).orElseThrow();
|
||||||
|
Map<String, Object> reviewMap = parseReviewStatus(v.getStoreReviewStatus());
|
||||||
|
if (reviewMap.remove(storeType) != null) {
|
||||||
|
v.setStoreReviewStatus(mapper.writeValueAsString(reviewMap));
|
||||||
|
versionRepo.save(v);
|
||||||
|
log.info("Cleared store review state for {}/{}", versionId, storeType);
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Object lockFor(String versionId) {
|
private Object lockFor(String versionId) {
|
||||||
return versionLocks.computeIfAbsent(versionId, ignored -> new Object());
|
return versionLocks.computeIfAbsent(versionId, ignored -> new Object());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -866,9 +866,18 @@ public class StoreSubmissionService {
|
|||||||
// Already APPROVED (from webhook): version approved but pending distribution.
|
// Already APPROVED (from webhook): version approved but pending distribution.
|
||||||
// Do NOT overwrite with nonCurrentRelease=true — that would show a misleading
|
// Do NOT overwrite with nonCurrentRelease=true — that would show a misleading
|
||||||
// "已上线(非本次发布)" label when the version is simply awaiting distribution.
|
// "已上线(非本次发布)" label when the version is simply awaiting distribution.
|
||||||
|
int cmp = compareVersionCodes(polled.getOnlineVersionCode(), String.valueOf(v.getVersionCode()));
|
||||||
|
if (cmp < 0) {
|
||||||
|
// Previously incorrectly marked as nonCurrentRelease due to an older live version.
|
||||||
|
// Clear the stale state so the user can submit this newer version.
|
||||||
|
log.info("Manual refresh: {}/{} clearing stale APPROVED state — online {} < submitted {}",
|
||||||
|
v.getId(), storeType, polled.getOnlineVersionCode(), v.getVersionCode());
|
||||||
|
storeService.clearStoreReview(v.getId(), storeType);
|
||||||
|
} else {
|
||||||
log.debug("Manual refresh: {}/{} already APPROVED (webhook), store live version={} — pending distribution, no change",
|
log.debug("Manual refresh: {}/{} already APPROVED (webhook), store live version={} — pending distribution, no change",
|
||||||
v.getId(), storeType, polled.getOnlineVersionCode());
|
v.getId(), storeType, polled.getOnlineVersionCode());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if ("MI".equals(storeType)
|
} else if ("MI".equals(storeType)
|
||||||
&& polled.getReviewState() == StoreRemoteState.ReviewState.UNDER_REVIEW_XIAOMI) {
|
&& polled.getReviewState() == StoreRemoteState.ReviewState.UNDER_REVIEW_XIAOMI) {
|
||||||
// MI API cannot distinguish "approved, awaiting distribution" from "under review"
|
// MI API cannot distinguish "approved, awaiting distribution" from "under review"
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户