Skip to content

feat(fcd): ship quest goal data over fcd - #2721

Merged
KochiyaOcean merged 11 commits into
masterfrom
feat/quest-goal-fcd
Sep 12, 2026
Merged

KochiyaOcean merged 11 commits into
masterfrom
feat/quest-goal-fcd

Conversation

@KochiyaOcean

@KochiyaOcean KochiyaOcean commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

What

Quest goal definitions now ship over fcd as well, with the bundled cson kept as the fallback, plus tracking for the limited-time quests that are still in period.

Quest data

Adds the limited-time (期間限定) quests to a new section at the end of quest_goal.cson:

id quest encoding
382 第三十一戦隊 緊急演習 3 × practice_win_a, 5+ of 花月/桐/榧/杉/樫/竹/潮/響, daily reset
384 提督との秋祭り演習 4 × practice_win (B+ counts), 4+ of the 17 named ships, daily reset
1048 戦略兵站物資、緊急輸送 1-3 / 1-4 boss A, flagship 補給・揚陸・水母・航戦, 4+ 駆逐/海防
1049 戦略兵站物資、拡張輸送 2-3 boss A and 7-5-2 (Q マス, edge 19) boss A

Left out on purpose, with the reasons recorded in the file: 383 フランス艦隊、特別演習 (period ended at the 2026-09-10 maintenance — an expired id must not be tracked, since the game reuses limited-time ids), 199 第三十一戦隊 特務編成 (composition-only; the engine matches events and there is no fleet-organisation event), and 秋祭り拡張演習 (id not yet observed).

Capture presence after the last maintenance is the reliable signal that a quest is live; absence proves nothing, because a quest also disappears from questlist once cleared. Periods were confirmed against the maintenance notes.

One-time quests

Adds 1052 改装多目的搭載母艦「北上改三」、出撃ッ! — S victory ×2 at 1-3, 2-4 and 4-5, flagship 北上改三 plus 2+ of 花月/潮/響/竹/桐/榧/杉/樫 — in a new One-time (単発) section, and establishes the encoding for that class of quest.

type exists only to drive record resets, and the game marks one-time quests api_type 4 + api_label_type 1. Such an entry deliberately carries no type: any reset type would delete the record at the next period boundary and throw away progress on a quest that is still open. New outdateRecords tests cover this, and pin down a related detail — a reset type wins over resetInterval, so a type: 4 record is deleted outright at a quarter boundary and re-created from the goals on the next questlist response.

Ships are matched by master id, not by name

Ship constraints now name a master ship id — the id where a ship starts counting — and the matcher expands it through api_aftershipid, so a goal covers that ship and every later remodel and nothing outside the line. New flagshipId / secondshipId / escortshipId alongside the old name fields, which are deprecated.

This fixes both directions of the substring matching it replaces:

  • over-matching: '潮' also counted 満潮・大潮・荒潮・黒潮・朝潮・親潮・早潮 — quests 350 and 1005 (「第七駆逐隊」) have been mis-counting for as long as they have been tracked;
  • missed renames: a renamed remodel shares no substring with its base, so 響改二 (Верный) fell out of the 第三十一戦隊 lists;
  • and it expresses 「〜改以降」 exactly, by naming the 改 id rather than the base.

escortshipId keeps escortship's OR semantics — one entry is enough — so a migrated list reads the same either way. escortshipIdAll is the AND form for the two quests that want two escort groups together (875, 1051); everything else is either a single entry (45 subgoals) or an OR (903).

All 25 name-based quests are migrated (97 distinct names, each resolving to exactly one master ship by exact name). To check the rewrite was faithful I diffed the old substring match set against the new id match set, ship by ship: 68 of 77 lists are identical, and all 9 that differ only drop ships that never belonged — no list gained anything unintended. The five multi-entry escortship blocks were converted by hand, because escortshipId entries are AND-ed where escortship's were OR-ed:

  • 903 (拡張「六水戦」) takes 由良改二 or 2 睦月-class — I first flattened this to an AND, which was wrong; it is back on the OR-ed escortshipId and matches the game again;
  • 875 (精鋭「三一駆」) had to encode 長波改二 + one of three as three OR-ed pairs — now two escortshipIdAll entries;
  • 1051 loses the "3 of these 6" approximation noted above and states 扶桑/時雨 ×1 + 最上/満潮/朝雲/山雲 ×2 exactly.

The remodel graph is not a chain: switchable variants (最上改二 ⇄ 最上改二特) form cycles and 24 ships are reachable from more than one remodel, so the expansion is a reachability walk with a seen set, memoised per $ships identity.

On 改/改二 quests specifically, since naming a stage is the whole point: of the 94 migrated goal ids that name a remodelled stage, none accepts an unremodelled ship — a 改-or-later quest can no longer pass a base ship, which is not something the substring form could guarantee. The one nuance is switchable variants: [622] (夕張改二) also accepts 改二特 and 改二丁, which is exactly what quest 903 asks for. Eleven new tests cover the expansion, the id matching, escortshipId OR vs escortshipIdAll AND, and the base-ship exclusion on a real cycle line (夕張).

Renamed remodels

satisfyShip matches ship names by substring, so a remodel that is renamed silently stops matching: 響改二 is 「Верный」, which '響' does not match. Both new 第三十一戦隊 lists (382, 1052) now carry '響', 'Верный'. Every other name list in the file was checked against the remodel chains in api_start2 master data — no other gaps — and the skill now records all 13 renamed remodels in the roster (雪風→丹陽, 大鯨→龍鳳, U-511→呂500, Littorio→Italia, …) so the next edit does not repeat this.

1170 既存装備活用による対空兵装の開発 stays untracked with the rest of the 工廠 family: its scrap counters would be trackable, but only if destory_item dispatches carried the first fleet's flagship, which the quest requires and the event does not pass.

fcd delivery

assets/data/quest_goal.cson stays the single source and the bundled fallback; fcd/build.js mirrors it into assets/data/fcd/questgoal.json, so a new or corrected quest can reach existing installs without a release.

  • views/redux/info/quests/goals.ts — parses the bundled table once, merges the delivered one over it per quest id (a delivered quest replaces the bundled one wholesale, so fcd can fix a required or drop a subgoal; ids the payload omits keep their bundled definition, because a cached payload can predate the build). Same reasoning as gameselector. Consequence: fcd can correct a quest but never delete one.
  • resyncQuestRecords carries progress across a goal change — a count survives a required correction (clamped), a dropped subgoal's record goes away, a new one starts at init.
  • views/redux/middlewares/quest-goals-fcd.ts re-applies the merge on @@updateFCD / @@replaceFCD and after every require_info, since either can come first and require_info reloads the bundled table. It acts on post-action state, unlike questsCrossSliceMiddleware.
  • fcd/build.js validates the cson before building (numeric ids, at least one subgoal, positive required), and buildMeta now enumerates assets/data/fcd/ instead of a hardcoded list — which also fixes a latent bug where any build run dropped gameselector from meta.json and silently stopped its delivery.

Delivering a new filter field still needs a release: the payload carries data only, and an older build ignores a field its matcher does not know.

Reset-period audit

Checked every quest's type — the field that drives record resets — against both the section it sits under and the api_type/api_label_type the game reports. Three were wrong:

  • 242 敵東方中枢艦隊を撃破せよ! sat in the Weekly section with type: 3, so poi held its record for a month while the game reset it weekly. A long-standing bug, not something this PR introduced.
  • 1167 装備の改修集中強化 is weekly with a 「本日中に…三回」 count. It was filed as a daily with a comment explaining the workaround; resetInterval: 1 expresses it properly now, so it becomes type: 2 in the Weekly section.
  • 313 秋季大演習 is 単発 per the game (api_type 4 / label 1), so it joins the one-time section and keeps only its daily counter.

fcd/build.js now asserts type against the section header, which is what caught the 1167 and 313 placements as I moved them. 138 quests, 0 mismatches after the fix.

Everything else in the audit came back clean: no unknown events or fields, no invalid required/init, every maparea in master data, every mapcell a real edge of its map, every mission name and slotitemId in master data, every ship id a player ship, and no goal wanting S where the quest text says A (or vice versa).

Two discrepancies I deliberately left alone: 211/212 are api_type 5 / label 7 (quarterly) in the API but poi treats them as special dailies (type: 8/9, plus the api_no === 211 || api_no === 212 case in filterActiveQuestFactory). The captures back poi up — both cycle through clear-and-reappear within days (211 cleared 08-10, active again 08-13, cleared 08-18, …) — so the existing special case stays.

Test

  • views/redux/info/__tests__/quest-goals-fcd.spec.ts — 15 new cases: merge fallback / override / addition, the record re-sync behaviours, and both delivery orders including the plugin-window @@replaceFCD path.
  • outdateRecords tests in quests.spec.ts for the one-time (no type) convention.
  • satisfyShip / shipRemodelSources tests for id matching: renames, 改-and-later, no over-match, AND-ed entries, flagship position.
  • Full suite: npx jest → 477 passed, 42 suites.
  • npx jest --runTestsByPath views/redux/info/__tests__/quests.spec.ts views/redux/info/__tests__/quest-goals-fcd.spec.ts → 32 passed.
  • npm run typecheck and eslint clean; node fcd/build.js is idempotent and bumps the version when the data changes.

🤖 Generated with Claude Code

KochiyaOcean and others added 2 commits September 13, 2026 03:00
382 第三十一戦隊 緊急演習, 384 提督との秋祭り演習, 1048/1049 戦略兵站物資.
383 is left out: its period ended at the 2026-09-10 maintenance.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
quest_goal.cson stays bundled as the fallback; fcd/build.js mirrors it
into assets/data/fcd/questgoal.json so a new or corrected quest reaches
existing installs without a release. Delivered quests are merged over the
bundled table per quest id, and existing tracking records keep their
progress across the change.

Also fixes buildMeta dropping gameselector from meta.json.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 12, 2026 18:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

One or more issues must be addressed before approval.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds FCD delivery for quest-goal definitions while retaining bundled CSON fallback, syncing active quest records, and tracking current limited-time quests.

Changes:

  • Adds goal merging and record resynchronization.
  • Adds FCD middleware, Redux types/actions, and generated payloads.
  • Validates quest data and updates the FCD manifest.
File summaries
File Description
views/redux/middlewares/quest-goals-fcd.ts Updated as part of this pull request.
views/redux/info/quests/types.ts Updated as part of this pull request.
views/redux/info/quests/index.ts Updated as part of this pull request.
views/redux/info/quests/goals.ts Updated as part of this pull request.
views/redux/info/tests/quest-goals-fcd.spec.ts Updated as part of this pull request.
views/redux/fcd.ts Updated as part of this pull request.
views/redux/create-store.ts Updated as part of this pull request.
views/redux/actions/quest.ts Updated as part of this pull request.
views/redux/actions/index.ts Updated as part of this pull request.
skills/quest-goal-data/SKILL.md Updated as part of this pull request.
fcd/build.js Updated as part of this pull request.
assets/data/quest_goal.cson Updated as part of this pull request.
assets/data/fcd/questgoal.json Updated as part of this pull request.
assets/data/fcd/meta.json Updated as part of this pull request.
Review details

Suppressed comments (2)

assets/data/quest_goal.cson:2162

  • The new goal lists the bare name 潮, but satisfyShip matches each configured name with optionShipName.includes(goalName), so 満潮・大潮・荒潮 also count toward this eight-ship requirement. That can mark quest 382 progress for fleets containing ships that are not named in the quest; encode an exact-name constraint (or otherwise make this goal use exact matching).
    # 花月/桐/榧/杉/樫/竹/潮/響 から5隻以上。'潮' は満潮・大潮・荒潮にも
    # substring 一致する(既存の朧・漣・曙・潮の扱いと同じ)
    escortship: [
      [['花月', '桐', '榧', '杉', '樫', '竹', '潮', '響'], 5]

skills/quest-goal-data/SKILL.md:35

  • This command is not valid from either location claimed here: build.js reads map.json/shiptag.cson and the new ../assets/... source relative to the process working directory, so node fcd/build.js from the repository root looks in the wrong directories, while running it from fcd/ looks for fcd/fcd/build.js. Document the working-directory-safe invocation (or make the script resolve inputs from __dirname).
**After editing the cson, run `node fcd/build.js`** (from the repo root or `fcd/`) and commit
  • Files reviewed: 14/14 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread fcd/build.js Outdated
Comment on lines +46 to +48
// `src` is read relative to this directory; `outName` is the file written into
// assets/data/fcd, and defaults to the source's own name with a .json extension.
async function buildData(src, outName = path.basename(src).replace('.cson', '.json')) {
Comment on lines +71 to +74
for (const [id, goal] of Object.entries(delivered)) {
if (goal && typeof goal === 'object') {
merged[id] = cloneDeep(goal)
}

@petit-chiba petit-chiba Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review:

Found 1 actionable finding.

A stale cached fcd.questgoal overrides the current bundled quest table

mergeQuestGoals (views/redux/info/quests/goals.ts:68-77) layers the delivered table over the bundled one by replacing a quest definition wholesale (merged[id] = cloneDeep(goal)), and questGoalsFcdMiddleware (views/redux/middlewares/quest-goals-fcd.ts:36-40) re-applies state.fcd.questgoal after every api_get_member/require_info. The fcd slice is restored from localStorage's _storeCache at store creation (views/redux/create-store.ts:31-41, targetPaths includes 'fcd'), and it is refreshed only when the Settings FCD component mounts (views/components/settings/about/update/fcd.tsx:116-119 runs updateData on mount, and :40-59/:61-109 are its only createUpdateFCDAction dispatch sites). Nothing else dispatches createUpdateFCDAction.

Consequence: after an app update, the fcd.questgoal cached by the previous release still contains essentially every quest id. On the next startup, that older payload is layered over the new release's bundled assets/data/quest_goal.cson and replaces the newer bundled definition for every id it contains — not only for the ids it omits. A bundled correction (a fixed required, or an added subgoal) therefore does not take effect until the user opens the update settings page and the local/remote payload happens to refresh. The per-id comment in goals.ts only guards the omitted-id case ("an fcd copy cached before a quest existed must not blank it out"); it does not guard an id that is present in the stale payload but changed in the new bundle, so the stated "bundled cson stays the source/fallback" guarantee is not actually met for that case.

Smallest practical fix: at startup (or in the middleware before dispatching createInfoQuestsGoalsUpdatedAction), compare the cached fcd.questgoal version against the version in the bundled assets/data/fcd/questgoal.json and apply the bundled payload when it is newer, so a stale cache cannot shadow the bundled table. (Merging per subgoal key instead of per quest id would also preserve bundled additions, but at the cost of no longer being able to drop a subgoal.)

「北上改三」、出撃ッ! is 単発 (api_type 4 + api_label_type 1), so it carries
no `type`: a reset type would drop the record at the next period boundary and
lose progress on a quest that is still open.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@petit-chiba petit-chiba Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review:

Found 2 actionable findings.

1. A stale cached fcd.questgoal shadows the newer bundled quest table

mergeQuestGoals replaces a bundled quest definition wholesale whenever the delivered payload has that id (views/redux/info/quests/goals.ts:68-76), and questGoalsFcdMiddleware re-applies state.fcd.questgoal after every api_get_member/require_info (views/redux/middlewares/quest-goals-fcd.ts:36-40). The fcd slice is restored from localStorage's _storeCache at store creation (views/redux/create-store.ts:31-41 and :83-97; targetPaths includes 'fcd'), and it is refreshed only by the Settings update component's mount effect (views/components/settings/about/update/fcd.tsx:116-119) — the only site besides the middleware that dispatches createUpdateFCDAction. Because the cached payload was generated from an older quest_goal.cson but still contains essentially every quest id, after an app update it overrides the new release's bundled definitions for every id it has, not only the ids it omits. A bundled correction (a fixed required, an added subgoal, a newly bundled quest) therefore does not take effect until the user opens Settings → About → FCD and the local/remote payload happens to be newer. The comment at goals.ts:62-66 guards only the omitted-id case, so the stated "bundled cson stays the source/fallback" guarantee is not met for ids present in the stale payload.

Smallest fix: before applying the cached payload, compare state.fcd.version.questgoal with the version in the bundled assets/data/fcd/questgoal.json (or seed/refresh the bundled payload at startup) and prefer the bundled table when it is newer, so a stale cache cannot shadow it.

2. The documented fcd/build.js invocation cannot work as written

readCSON reads with fs.readFile(name) and buildData reads JSON with fs.readJSON(src) (fcd/build.js:41-44, :55), both resolved against the process working directory, and the new QUEST_GOAL_SRC = '../assets/data/quest_goal.cson' (:88) assumes the cwd is fcd/. The new instruction in skills/quest-goal-data/SKILL.md:35 says to run node fcd/build.js "from the repo root or fcd/", but from the repository root the script fails immediately: validateShipTag reads 'shiptag.cson' (:73) and validateQuestGoal reads the new source (:90-91) relative to the repo root, where neither exists. The added comment "src is read relative to this directory" (fcd/build.js:46-47) is likewise incorrect. The working invocation remains cd fcd && node build.js, as skills/fcd-assets/SKILL.md:37 already documents.

Fix: resolve all inputs from __dirname (e.g. path.resolve(__dirname, 'shiptag.cson'), path.resolve(__dirname, '../assets/data/quest_goal.cson')) so the documented command works, or correct the doc/comment to the cd fcd form.

Ship names are matched by substring, so 響改二 (Верный) fell out of the
第三十一戦隊 lists in 382 and 1052. Checked every other name list in the file
against the remodel chains in api_start2; no other gaps.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@petit-chiba petit-chiba Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review:

Found 2 actionable findings.

1. A stale cached fcd.questgoal shadows the newer bundled quest table

mergeQuestGoals replaces a bundled quest definition wholesale whenever the delivered payload contains that id (views/redux/info/quests/goals.ts:71-73, merged[id] = cloneDeep(goal)), and questGoalsFcdMiddleware re-applies state.fcd.questgoal after every api_get_member/require_info (views/redux/middlewares/quest-goals-fcd.ts:36-40). The fcd slice is restored at store creation from localStorage's _storeCache (views/redux/create-store.ts:31 lists 'fcd' in targetPaths, and the cache is passed as preloaded state at :83-97), and the only site that dispatches createUpdateFCDAction is the Settings FCD component's mount effect (views/components/settings/about/update/fcd.tsx:116-119, dispatching at :55/:86).

Consequence: after an app update, the payload cached by the previous release still contains essentially every quest id. On the next require_info, that older payload is layered over the new release's bundled assets/data/quest_goal.cson and replaces the newer bundled definition for every id it contains, not only for the ids it omits. A bundled correction (a fixed required, an added/removed subgoal) therefore does not take effect until the user opens Settings → About and the local/remote payload happens to refresh. The goals.ts:62-66 comment only guards the omitted-id case, so the stated "bundled cson stays the source/fallback" guarantee is not met for ids present in the stale payload. Even though the release ships a newer assets/data/fcd/questgoal.json, nothing loads it at startup.

Smallest practical fix: at startup, seed/apply the bundled assets/data/fcd/questgoal.json (or compare state.fcd.version.questgoal against the bundled file's meta.version) and prefer the newer one before the cached payload is merged, so a stale cache cannot shadow the bundled table. Merging per subgoal key instead of per quest id would also preserve bundled additions, but at the cost of no longer being able to drop a subgoal.

2. The documented fcd/build.js invocation fails from the repository root

buildData resolves its src through readCSON/fs.readJSON against the process working directory (fcd/build.js:55), and the new QUEST_GOAL_SRC = '../assets/data/quest_goal.cson' (:88) assumes a cwd of fcd/. The pre-existing validateShipTag reads 'shiptag.cson' (:73) and buildData reads 'map.json' (:113) the same way, while DEST alone is anchored with __dirname (:9). The comment added at :46-47 ("src is read relative to this directory") is incorrect.

The new instruction in skills/quest-goal-data/SKILL.md:35 tells developers to run node fcd/build.js "from the repo root or fcd/". From fcd/ the only working form is node build.js; from the repository root the script fails immediately, because shiptag.cson does not exist there and ../assets/data/quest_goal.cson resolves outside the repository. The correct invocation remains cd fcd && node build.js, as skills/fcd-assets/SKILL.md:37 already documents.

Fix: resolve every input from __dirname (e.g. path.resolve(__dirname, 'shiptag.cson'), path.resolve(__dirname, 'map.json'), path.resolve(__dirname, '../assets/data/quest_goal.cson')) so the documented command works, or correct the doc/comment to the cd fcd form.

@github-actions

Copy link
Copy Markdown

I've verified both the runtime flow and the build tooling. Here is my review.

Findings

1. A stale cached fcd.questgoal overrides newer bundled quest definitions on every launch — and can never drop an expired/reused quest id

Risk (high). mergeQuestGoals replaces a bundled quest wholesale for every id present in the delivered table (views/redux/info/quests/goals.ts:71-74), and questGoalsFcdMiddleware re-applies state.fcd.questgoal after every api_get_member/require_info (views/redux/middlewares/quest-goals-fcd.ts:36-40). The fcd slice is rehydrated from localStorage._storeCache at store creation (views/redux/create-store.ts:31,86), and the only place that refreshes it is the Settings→About→FCD mount effect (views/components/settings/about/update/fcd.tsx:116-119). Nothing loads the bundled assets/data/fcd/questgoal.json at startup.

Consequence: after any poi release that corrects quest_goal.cson (a fixed required, a renamed-remodel name like the 響/Верный fix, a newly added quest), every existing install that has questgoal cached from the previous version will silently run the older definitions for all ids the stale payload contains — the stated guarantee that the bundled cson stays the source/fallback is not met until the user opens the updater. This is not hypothetical: the PR's own data flow means the very first release of this feature populates fcd.questgoal for every id, so the very next release's corrections are shadowed for those users.

The sharper consequence compounds the author's own invariant. quest_goal.cson documents that expired limited-time ids must be deleted because the game reuses them (see the 383 note), and the PR states "fcd can correct a quest but never delete one". A stale cached payload keeps a just-expired id (e.g. 382) tracked under old goals after the game has reused that id for a different campaign — the exact wrong-tracking scenario the deletion rule exists to prevent. The per-id merge comment at goals.ts:62-66 only guards the omitted-id case, not the present-but-stale case.

Smallest practical fix: seed/compare versions. At startup (or in the middleware before dispatching createInfoQuestsGoalsUpdatedAction), read the bundled assets/data/fcd/questgoal.json and compare state.fcd.version.questgoal against its version; when the bundled version is newer, apply the bundled payload instead of the cached one, so a release always wins over a stale cache.

2. The documented fcd/build.js invocation cannot work as written

Risk (low, maintenance). The new skills/quest-goal-data/SKILL.md:35 says to run node fcd/build.js "from the repo root or fcd/". But readCSON/fs.readJSON resolve against the process working directory (fcd/build.js:41-44,55), validateShipTag reads 'shiptag.cson' from the cwd (:73), and the new QUEST_GOAL_SRC = '../assets/data/quest_goal.cson' (:88) assumes cwd is fcd/. From the repo root the script fails immediately at validateShipTag (no shiptag.cson at the root); from fcd/ it works. The added comment at build.js:46-47 ("src is read relative to this directory") is likewise incorrect — it's relative to the cwd, not the script's directory. A future editor following the doc from the repo root will see a confusing ENOENT.

Smallest practical fix: resolve inputs from __dirname (e.g. path.resolve(__dirname, 'shiptag.cson'), path.resolve(__dirname, '../assets/data/quest_goal.cson')), or change the doc/comment to the working form cd fcd && node build.js.


Both of these are also flagged in the existing bot reviews; I re-verified each against the code. I did not find additional high-confidence issues: the resyncQuestRecords progress-carryover logic, the record-reset semantics for the new one-time/limited-time entries, and the buildMeta directory-enumeration fix all check out (the buildMeta change genuinely fixes the dropped-gameselector bug, confirmed against master's hardcoded list).

github run

…goals

fcd state is restored from localStorage, so after an app update the payload
cached by the previous release is still present and carries nearly every quest
id. Per-id merging alone let it override bundled corrections, so a payload
older than this build's own questgoal.json is now discarded.

Also resolves fcd/build.js inputs from __dirname, so it runs from either
the repo root or fcd/ as documented.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@KochiyaOcean

Copy link
Copy Markdown
Member Author

Both review bots raised the same two findings; both are addressed in badc910.

1. Stale cached fcd.questgoal shadowing the bundled table — fixed, though the stated consequence was not accurate.

The claim was that a bundled correction "does not take effect until the user opens Settings → About → FCD". That part is wrong: Blueprint's Tabs defaults to renderActiveTabPanelOnly: false, so every settings panel — including <About /> and its <FCD /> — is mounted at app startup, and the mount effect's local-file pass dispatches the bundled questgoal.json well before any api_get_member/require_info can arrive.

The underlying concern is still right, and the invariant should not rest on a UI component happening to be mounted: mergeQuestGoals now discards a delivered payload whose version is older than meta.version of this build's own assets/data/fcd/questgoal.json (same lexicographic YYYY/MM/DD/NN comparison the updater uses). An unknown version is still applied, since it cannot be compared. Covered by two new tests, one at the merge level and one through the middleware.

2. node fcd/build.js not working from the repo root — fixed properly.

Correct, and it was a pre-existing cwd dependence (validateShipTag read 'shiptag.cson' relative to the process cwd) that my new ../assets/... source made worse. Rather than documenting cd fcd, the script now resolves every input from __dirname, so both invocations work; verified from both directories. The misleading comment is corrected too.

On the suppressed '潮' comment: correct that satisfyShip matches by substring, so a bare '潮' also counts 満潮・大潮・荒潮. There is no exact-match option in the engine today, and the file already relies on this behaviour elsewhere (the 朧・漣・曙・潮 quests), so both new quests keep the loose form with a comment saying so. Note the same mechanism bites in the opposite direction, which is what 2b009fe fixes: a renamed remodel stops matching its base name, so 響改二 (Верный) was falling out of these lists. Every other name list in the file was checked against the api_start2 remodel chains — no other gaps — and the 13 renamed remodels in the roster are now listed in the skill. An exact-match flag on escortship would be a separate engine change; happy to do it if you want it.

@petit-chiba petit-chiba Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review:

No actionable findings.

The two defects raised against earlier revisions of this PR are resolved on the head revision. mergeQuestGoals (views/redux/info/quests/goals.ts:107) now compares the delivered meta.version against the version of the bundled assets/data/fcd/questgoal.json and discards a payload older than the build, so a stale fcd.questgoal restored from localStorage can no longer shadow a bundled correction; the middleware supplies that version on both delivery paths (views/redux/middlewares/quest-goals-fcd.ts:42). fcd/build.js resolves all inputs via src() anchored at __dirname (fcd/build.js:43,46,59,77), so the documented node fcd/build.js invocation works from either directory. I re-checked the per-id merge semantics, the resyncQuestRecords progress carry-over, the type-less one-time record handling, and the buildMeta directory enumeration, and did not find a new correctness, security, reliability, or maintainability defect introduced by the diff.

KochiyaOcean and others added 2 commits September 13, 2026 04:11
Quest goals name a ship by the master id where it starts counting, and the
matcher expands that id through api_aftershipid, so a goal covers every later
remodel — renames included — and nothing outside the line.

This replaces substring name matching, which over-matched (「潮」 counted
満潮・大潮・荒潮) and missed renamed remodels (響改二 is Верный). It also states
「〜改以降」 exactly, by naming the 改 id instead of the base.

All 25 name-based quests are migrated: 68 of 77 ship lists keep an identical
match set, and the 9 that change only drop ships that never belonged. The name
fields stay for compatibility but are deprecated.

escortshipId entries are AND-ed, unlike escortship's OR, so quests 875 and 903
no longer have to encode an AND as a list of OR-ed pairs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
拡張「六水戦」、最前線へ! asks for 由良改二 or 2 睦月-class ships, which the
previous commit flattened into an AND when it moved the quest off the OR-ed
escortship field. Adds escortshipIdAny for that case and puts 903 back on OR.

Audited the other direction too: of the 94 goal ids that name a remodelled
stage, none accepts an unremodelled ship.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Based on my review of the current head (badc910 + follow-ups), I verified both previously-flagged issues are genuinely fixed:

  • mergeQuestGoals (views/redux/info/quests/goals.ts:107-121) now compares the delivered meta.version against the bundled questgoal.json version and discards a payload older than the build; the middleware passes that version on both delivery paths (quest-goals-fcd.ts:42). I traced the startup flow (fcd.tsx local pass, _storeCache rehydration, require_info) and the guard holds.
  • fcd/build.js now resolves every input from __dirname via src() (fcd/build.js:43,45-47,59,76-77,92-95); I confirmed all referenced paths exist and resolve correctly from the repo root.

I found no new correctness, security, or reliability bugs in the merge/resync logic, the record-reset semantics, the satisfyShip/shipRemodelSources id expansion, or the buildMeta enumeration.

One finding:

1. A stale bundled questgoal.json silently shadows a newer quest_goal.cson edit whenever the (new) regeneration step is skipped

Risk (medium, maintenance). The PR's data flow assumes quest_goal.cson stays the source and the bundled questgoal.json is always regenerated from it. Nothing enforces that. mergeQuestGoals layers the delivered table over the cson per quest id (views/redux/info/quests/goals.ts:115-119), and on any install the shipped assets/data/fcd/questgoal.json gets applied: on a fresh install the FCD component's local pass dispatches it unconditionally (views/components/settings/about/update/fcd.tsx:45-57, since '1970/01/01/01' < any real version), and on an updated install the version floor is read from that same file (goals.ts:113).

Consequence: if a maintainer edits quest_goal.cson (a required fix, a renamed-remodel correction like the 響/Верный one) and forgets the new node fcd/build.js step that this PR introduced and documents, the stale bundled payload replaces the corrected cson definition for every id it contains — on both fresh and existing installs. The stale payload's version equals the floor, so the "payload older than the build is discarded" guard (goals.ts:114) does not catch it. The correction silently never ships, defeating the feature's stated purpose. This is the developer-side mirror of the user-side stale-cache bug already fixed.

Smallest practical fix: a CI test (or a jest spec) that regenerates the payload from the cson — e.g. run validateQuestGoal + buildData logic in a test and assert the output matches the committed assets/data/fcd/questgoal.json — so a cson change without the regeneration fails the build. That makes the "cson stays the single source" invariant enforced rather than procedural.

github run

Keeps the id field's semantics identical to the escortship it replaces, so a
migrated single-entry list reads the same either way. Only 875 and 1051 need
the AND form; 903 goes back to the plain field.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@petit-chiba petit-chiba Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review:

Found 1 actionable finding.

The bundled payload silently overrides a corrected cson whenever the regeneration step is skipped

mergeQuestGoals (views/redux/info/quests/goals.ts:107-121) layers assets/data/fcd/questgoal.json over the bundled quest_goal.cson per quest id, replacing the bundled definition wholesale, and it does so unless the delivered version is strictly older than the bundled file's version (goals.ts:113-114). The floor is read from that same file (bundledQuestGoalsVersion, goals.ts:65-86). The payload is therefore authoritative at runtime in the ordinary paths:

  • on a fresh install the Settings local pass dispatches the bundled file itself (views/components/settings/about/update/fcd.tsx:45-59), whose version equals the floor, so it is applied;
  • on an existing install the cached payload's version commonly equals the bundled file's version (same release), so the < guard does not fire either.

Consequence: if a maintainer edits assets/data/quest_goal.cson (a required fix, a renamed-remodel correction such as the 響/Верный one, an added quest) and does not re-run node fcd/build.js before committing, the committed questgoal.json retains both the old data and the old meta.version. Because the stale payload's version is not less than the (equally stale) bundled version, the version guard does not catch it, and the stale payload replaces the corrected cson for every id it contains — on both fresh and updated installs. The correction silently never ships, defeating the stated "quest_goal.cson stays the single source" invariant. Nothing in package.json (build/test) or CI regenerates or compares the two files; the new validateQuestGoal only validates the cson it is handed (fcd/build.js:94-110), and the documentation relies on the developer remembering the step (skills/quest-goal-data/SKILL.md:35).

Smallest practical fix: add a jest/CI check that derives the data from the cson (reuse the validateQuestGoal + buildData mapping) and asserts it deep-equals the committed assets/data/fcd/questgoal.json's data (ignore meta.version), so a cson edit without regeneration fails the build.

Audited every quest's type against the section it sits under and against the
api_type/api_label_type the game reports:

- 242 敵東方中枢艦隊を撃破せよ! sat in Weekly with type 3, so its record reset
  monthly instead of weekly;
- 1167 装備の改修集中強化 is weekly with a same-day count, which resetInterval
  now expresses, so it moves to Weekly instead of posing as a daily;
- 313 秋季大演習 is 単発 per the game, so it joins the one-time section and
  keeps only its daily counter.

fcd/build.js now asserts type against the section header, which is what caught
the 1167 and 313 placements while fixing them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@petit-chiba petit-chiba Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review:

Found 1 actionable finding.

A stale bundled questgoal.json silently overrides a corrected quest_goal.cson whenever the regeneration step is skipped

mergeQuestGoals (views/redux/info/quests/goals.ts:107-121) layers the delivered fcd payload over the bundled cson per quest id (merged[id] = cloneDeep(goal), goals.ts:115-119), and it only discards a payload that is strictly older than the floor returned by bundledQuestGoalsVersion() (goals.ts:113-114). That floor is read from assets/data/fcd/questgoal.json (goals.ts:65-86), i.e. from the same generated payload the guard is protecting against. So if a maintainer edits assets/data/quest_goal.cson (a required fix, the renamed-remodel correction such as 響/Верный, or a newly added quest) and does not re-run node fcd/build.js, both the payload's data and its meta.version stay at the old release. The comparison deliveredVersion < bundled is then false (they are equal), so the stale payload replaces the corrected cson for every id it contains.

This is reachable on the ordinary paths, not just a hypothetical: on a fresh install the FCD component's local pass dispatches the shipped questgoal.json unconditionally because '1970/01/01/01' < any real version (views/components/settings/about/update/fcd.tsx:45-57), and on every require_info the new middleware re-applies state.fcd.questgoal (views/redux/middlewares/quest-goals-fcd.ts:36-45, reducer at views/redux/info/quests/index.ts:172-184). Nothing loads the cson after the merge, so the correction is never seen. The result defeats the PR's stated invariant that quest_goal.cson stays the single source, and it is the developer-side mirror of the user-side stale-cache bug the version floor was added to fix. It cannot be caught by the build itself: validateQuestGoal only validates the cson it is handed (fcd/build.js:161-177), nothing in package.json (test is plain jest) or CI regenerates or compares the two files, and the workflow relies on the developer remembering the step (skills/quest-goal-data/SKILL.md).

Smallest practical fix: add a jest/CI check that derives the data from the cson (reuse the validateQuestGoal + buildData mapping, or extract that mapping into a testable module) and asserts it deep-equals the committed assets/data/fcd/questgoal.json's data, ignoring meta.version. That turns "cson is the single source" from a procedural promise into an enforced one, and a cson edit without regeneration fails the build instead of silently shipping stale goals.

The version floor read its bound from the same questgoal.json it was guarding,
so a payload at the build's own version still won per quest id. Editing
quest_goal.cson without re-running fcd/build.js therefore had no effect at
runtime — the developer-side mirror of the stale-cache bug the floor fixed.

Equal versions are now treated as carrying nothing new, since the bundled
payload is generated from the bundled cson, and a new test compares every
committed fcd payload against the source it is built from so the drift fails
`npm test` instead of shipping.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@KochiyaOcean

Copy link
Copy Markdown
Member Author

Latest review's finding is correct and is fixed in 1f581af.

The version floor read its bound from assets/data/fcd/questgoal.json — the very payload it was guarding — so it could only ever catch a payload from an older release. A payload at this build's own version passed the deliveredVersion < bundled test and then won per quest id, which means editing assets/data/quest_goal.cson without re-running node fcd/build.js had no effect at runtime. That is worse than the user-side bug the floor was added for, because it silently affects whoever is editing the quest data.

Two changes:

Equal versions now count as "nothing new." The bundled payload is generated from the bundled cson, so an equal-version payload either duplicates it (no-op) or is stale (harmful) — there is no case where applying it helps. Only a strictly newer payload, i.e. one that actually came from fcd, is layered on. This makes the "cson is the source" invariant hold regardless of the payload's state.

The drift is now a test failure, not a procedure. fcd/__tests__/payloads.spec.ts parses each source that fcd/build.js mirrors (assets/data/quest_goal.cson, fcd/shiptag.cson, fcd/map.json, fcd/shipavatar.json) and asserts the committed payload's data deep-equals it, plus that meta.json lists every payload. I verified it catches the case: changing a required in the cson without rebuilding fails the questgoal case. Note it has to use jest.requireActual('cson') — lib/__mocks__/cson.ts is picked up automatically for that node module and a stubbed parser would make the comparison vacuous.

Worth flagging that the review's suggestion to "reuse the buildData mapping" would not have added much here: the mapping is just parse-and-wrap, so comparing parsed source against committed data covers it without extracting a module.

@petit-chiba petit-chiba Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review:

No actionable findings.

The id-based ship matching (shipRemodelSources plus the flagshipId/secondshipId/escortshipId/escortshipIdAll checks), the per-quest-id fcd merge with its strictly-newer version floor, resyncQuestRecords, the type-less one-time handling, and the fcd/build.js __dirname/manifest changes are internally consistent and covered by the added tests (renamed remodels, remodel cycles, OR vs AND escorts, equal/older payload versions, and payload/source drift). I found no concrete correctness, security, reliability, or maintainability defect introduced by this diff.

@github-actions

Copy link
Copy Markdown

I've completed an adversarial review of the current head (1f581af). Let me verify the previously-raised issues are resolved and check the deeper logic paths that earlier reviews touched only lightly.

I traced the full data flow (merge, version floor, middleware ordering, plugin-window @@replaceFCD sync, record resync), the build tooling (__dirname resolution, section/type validation, the new drift test), and the ship-id matching engine (remodel graph walk, cycle termination, OR/AND semantics), and cross-checked the migrated ship ids against the repo's api_start2 fixture.

The three previously-raised findings are genuinely fixed:

  • mergeQuestGoals now discards any payload not strictly newer than the build's own questgoal.json version (goals.ts:120-121), so both the user-side stale localStorage cache and the developer-side stale bundled payload are neutralized; fcd/__tests__/payloads.spec.ts enforces cson↔payload parity in CI.
  • fcd/build.js resolves every input from __dirname via src(), so node fcd/build.js works from the repo root and from fcd/.

No new high-confidence findings.

Things I checked that came close but do not clear the bar:

  1. resyncQuestRecords drops top-level active/count/required from rebuilt records (goals.ts:162-188). Harmless: nothing reads those fields in memory — sumSubgoals and updateQuestRecordFactory iterate subgoal objects only, and saveQuestTracking recomputes them on the next write. Not reportable.

  2. Plugin-window @@replaceFCD applies data without updating the version (create-store.ts:194-202), so the version floor could discard a newer payload. In practice the storage handler iterates version before questgoal (it is always the first key of the fcd state object), so the version is replaced first and the merge guard sees the correct value; it also self-heals on the next require_info. Fragile but not currently broken.

  3. Quest 313 (秋季大演習) moved to the one-time section with no type means its record no longer resets at quarter boundaries, so an uncleared record could carry stale progress into next year's recurrence. This is a deliberate, documented game-semantics judgment (the old behavior deleted the record mid-season, which was equally wrong), and I can't verify the recurrence-id reuse claim without game access.

I verified the migrated ship ids (響=35/響改=235/Верный=147, 潮=16/潮改=233/潮改二=407, 朧=93/漣=94/曙=15, 夕張改二=622→改二特=623→改二丁=624 cycle, etc.) against the api_start2 fixture, and the shipRemodelSources walk correctly handles the switchable-variant cycles via its seen set. The escortshipId OR / escortshipIdAll AND conversions for 903, 875, and 1051 match the quest semantics described.

github run

A goal with no type must never lose progress to a period rollover. Covers the
record side (day/week/month/quarter and all 12 yearly resets, plus 400 day
steps), the active-quest side (expiry keys off the game's api_type, and 4
matches no branch), and the require_info path that re-reads quest_tracking with
the file's own timestamp.

setup-tests.ts now defines APPDATA_PATH, without which questTrackingPath throws
and the tracking load silently falls back to an empty table.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@KochiyaOcean
KochiyaOcean merged commit 50ae79e into master Sep 12, 2026
11 of 13 checks passed
@KochiyaOcean
KochiyaOcean deleted the feat/quest-goal-fcd branch September 12, 2026 20:13
@github-actions

Copy link
Copy Markdown

I reviewed the full diff against the base (29a9e02) and traced the data flow end to end: the fcd payload build (fcd/build.js), the merge/version-floor logic (goals.ts), the middleware ordering (quest-goals-fcd.ts + create-store.ts + fcd.tsx), record resync/reset semantics (records.ts), and the id-based ship matching (goal-matching.ts + selectors/base.ts). I also verified the cson migration (sections, types, ship ids) and the new tests.

Findings

No high-confidence findings on the current head.

I verified that the three issues raised in earlier review rounds are genuinely fixed and independently confirmed the fixes are complete:

  1. Stale cached fcd.questgoal shadowing bundled corrections — mergeQuestGoals (goals.ts:114-127) discards any delivered payload not strictly newer than the build's own questgoal.json version (deliveredVersion <= bundled). Since fcd state is restored from localStorage._storeCache, the guard neutralizes the previous-release payload both on the require_info and @@updateFCD paths. The "equal version = nothing new" rule also prevents a stale bundled payload from shadowing a cson edit (goals.ts:107-109).

  2. node fcd/build.js failing from the repo root — src() now resolves every input from __dirname (build.js:43, 59, 76-77, 92-95), so both documented invocations work; I confirmed all referenced paths resolve.

  3. cson-edit-without-regeneration drift — fcd/__tests__/payloads.spec.ts parses each source and asserts the committed payload's data deep-equals it (plus meta.json completeness), and the CI workflow runs npm test (nodejs.yml), so the invariant is enforced rather than procedural. The jest.requireActual('cson') correctly bypasses lib/__mocks__/cson.ts.

Things I checked that came close but do not clear the bar:

  • resyncQuestRecords drops top-level active/count/required when rebuilding a record — harmless; processQuestRecords (persistence.ts:23-38) recomputes them on every save, and nothing reads them in memory.
  • require_info runs outdateRecords against the bundled-only goals before the middleware re-merges the fcd layer, so an fcd-corrected type could miss one reset boundary at a require_info — the daily-refresh path immediately uses the merged (corrected) goals and re-aligns, so the stale window is <1 day and self-healing.
  • Plugin-window @@replaceFCD applies data without its version — the storage handler replaces version before questgoal (key iteration order), so the merge guard sees the correct version; fragile but not broken.
  • satisfyShip positional alignment between shipIds and shipname differs only for a ship with an empty api_name, which never occurs in master data.
  • The migration semantics (903 OR vs 875/1051 escortshipIdAll AND, remodel-cycle handling with the seen set, 響→Верный and 潮 base-id expansion, base-ship exclusion for 改/改二 goals) all check out against the api_start2 chain and the stated quest text.

github run

@petit-chiba petit-chiba Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review:

No actionable findings.

The head revision holds up under independent inspection: the per-quest-id fcd merge with its strictly-newer version floor, the resyncQuestRecords carry-over, the type-less one-time reset convention, the master-id/remodel-line ship matching (including renamed remodels and switchable cycles), and the fcd/build.js __dirname plus manifest/drift-test changes are internally consistent and covered by the added tests. I could not construct a concrete correctness, security, reliability, or maintainability defect introduced by this diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants