Summary
When a player+month combination has already been indexed and marked complete (is_complete = true in indexed_periods), the indexing worker skips it. There's no way to force a re-index — e.g. to pick up newly-added motifs, re-run analysis after a bug fix, or recover from a partial/corrupt run.
Add an optional forceReindex boolean to IndexRequest that bypasses the cached-period check.
Background
The skip logic lives in IndexWorker.java (lines 63–78):
Optional<IndexedPeriod> cached =
periodStore.findCompletePeriod(message.player(), message.platform(), monthStr);
if (cached.isPresent()) {
// ... skips fetch entirely
continue;
}
A forceReindex flag would cause this guard to be skipped, so all months in the requested range are re-fetched and re-inserted regardless of is_complete.
Proposed Changes
IndexRequest — add optional field
// IndexRequest.java
@JsonProperty("forceReindex")
Boolean forceReindex // defaults to false if absent
Pass forceReindex through the queue message (IndexMessage) to the worker.
IndexWorker — respect the flag
When forceReindex == true, skip the findCompletePeriod call (or ignore its result) and proceed to fetch and insert games for every month in the range.
Key files:
domains/games/apis/one_d4/src/main/java/com/muchq/games/one_d4/api/IndexController.java — constructs the queue message
domains/games/apis/one_d4/src/main/java/com/muchq/games/one_d4/worker/IndexWorker.java — contains the skip logic (lines 63–78)
- The queue message type (
IndexMessage) — needs the new field
IndexView.tsx / api.ts — UI checkbox
Add a checkbox to the index form:
[ ] Force re-index (ignore cached periods) (default: unchecked)
Wire into form state and pass forceReindex in the POST body.
Key files:
domains/games/apps/1d4_web/src/views/IndexView.tsx
domains/games/apps/1d4_web/src/api.ts — createIndex() (lines 37–44)
Acceptance Criteria
Summary
When a player+month combination has already been indexed and marked complete (
is_complete = trueinindexed_periods), the indexing worker skips it. There's no way to force a re-index — e.g. to pick up newly-added motifs, re-run analysis after a bug fix, or recover from a partial/corrupt run.Add an optional
forceReindexboolean toIndexRequestthat bypasses the cached-period check.Background
The skip logic lives in
IndexWorker.java(lines 63–78):A
forceReindexflag would cause this guard to be skipped, so all months in the requested range are re-fetched and re-inserted regardless ofis_complete.Proposed Changes
IndexRequest— add optional fieldPass
forceReindexthrough the queue message (IndexMessage) to the worker.IndexWorker— respect the flagWhen
forceReindex == true, skip thefindCompletePeriodcall (or ignore its result) and proceed to fetch and insert games for every month in the range.Key files:
domains/games/apis/one_d4/src/main/java/com/muchq/games/one_d4/api/IndexController.java— constructs the queue messagedomains/games/apis/one_d4/src/main/java/com/muchq/games/one_d4/worker/IndexWorker.java— contains the skip logic (lines 63–78)IndexMessage) — needs the new fieldIndexView.tsx/api.ts— UI checkboxAdd a checkbox to the index form:
Wire into form state and pass
forceReindexin the POST body.Key files:
domains/games/apps/1d4_web/src/views/IndexView.tsxdomains/games/apps/1d4_web/src/api.ts—createIndex()(lines 37–44)Acceptance Criteria
IndexRequestaccepts optionalforceReindex; omitting it (orfalse) preserves current skip behaviorforceReindex = true, the worker re-fetches and re-processes all months in the range, overwritingindexed_periodsvia upsertIndexViewhas a "Force re-index" checkbox (default unchecked); value sent asforceReindexin the POST bodyIndexWorker