Targeted stale wiki cache reuse fix
**Scope Audited** `module/` release/wiki wrapper flow and `toolkit/` wiki generation cache logic. **Changes Made** Root cause was stale wiki cache reuse. The generator cache considered digest + page count, but not generator version, so a restored VPS cache with old generated output could skip regeneration. Changed [wiki_native.go](/home/vicky/Projects/nwnee-shadowsoverwestgate/toolkit/internal/topdata/wiki_native.go:29) to bump the wiki generator to `nodebb-tiptap-html-v3`, and changed [wiki_native.go](/home/vicky/Projects/nwnee-shadowsoverwestgate/toolkit/internal/topdata/wiki_native.go:268) so cached pages are current only when `state.version` matches. **Configuration/Schema Impact** No YAML/config/schema changes. Existing `.cache/wiki/state.json` files with `nodebb-tiptap-html-v2` will be invalidated and regenerated. **Compatibility Impact** This is compatible with existing caches; it only forces one regeneration when the new toolkit runs. After that, normal digest-based skipping resumes. **Tests Added** Added [TestBuildWikiRegeneratesOldGeneratorCache](/home/vicky/Projects/nwnee-shadowsoverwestgate/toolkit/internal/topdata/wiki_native_test.go:183), which simulates a `v2` cache and verifies `build-wiki` regenerates it. **Validation Performed** - Confirmed new test failed before the fix with `wiki status "skipped"`. - `go test ./internal/topdata -count=1` passes. - `./build-tool.sh` succeeds. - `SOW_TOOLS_DEV_BINARY=../toolkit/tools/sow-toolkit ./build-wiki.sh` now reports: - `wiki pages: 1163` - `wiki status: generated` - Local generated race pages: `17`. **Remaining Risk / VPS Next Step** The VPS release job must use this rebuilt/published toolkit. On the next run, you should see the wiki build regenerate once before deploy, and deploy should load `1163` local pages instead of `1092`, including `races:*` pages.
This commit is contained in:
@@ -26,7 +26,7 @@ const (
|
||||
legacyWikiRootDirName = ".wiki"
|
||||
wikiPagesDirName = "pages"
|
||||
wikiStateFileName = "state.json"
|
||||
wikiGeneratorVersion = "nodebb-tiptap-html-v2"
|
||||
wikiGeneratorVersion = "nodebb-tiptap-html-v3"
|
||||
wikiGeneratedStatus = "generated"
|
||||
wikiSkippedStatus = "skipped"
|
||||
)
|
||||
@@ -266,6 +266,9 @@ func wikiStatusPagesEnabled(cfg project.TopDataWikiConfig) bool {
|
||||
}
|
||||
|
||||
func wikiCachedPagesAreCurrent(outputDir string, state wikiStateDocument) bool {
|
||||
if state.Version != wikiGeneratorVersion {
|
||||
return false
|
||||
}
|
||||
if state.Pages <= 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user