lycheedev 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/native/windows-amd64/lycheedev.exe +0 -0
  2. package/package.json +1 -1
  3. package/payload/addon/Bridge/ActivityView.lua +1 -1
  4. package/payload/addon/Bridge/InputSignal.lua +36 -0
  5. package/payload/addon/Bridge/InputState.lua +61 -13
  6. package/payload/addon/Bridge/SlotProtocol.lua +16 -9
  7. package/payload/addon/Bridge/SlotRuntime.lua +34 -15
  8. package/payload/addon/Core/Compat.lua +10 -1
  9. package/payload/addon/Core/Runtime.lua +1 -1
  10. package/payload/addon/Lychee Dev.toc +2 -1
  11. package/payload/skill/SKILL.md +89 -148
  12. package/payload/skill/agents/openai.yaml +2 -2
  13. package/payload/skill/references/asset-export.md +1 -1
  14. package/payload/skill/references/commands.md +22 -22
  15. package/payload/skill/references/data-hotfix.md +112 -0
  16. package/payload/skill/references/data-investigation.md +74 -320
  17. package/payload/skill/references/data-recovery.md +55 -0
  18. package/payload/skill/references/data-tables.md +170 -0
  19. package/payload/skill/references/data-targets.md +93 -0
  20. package/payload/skill/references/error-diagnosis.md +2 -2
  21. package/payload/skill/references/installation.md +15 -1
  22. package/payload/skill/references/live-investigation.md +46 -267
  23. package/payload/skill/references/live-probes.md +160 -0
  24. package/payload/skill/references/live-recovery.md +190 -0
  25. package/payload/skill/references/live-startup.md +26 -28
  26. package/payload/skill/references/runtime-investigations.md +17 -3
  27. package/payload/skill/references/source-preparation.md +58 -0
  28. package/payload/skill/references/source-relations.md +51 -0
  29. package/payload/skill/references/source-research.md +66 -162
  30. package/payload/skill/references/source-value-flow.md +48 -0
  31. package/release.json +93 -43
@@ -1,322 +1,76 @@
1
1
  # Data investigation
2
2
 
3
- Use this workflow for static game tables, read-only SQL, semantic records,
4
- independent change records, and reproducible data comparisons.
5
-
6
- ## Fix the data identity
7
-
8
- Prepare a local target from the selected client directory; do not construct
9
- CASC keys or a DataPin by hand:
10
-
11
- ```text
12
- lycheedev target resolve --installation <client-directory> --region cn --locale zhCN --format json
13
- ```
14
-
15
- When a named target has already been configured, resolve that fixed
16
- configuration with `lycheedev target resolve --target <name> --format json`.
17
- Use `lycheedev target show <name>` to inspect the named configuration, or
18
- `lycheedev target show <PIN-id>` to inspect a resolved selection. Showing a
19
- target reads it; it does not resolve or refresh it. Use `target add` to create
20
- or explicitly replace a named configuration.
21
-
22
- Region and locale are explicit choices; use those requested for the task.
23
- The CLI reads product/build/config identities from the installation and resolves
24
- WoWDBDefs `refs/heads/master` once to an exact commit. Use `--definitions` for a
25
- specific 40-hex commit or full branch/tag ref. `--offline` resolves a symbolic
26
- ref only from its existing workspace record; an explicit commit needs no
27
- network. Table definitions are prepared on first query, not by target resolve.
28
-
29
- The result is a fixed pin ID. Carry it between calls and agents. `--from <pin>`
30
- adds data to a source-only pin without modifying the parent; if it already has
31
- data, the existing definition commit is retained by default and conflicting
32
- fixed identities fail. Do not resolve a fixed target again as latest.
33
-
34
- The target evidence records the observed client/catalog and archived config
35
- bytes. It does not prove that every table or locale is present, or that the
36
- game is running. `target resolve --file` remains available for already-resolved
37
- identities, but cannot be mixed with preparation flags.
38
-
39
- For a remote product, use the same resolver without an installation path:
40
-
41
- ```text
42
- lycheedev target resolve --product retail --region cn --locale zhCN --format json
43
- ```
44
-
45
- It records the selected region's advertised build, verified build/CDN configs,
46
- and exact definition commit. `--build <full-build>` constrains that observation;
47
- it does not search historical builds or fall back to a neighboring one. Online
48
- failures do not silently reuse old catalogs. `--offline` requires a previously
49
- recorded catalog pair and configurations in this workspace; preserve the returned
50
- `context.observedAt` and do not call an offline observation the current server
51
- state. An exact `--definitions` commit alone does not supply remote catalogs.
52
-
53
- Remote target preparation does not download game archives or prove content
54
- availability. DB2/SQL/asset queries accept either `--installation <directory>`
55
- or `--cdn` against the same pin; do not combine them. In target resolution,
56
- `--installation`, `--product`, and `--file` are alternative
57
- selection modes, not overrides of each other.
58
-
59
- ## Implemented DB2 reading
60
-
61
- For a known table and record ID in an explicitly selected local installation:
62
-
63
- ```text
64
- lycheedev data db2 --snapshot <pin> --installation <game-root> --table <name> --id <id> --format json
65
- ```
66
-
67
- For the same query from CDN, replace the installation selector with `--cdn`.
68
- Add `--offline` to prohibit all network access and reuse only this workspace's
69
- verified configuration, fragment and definition caches. Missing cache data fails;
70
- the command does not fall back to a local installation or change the pin.
71
- The initial archive lookup can be slow when the provider lacks a group index.
72
-
73
- `game-root` contains `.build.info` and `Data/`; the same selected client directory
74
- used in target resolution is also accepted and checked against the pin. The command selects the DB2
75
- FileDataID from the pinned WoWDBDefs manifest, verifies the table hash in the
76
- actual file, and binds its exact layout hash to the definition. It returns
77
- `row`, `schema`, `layoutHash`, raw-source blob references and a JSON capture.
78
- The capture is complete for that one requested record, not for the whole table.
79
- Record ID zero is allowed. A missing record is an error, not an empty full-table
80
- query. Field verification/foreign-key metadata in `schema` is retained evidence,
81
- not proof that every inferred DBD field meaning is correct.
82
-
83
- Omit `--id` to read a bounded page (default 50, maximum 200 rows):
84
-
85
- ```text
86
- lycheedev data db2 --snapshot <pin> --installation <game-root> --table <name> --limit 50 --format json
87
- lycheedev data db2 --snapshot <same-pin> --installation <same-root> --table <same-name> --limit 50 --after-id <page.next> --offline --format json
88
- ```
89
-
90
- Pages use ascending logical IDs, including copies. Omitted `--after-id` includes
91
- ID zero; an explicit cursor excludes that ID. Continue only when `page.more`
92
- is true, carrying `page.next` with the same snapshot and table. `--id` cannot
93
- be combined with `--limit` or `--after-id`. Empty pages are valid. Preserve
94
- each page's capture and cursor; a suffix ending at the last record is still not
95
- the whole table. Captures mark full-table completion only when a first page
96
- contains all rows. `truncated` denotes more rows after this page; false does
97
- not imply that earlier rows were included.
98
-
99
- On a cache miss, the command reads only manifest/DBD files at the DataPin's
100
- exact definition commit from WoWDBDefs; it does not fetch a newer branch. Local
101
- mode never fetches CDN game data. Add `--offline` to prohibit downloads; missing or corrupt
102
- cached definitions fail explicitly. Cache bytes are rehashed before use. No
103
- game input or game installation writes occur. Hotfix records are not overlaid.
104
-
105
- The file limit is `--max-bytes` (default 128 MiB, maximum 512 MiB, applied to
106
- both encoded and decoded file sizes). Parser budgets additionally bound metadata
107
- to 64 MiB, indexed physical/copy rows to one million, columns/partitions to 4096,
108
- and decoded row text to 1 MiB. A page's serialized row array is capped at 8 MiB;
109
- any row failure or budget overflow returns no partial page. Page selection uses
110
- bounded extra memory, but each CLI invocation currently reopens the table and
111
- checks its selected source. Encrypted BLTE chunks use a pinned public TACT key
112
- snapshot, fetched only when needed and cached with a verified digest. Offline
113
- uses only cached keys. Supply `--key-file <WoW.txt|keys.json>` to use an explicit
114
- text or JSON key set instead; private keys stay in request memory.
115
-
116
- DB2 reads keep readable encrypted/non-encrypted sections when other sections
117
- lack keys. Inspect `complete`, `partial`, `unavailablePartitions` (direct DB2)
118
- or `tables[].unavailablePartitions` (schema/domain results). File provenance
119
- separates `partialContent` plus missing chunk ranges from full CKey-verified
120
- `content`; placeholder bytes never become decoded fields. A schema's `rowCount`
121
- is the readable logical count, not the total number of records in a partial table.
122
- Report missing keys and row coverage with the answer. Do not describe a partial
123
- search, empty result, SQL aggregate or CSV as a full-build answer. Changing from
124
- installation to CDN does not supply a missing key. Raw asset exports still
125
- require the complete verified file.
126
-
127
- ## Implemented static SQL
128
-
129
- For parameterized lookups, flags, explicit Hotfix overlays and query diagnostics,
130
- read [data-query-recipes.md](data-query-recipes.md). The `meta` catalog exposes
131
- pinned enum/flag definitions; `effective` requires explicitly selected raw cache
132
- captures in the query JSON. Unqualified and `static` tables retain static values.
133
-
134
- For a complete local Hotfix investigation, prefer the CLI-owned bounded scan:
135
-
136
- ```text
137
- lycheedev data hotfix --source dbcache --scan --snapshot <pin> --from <raw-cache-capture> --table SpellMisc --limit 200 --max-pages 100 --format json
138
- ```
139
-
140
- The result contains cumulative matched/returned/decoded/no-payload counts and
141
- page capture IDs. If `result.complete` is false, continue with `--cursor` set to
142
- the returned `resume` capture, the returned snapshot, the same raw cache and the
143
- same table/filters/limit. Read page captures for records; do not treat the summary
144
- as their decoded contents. A completed scan covers only that selected cache.
145
- It does not imply an effective overlay or full server coverage. Resume checkpoints
146
- are saved after each successful page; a completed checkpoint can be reread.
147
- If a scan fails after saving pages, its error response retains the last saved
148
- scan result and `resume`. Report the failure and that checkpoint together;
149
- resume after addressing the cause instead of restarting from the mutable file.
150
-
151
- Supply SQL as text, from a `.sql` or `.json` file, or from stdin. Exactly one
152
- input mode is accepted. For JSON requests, use a UTF-8 file (at most 1 MiB):
153
-
154
- ```json
155
- {"sql":"SELECT ID, Filename FROM ChrClasses WHERE ID=:id","parameters":{"id":1}}
156
- ```
157
-
158
- ```text
159
- lycheedev data sql --snapshot <pin> --installation <game-root> --file <query.json> --format json
160
- lycheedev data sql --snapshot <pin> --cdn --sql 'SELECT ID FROM ChrClasses WHERE ID=:id' --param id=1 --format json
161
- lycheedev data sql --snapshot <pin> --installation <game-root> --stdin --encoding csv --output <new-file.csv> --format json
162
- ```
163
-
164
- Repeat `--param <name=scalar>` for named SQL parameters; values must be scalar
165
- JSON values. JSON request parameters must exactly match SQL parameters, and
166
- integer tokens retain 64-bit precision. Duplicate or unknown request fields
167
- fail. `--encoding csv` requires `--output <file>` and writes a CSV export with
168
- its capture/manifest. Use SQL LIMIT/OFFSET, not CLI `--limit`. `--offline` and
169
- `--max-bytes` have the same cache and per-file meanings as DB2 reading. Replace
170
- `--installation` with `--cdn` for explicitly selected remote content.
171
-
172
- Unqualified tables and qualified `static.Table` read pinned static values;
173
- `static.Table` also bypasses CTE names. A Hotfix overlay is used only when the
174
- query document explicitly names raw cache captures and queries `effective.Table`
175
- as described in [data-query-recipes.md](data-query-recipes.md). There is no
176
- implicit overlay or source fallback. Query output contains `query`,
177
- `result` (ordered `columns` and positional `rows`, or `plan` for EXPLAIN), and
178
- `sources` with each prepared table's provenance. Verify the returned capture
179
- with `evidence verify <capture-id>`. Complete means the requested query result,
180
- including any SQL LIMIT, not an unrestricted whole-table export. Missing-key
181
- sections propagate `complete: false` and `partial: true` to SQL; source tables
182
- retain missing ranges/partitions. CSV captures and manifests also retain
183
- `complete: false`. JSONL end frames report partial coverage explicitly; a legal
184
- end frame and exit 0 alone do not prove all encrypted sections were readable.
185
-
186
- Supported paths include joins, grouping, ordinary CTEs, UNION ALL, correlated
187
- expression subqueries (also in GROUP BY and aggregate inputs), and
188
- one-seed/one-member recursive CTEs. Complex recursive forms still fail explicitly.
189
- DB2 array fields become quoted scalar column names such as `"Field[0]"`.
190
- Text functions require text; conversions and integer overflow fail explicitly.
191
- EXPLAIN binds sources without scanning rows; it may still prepare table
192
- bytes and definitions. EXPLAIN ANALYZE executes and reports scan counts/work/
193
- charged bytes; charged bytes are not process peak memory.
194
-
195
- Budgets: at most 32 physical tables, 512 MiB cumulative raw table content,
196
- 10 million execution work units, 64 MiB execution accounting and 16 MiB JSON
197
- evidence. Budget failures yield no partial query result. Narrow the query when
198
- appropriate to the request; do not change the pinned build or imply full
199
- coverage from a narrower successful query.
200
-
201
- SQL errors use `error.stage: query` with `query.invalid_syntax` or
202
- `query.unresolved_binding` (exit 2), `query.unsupported_expression` or
203
- `query.budget_exceeded` (exit 3), and type/range/cardinality faults (exit 4).
204
- Syntax faults include `error.location` with byte offset and line/column.
205
- Correct the request or report the limitation; repeating an unchanged query
206
- does not resolve these failures. Source/cache/I/O faults retain their own codes.
207
-
208
- Domain commands are implemented for spells (`data spell info`, `data spell auras`,
209
- `data spell summons`), items (`data item get`, `data item models`,
210
- `data item geosets`, `data item textures`), creatures (`data creature display`,
211
- `data creature model`), journal encounters (`data encounter get`), and house
212
- decor (`data decor list`, `data decor get`). Prefer the domain command when it owns
213
- the relationship needed to answer the question; use SQL/DB2 for other supported
214
- tables. A static table result is not a substitute for requested Hotfix data.
215
- Preserve source, table/record, locale, filters, row counts and capture hashes.
216
-
217
- ## Local Hotfix records
218
-
219
- Use `data hotfix` with an explicit `--source` for independent records, not for
220
- an effective static table. Local caches use `--source dbcache`:
221
-
222
- ```text
223
- lycheedev data hotfix --source dbcache --snapshot <data-pin> --dbcache <DBCache.bin> --limit 50 --format json
224
- ```
225
-
226
- The command archives the original bytes, checks the cache build number against
227
- the data pin, and returns a derived `snapshot` containing the cache digest and
228
- capture time. Keep `source.id`, that snapshot, and each result capture. It does
229
- not search old tool directories, read SavedVariables, contact a provider, or
230
- change static DB2 queries. Product, locale and region are selected context;
231
- the file alone does not authenticate them. A record's numeric `region`, when
232
- present in its format, is preserved separately.
233
-
234
- For named fields, add `--table <name>` and optionally `--record <record-id>`:
235
-
236
- ```text
237
- lycheedev data hotfix --source dbcache --snapshot <data-pin> --dbcache <DBCache.bin> --table ItemSparse --record <id> --format json
238
- ```
239
-
240
- The command uses the data pin's exact WoWDBDefs commit and build. It returns
241
- `sources`, the selected `definition`, and each valid payload's `fields` alongside
242
- `payloadHex`. `--offline` prohibits definition downloads. Missing or ambiguous
243
- build definitions, colliding table hashes, invalid UTF-8, trailing/truncated
244
- payload and inline ID mismatch fail; no neighboring build is substituted.
245
- Schema metadata uses lowerCamelCase; record field names preserve DBD spelling.
246
-
247
- For raw inspection without definitions, omit `--table` and optionally filter
248
- with `--table-hash <eight hex digits>`. The two selectors cannot be combined.
249
- Obtain hashes from verified metadata, not a guessed table name. Matching
250
- physical records remain independent, including repeated IDs, negative pushes,
251
- unknown statuses and empty payloads. Named-table entries use `decodeState`:
252
- `decoded`, `no_payload`, or `not_valid`; only `decoded` has fields. An empty
253
- or invalidated record is not a decoded row of zero values.
254
-
255
- Use `--latest` when the question asks for the largest push batch within the
256
- selected table/record filters. `page.selectedPush` is chosen before pagination;
257
- all records in that batch remain, including ties, repeats and invalidations.
258
- It is neither one latest row per ID nor the last physical entry. Omit it when
259
- the investigation requires all retained pushes.
260
-
261
- If `page.truncated` is true, continue the immutable source with the returned
262
- `page.nextIndex` and the same filters:
263
-
264
- ```text
265
- lycheedev data hotfix --source dbcache --snapshot <derived-pin> --from <source.id> --after-index <page.nextIndex> --limit 50 --format json
266
- ```
267
-
268
- `--after-index` cannot read a live file: it requires the archived source so a
269
- client cache update cannot shift pagination. Physical order is not push order.
270
- `page.matched` counts all matching records (or the whole selected latest batch),
271
- not only this page. Preserve `--latest` and all table/ID filters when continuing.
272
- An ending suffix is not a complete whole-query result. Even `page.complete`
273
- only describes the selected local-cache query, never all server Hotfixes.
274
-
275
- Default input budget is 128 MiB (maximum 512 MiB), with 1–200 returned records
276
- and at most 8 MiB of raw payload per page. Decoded fields have an 8 MiB JSON
277
- page budget; each record allows 1 MiB of text and 65,536 field elements. Corrupt tails invalidate the query
278
- even when the first page would otherwise fit. Version/build/identity errors
279
- must not be worked around by silently changing the selected build or cache.
280
- Wago is supported for remote Hotfix records using explicit product, build,
281
- region and locale context; `--offline` uses its verified cached pages only.
282
- Raidbots is supported as a separate source for a supplied `DBCache.bin` less
283
- than 30 days old. Keep provider and coverage explicit: neither source is an
284
- effective static table overlay, and an incomplete result cannot establish
285
- absence outside its reported coverage.
286
-
287
- Treat Wago text search as candidate acceleration only. Establish a fact from
288
- the returned physical records after applying the exact product, full build,
289
- region, locale, table/hash, record, push and status filters relevant to the
290
- question. A zero-candidate page is not proof of absence unless the returned
291
- coverage is complete for that exact scope. Raidbots never acts as an implicit
292
- Wago fallback.
293
-
294
- ## Schema and change boundaries
295
-
296
- Never map a semantic word such as “name”, “model”, or “description” to a field
297
- by guess. Inspect the resolved schema or use a domain command that owns that
298
- relationship, then select the returned fields. Use named query parameters for
299
- user values rather than string interpolation.
300
-
301
- Hotfix/change records have separate semantics from static DB2 data. Do not use
302
- a static query to imply a change record, or silently merge a change into a
303
- static result. Preserve provider, build, filters, page/coverage, raw status,
304
- ordering, and whether the result is complete. A zero candidate page or an empty
305
- success is not by itself proof of absence when coverage is incomplete.
306
-
307
- For schema, cache or preparation errors, investigate the cause while retaining
308
- the same explicit identity. Never switch product, region, build or locale just
309
- to make a query return rows.
310
-
311
- If Wago returns zero candidates while `coverage.complete=false`, the result is
312
- unresolved rather than absence. Continue with the returned `nextCursor` or page
313
- continuation using the same product, build, region, locale, table, record,
314
- status and push identity. If `--search` was the only narrowing filter, remove
315
- that filter for a wider query while keeping the identity and provider fixed.
316
- If the budget is exhausted or coverage remains incomplete, report the result as
317
- inconclusive and preserve the coverage metadata; only a complete scan of the
318
- exact scope can support saying that no record was found.
319
-
320
- Product aliases and region/locale availability belong to the CLI resolver.
321
- Carry the canonical values it returns; do not infer a product from the install
322
- folder, a CDN slot, or an old tool's alias table.
3
+ Use this branch for static game records, SQL, Hotfixes and their preparation
4
+ failures. Follow the decisions below; open only the reference needed now.
5
+ The CLI owns product routing, archive recovery and verification.
6
+
7
+ ## 1. Choose the evidence
8
+
9
+ | Requested answer | Next step |
10
+ | --- | --- |
11
+ | Names, IDs, static coefficients or related records | Static lookup below; details in [data-tables.md](data-tables.md) |
12
+ | Changed records or retained Hotfix pushes | [data-hotfix.md](data-hotfix.md) |
13
+ | Values after applying a specified cache | Explicit `effective` query in [data-query-recipes.md](data-query-recipes.md) |
14
+ | Actual server behavior or measured coefficients | Establish the static baseline, then [live-investigation.md](live-investigation.md) when live work is authorized |
15
+
16
+ Static rows, client Hotfixes and server measurements are distinct evidence.
17
+ Do not silently substitute one for another or open a game for a static-only task.
18
+
19
+ ## 2. Fix the identity once
20
+
21
+ Use an explicit snapshot first, otherwise the invoking project's matching data
22
+ pin. Inspect it with `target show <pin>`; use `project status` if project context
23
+ is unclear. Check product, full build, region, locale and definitions against the
24
+ request. A conflicting project pin must not silently answer a different product:
25
+ use a matching explicit pin when the requested scope is clear; ask only for a
26
+ remaining identity choice. Do not overwrite the project lock for an investigation.
27
+
28
+ No matching pin? Read [data-targets.md](data-targets.md). `target list` lists saved
29
+ names, not supported products. Use canonical `forever`; the CLI determines its
30
+ publishing slot. Folder names and conversation language do not establish identity.
31
+ Choose the requested local installation or CDN source, then retain that source
32
+ and pin throughout the query. Different delivery configurations require separate,
33
+ labeled pins; they are not interchangeable evidence.
34
+ For local resolution, constrain the game root/client path with the requested
35
+ product; use returned candidates only when selection remains ambiguous.
36
+
37
+ ## 3. Query the smallest useful scope
38
+
39
+ - Verified ID: prefer the domain command that owns the needed relationship;
40
+ otherwise inspect table schema and query the ID or foreign key.
41
+ - Business name only: inspect the relevant name table schema, search its actual
42
+ localized field with an explicit limit, then resolve candidates by relationships
43
+ and class/rank/context. Do not pick the first matching name or ask the user to
44
+ supply a table/ID the toolkit can discover. If evidence leaves multiple valid
45
+ interpretations, present the remaining choices.
46
+ - Multiple tables, filtering or calculation: inspect the schemas and use SQL
47
+ with named parameters. Read [data-tables.md](data-tables.md) for mechanics and
48
+ [data-query-recipes.md](data-query-recipes.md) for parameter/overlay examples.
49
+
50
+ Use installed `describe --format json` or help for exact commands and flags.
51
+ If the installed CLI lacks a documented capability, report that version mismatch;
52
+ do not claim source-only changes are installed or invent a replacement flag.
53
+
54
+ ## 4. Decide whether the evidence answers the question
55
+
56
+ Read structured errors and coverage, not just exit status. Retain the snapshot,
57
+ source, record IDs, filters and capture IDs with the conclusion.
58
+
59
+ | Result | Decision |
60
+ | --- | --- |
61
+ | Complete for the requested scope | Answer within that scope; SQL LIMIT and a single record do not prove whole-table coverage |
62
+ | More pages/truncated | Use a returned cursor with unchanged pin/source/filters; search without a cursor needs the bounded alternative below |
63
+ | Missing keys/partitions or partial result | Use readable evidence with the limitation; empty partial results cannot establish absence |
64
+ | Failure/deadline | [data-recovery.md](data-recovery.md); correct the cause or stop the affected branch after bounded retry |
65
+
66
+ For JSONL, require a legal end frame and exit 0, then inspect coverage separately.
67
+ `db2 search` and `foreign-key` have no cursor: narrow to the requested scope,
68
+ increase the limit within documented bounds, or use ordered SQL pagination.
69
+ Do not invent `--after-id` for those verbs. With SQL, retain a stable unique order
70
+ and filters across pages; use the last ID as a parameter for keyset continuation.
71
+ For Hotfix continuation, retain the archived source/checkpoint rather than reread
72
+ a mutable cache. A healthy workspace or successful target resolution does not
73
+ prove that the requested content is available.
74
+
75
+ Finish with the finding, fixed provenance and unresolved scope. Static evidence
76
+ can be a completed baseline while server-side fitting remains unverified.
@@ -0,0 +1,55 @@
1
+ # Data failure recovery
2
+
3
+ Read only after a structured failure or incomplete coverage prevents the next
4
+ useful query. Preserve the original pin, source, command, error and captures.
5
+
6
+ ## Choose one corrective action
7
+
8
+ Separate installation identity, archive location, payload integrity, DB2 decoding and query binding;
9
+ a failure in one layer does not establish failure in another.
10
+
11
+ - A client subdirectory can legitimately share its parent's `.build.info` and
12
+ `Data/`. Their absence inside the client folder does not establish a damaged
13
+ or unofficial installation. Use the CLI's installation resolver.
14
+ - `archive.index_integrity` requires identifying the failing index/span/check;
15
+ do not assume mixed products caused it or bypass checksum validation.
16
+ - `records.local_object_unavailable` concerns the requested content. A missing
17
+ localized table can coexist with readable numeric tables. Inspect useful
18
+ tables under the same pin; report what remains unavailable.
19
+ - `records.remote_http` needs the failing request/stage before interpretation.
20
+ Installation flavor and publishing slot can differ; the CLI owns that mapping.
21
+ A guessed config URL or unavailable loose copy does not prove the build is
22
+ absent from CDN archives. Do not substitute another build or region.
23
+ - A healthy `doctor` checks workspace health, not selected-build readiness.
24
+ Its cache object count is not an inventory of all evidence blobs or prepared
25
+ source records. Test the requested table rather than infer availability.
26
+ - Missing keys preserve partial coverage. Static values and client Hotfixes do
27
+ not prove server-side coefficients; retain them as inputs to the live fitting
28
+ task instead of treating a static query as completion of that task.
29
+
30
+ ## Retry and stop
31
+
32
+ - Identity conflict: resolve the requested identity; never change a project lock
33
+ merely to make a read succeed. Compare separate pins as described in
34
+ [data-targets.md](data-targets.md) when delivery configurations differ.
35
+ - Unknown field or invalid SQL: inspect schema/error location, correct the query,
36
+ then retry. Unsupported expressions/formats need a supported alternative or an
37
+ explicit capability limit, not repeated unchanged calls.
38
+ - Missing cache under `--offline`: use available evidence and report the missing
39
+ prerequisite. Do not remove the restriction to make the command succeed.
40
+ - Missing keys: continue useful readable records, retaining partial coverage;
41
+ changing CDN hosts cannot supply a missing key.
42
+ - Deadline: static queries default to 300 seconds total. If progress or a known
43
+ preparation cost justifies it, make one deliberate budget extension with
44
+ `--timeout-seconds <1-3600>` within the task budget. A second deadline stops that
45
+ branch; do not keep raising budgets. Hotfix uses its own scan/request bounds.
46
+ - Transient I/O: the CLI already owns mirrors and route refresh. Allow at most
47
+ one unchanged retry within the task budget; repeated failure stops that branch
48
+ until its cause changes. Never script a second CDN-routing layer or bypass
49
+ integrity checks. Diagnose corrupt bytes rather than trying hosts until accepted.
50
+ - Interrupted Hotfix scan: recover the saved checkpoint under
51
+ [data-hotfix.md](data-hotfix.md), preserving its source and filters.
52
+
53
+ Stopping one unavailable branch does not prevent independent useful queries.
54
+ Report the unresolved part, exact failure, retained pin/capture/checkpoint and
55
+ what must change to proceed. An empty success is not a substitute for failure.
@@ -0,0 +1,170 @@
1
+ # Static tables and SQL
2
+
3
+ Read for name-to-ID discovery, schema, domain relationships, paging or SQL.
4
+
5
+ ## Find the requested records
6
+
7
+ For a business name rather than a known ID, first inspect the relevant name table's
8
+ schema, then search its actual localized field. For example, after pinning the
9
+ requested Forever build with enUS data:
10
+
11
+ ```text
12
+ lycheedev data db2 schema SpellName --snapshot <pin> --cdn --format json
13
+ lycheedev data db2 search SpellName --snapshot <pin> --cdn --field Name_lang --query Claw --limit 50 --format json
14
+ ```
15
+
16
+ Use `--installation` instead of `--cdn` for the selected local source. A substring
17
+ search can match other abilities, NPC spells and multiple ranks; never choose the
18
+ first row merely because its name matches. Inspect candidate relationships and
19
+ the requested class/rank context. A translated name is a search hypothesis, not
20
+ proof of identity. For a verified spell ID, use `data spell info` for its related
21
+ spell closure or `data db2 foreign-key SpellEffect --field SpellID --value <id>
22
+ --limit 50` with the same snapshot/source to inspect effects. Read the actual
23
+ schema before naming coefficient fields. Retain truncation and missing-section
24
+ coverage; a zero-result partial search cannot establish absence.
25
+
26
+ For a known table and record ID in an explicitly selected local installation:
27
+
28
+ ```text
29
+ lycheedev data db2 --snapshot <pin> --installation <game-root> --table <name> --id <id> --format json
30
+ ```
31
+
32
+ For the same query from CDN, replace the installation selector with `--cdn`.
33
+ Add `--offline` to prohibit all network access and reuse only this workspace's
34
+ verified configuration, fragment and definition caches. Missing cache data fails;
35
+ the command does not fall back to a local installation or change the pin.
36
+ The initial archive lookup can be slow when the provider lacks a group index.
37
+ Static `data` queries have one total time budget across preparation, downloads,
38
+ recovery and execution: 300 seconds by default. Use `--timeout-seconds <1-3600>`
39
+ to set it explicitly. A timeout returns `command.deadline` (exit 5), not an empty
40
+ successful result. Verified cached fragments remain reusable on a later query;
41
+ retry retains the same pin. This option does not apply to `data hotfix`, whose
42
+ scan/request budgets and saved checkpoints are documented in [data-hotfix.md](data-hotfix.md).
43
+
44
+ `game-root` contains `.build.info` and `Data/`; the same selected client directory
45
+ used in target resolution is also accepted and checked against the pin. The command selects the DB2
46
+ FileDataID from the pinned WoWDBDefs manifest, verifies the table hash in the
47
+ actual file, and binds its exact layout hash to the definition. It returns
48
+ `row`, `schema`, `layoutHash`, raw-source blob references and a JSON capture.
49
+ The capture concerns that requested record; inspect its coverage fields before
50
+ claiming completion. It does not establish whole-table coverage.
51
+ Record ID zero is allowed. A missing record is an error, not an empty full-table
52
+ query. Field verification/foreign-key metadata in `schema` is retained evidence,
53
+ not proof that every inferred DBD field meaning is correct.
54
+
55
+ Omit `--id` to read a bounded page (default 50, maximum 200 rows):
56
+
57
+ ```text
58
+ lycheedev data db2 --snapshot <pin> --installation <game-root> --table <name> --limit 50 --format json
59
+ lycheedev data db2 --snapshot <same-pin> --installation <same-root> --table <same-name> --limit 50 --after-id <page.next> --offline --format json
60
+ ```
61
+
62
+ Pages use ascending logical IDs, including copies. Omitted `--after-id` includes
63
+ ID zero; an explicit cursor excludes that ID. Continue only when `page.more`
64
+ is true, carrying `page.next` with the same snapshot and table. `--id` cannot
65
+ be combined with `--limit` or `--after-id`. Empty pages are valid. Preserve
66
+ each page's capture and cursor; a suffix ending at the last record is still not
67
+ the whole table. Captures mark full-table completion only when a first page
68
+ contains all rows. `truncated` denotes more rows after this page; false does
69
+ not imply that earlier rows were included.
70
+
71
+ On a cache miss, the command reads only manifest/DBD files at the DataPin's
72
+ exact definition commit from WoWDBDefs; it does not fetch a newer branch. Local
73
+ mode never fetches CDN game data. Add `--offline` to prohibit downloads; missing or corrupt
74
+ cached definitions fail explicitly. Cache bytes are rehashed before use. No
75
+ game input or game installation writes occur. Hotfix records are not overlaid.
76
+
77
+ The file limit is `--max-bytes` (default 128 MiB, maximum 512 MiB, applied to
78
+ both encoded and decoded file sizes). Parser budgets additionally bound metadata
79
+ to 64 MiB, indexed physical/copy rows to one million, columns/partitions to 4096,
80
+ and decoded row text to 1 MiB. A page's serialized row array is capped at 8 MiB;
81
+ any row failure or budget overflow returns no partial page. Page selection uses
82
+ bounded extra memory, but each CLI invocation currently reopens the table and
83
+ checks its selected source. Encrypted BLTE chunks use a pinned public TACT key
84
+ snapshot, fetched only when needed and cached with a verified digest. Offline
85
+ uses only cached keys. Supply `--key-file <WoW.txt|keys.json>` to use an explicit
86
+ text or JSON key set instead; private keys stay in request memory.
87
+
88
+ DB2 reads keep readable encrypted/non-encrypted sections when other sections
89
+ lack keys. Inspect `complete`, `partial`, `unavailablePartitions` (direct DB2)
90
+ or `tables[].unavailablePartitions` (schema/domain results). File provenance
91
+ separates `partialContent` plus missing chunk ranges from full CKey-verified
92
+ `content`; placeholder bytes never become decoded fields. A schema's `rowCount`
93
+ is the readable logical count, not the total number of records in a partial table.
94
+ Report missing keys and row coverage with the answer. Do not describe a partial
95
+ search, empty result, SQL aggregate or CSV as a full-build answer. Changing from
96
+ installation to CDN does not supply a missing key. Raw asset exports still
97
+ require the complete verified file.
98
+
99
+ ## Implemented static SQL
100
+
101
+ For parameterized lookups, flags, explicit Hotfix overlays and query diagnostics,
102
+ read [data-query-recipes.md](data-query-recipes.md). The `meta` catalog exposes
103
+ pinned enum/flag definitions; `effective` requires explicitly selected raw cache
104
+ captures in the query JSON. Unqualified and `static` tables retain static values.
105
+
106
+ Supply SQL as text, from a `.sql` or `.json` file, or from stdin. Exactly one
107
+ input mode is accepted. For JSON requests, use a UTF-8 file (at most 1 MiB):
108
+
109
+ ```json
110
+ {"sql":"SELECT ID, Filename FROM ChrClasses WHERE ID=:id","parameters":{"id":1}}
111
+ ```
112
+
113
+ ```text
114
+ lycheedev data sql --snapshot <pin> --installation <game-root> --file <query.json> --format json
115
+ lycheedev data sql --snapshot <pin> --cdn --sql 'SELECT ID FROM ChrClasses WHERE ID=:id' --param id=1 --format json
116
+ lycheedev data sql --snapshot <pin> --installation <game-root> --stdin --encoding csv --output <new-file.csv> --format json
117
+ ```
118
+
119
+ Repeat `--param <name=scalar>` for named SQL parameters; values must be scalar
120
+ JSON values. JSON request parameters must exactly match SQL parameters, and
121
+ integer tokens retain 64-bit precision. Duplicate or unknown request fields
122
+ fail. `--encoding csv` requires `--output <file>` and writes a CSV export with
123
+ its capture/manifest. Use SQL LIMIT/OFFSET, not CLI `--limit`. `--offline` and
124
+ `--max-bytes` have the same cache and per-file meanings as DB2 reading. Replace
125
+ `--installation` with `--cdn` for explicitly selected remote content.
126
+
127
+ Unqualified tables and qualified `static.Table` read pinned static values;
128
+ `static.Table` also bypasses CTE names. A Hotfix overlay is used only when the
129
+ query document explicitly names raw cache captures and queries `effective.Table`
130
+ as described in [data-query-recipes.md](data-query-recipes.md). There is no
131
+ implicit overlay or source fallback. Query output contains `query`,
132
+ `result` (ordered `columns` and positional `rows`, or `plan` for EXPLAIN), and
133
+ `sources` with each prepared table's provenance. Verify the returned capture
134
+ with `evidence verify <capture-id>`. Complete means the requested query result,
135
+ including any SQL LIMIT, not an unrestricted whole-table export. Missing-key
136
+ sections propagate `complete: false` and `partial: true` to SQL; source tables
137
+ retain missing ranges/partitions. CSV captures and manifests also retain
138
+ `complete: false`. JSONL end frames report partial coverage explicitly; a legal
139
+ end frame and exit 0 alone do not prove all encrypted sections were readable.
140
+
141
+ Supported paths include joins, grouping, ordinary CTEs, UNION ALL, correlated
142
+ expression subqueries (also in GROUP BY and aggregate inputs), and
143
+ one-seed/one-member recursive CTEs. Complex recursive forms still fail explicitly.
144
+ DB2 array fields become quoted scalar column names such as `"Field[0]"`.
145
+ Text functions require text; conversions and integer overflow fail explicitly.
146
+ EXPLAIN binds sources without scanning rows; it may still prepare table
147
+ bytes and definitions. EXPLAIN ANALYZE executes and reports scan counts/work/
148
+ charged bytes; charged bytes are not process peak memory.
149
+
150
+ Budgets: at most 32 physical tables, 512 MiB cumulative raw table content,
151
+ 10 million execution work units, 64 MiB execution accounting and 16 MiB JSON
152
+ evidence. Budget failures yield no partial query result. Narrow the query when
153
+ appropriate to the request; do not change the pinned build or imply full
154
+ coverage from a narrower successful query.
155
+
156
+ SQL errors use `error.stage: query` with `query.invalid_syntax` or
157
+ `query.unresolved_binding` (exit 2), `query.unsupported_expression` or
158
+ `query.budget_exceeded` (exit 3), and type/range/cardinality faults (exit 4).
159
+ Syntax faults include `error.location` with byte offset and line/column.
160
+ Correct the request or report the limitation; repeating an unchanged query
161
+ does not resolve these failures. Source/cache/I/O faults retain their own codes.
162
+
163
+ Domain commands are implemented for spells (`data spell info`, `data spell auras`,
164
+ `data spell summons`), items (`data item get`, `data item models`,
165
+ `data item geosets`, `data item textures`), creatures (`data creature display`,
166
+ `data creature model`), journal encounters (`data encounter get`), and house
167
+ decor (`data decor list`, `data decor get`). Prefer the domain command when it owns
168
+ the relationship needed to answer the question; use SQL/DB2 for other supported
169
+ tables. A static table result is not a substitute for requested Hotfix data.
170
+ Preserve source, table/record, locale, filters, row counts and capture hashes.