Decode Dialog/Talk ExcelConfigData partially via msgspec Structs#388
Merged
Conversation
- DialogExcelConfigDataItem is now a msgspec.Struct with only the consumed fields; the rotating obfuscated dialog-id key is a shared constant in deobfuscation.py - Cuts the dialog-hash precompute chain from ~3.8s to ~0.4s (CHS regen 17.2s -> 14.3s), with byte-identical corpus output Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- TalkExcelConfigDataItem is now a msgspec.Struct with only the consumed cleartext fields; consumers use attribute access - talk excel file discovery (split vs legacy single file) extracted into talk_excel_file_names(); first_seen.scan_snapshot uses it with load_excel_raw + _row_id so historic-era key styles keep working Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Profiling the post-msgspec 17s CHS regen showed the largest chunks of the precompute region were full decodes of huge Excel files from which only a handful of fields are ever consumed. This switches the two biggest —
DialogExcelConfigData.json(93MB) andTalkExcelConfigData_*.json(141MB) — to partial typed decodes: their item types are nowmsgspec.Structs with only the consumed fields, decoded directly withmsgspec.json.decode(..., type=...). msgspec skips unparsed fields, so:precompute_for_workers, ~3.9s): full decode + deobfuscation rename + mapping passes drop from ~3.8s to ~0.4s (~10x).build_talk_trackercritical path): decode drops from ~1.0s to ~0.2s.Full CHS regen: 17.2s → 13.1s.
Notable details
GFLDJMJKIKE) is now a publicDIALOG_EXCEL_ID_KEYconstant indeobfuscation.py, used both in the field-mapping literal and as the dialog Struct's rename target — one source of truth. If the key rotates in a future build and the constant goes stale, the decode fails loudly with a missing-required-field error.deobfuscate_dialog_excel_config_datais deleted (the Struct rename replaces it), along with the unusedtalkRolefield and itsDialogTalkRoleTypedDict (no other references).first_seen.scan_snapshotscans historical AGD checkouts where the id key style varies by era (id/Id/_id), so it now goes through the sameload_excel_raw+_row_idpath it already uses for every other excel domain; the split-vs-legacy-single-file discovery is extracted intoDataRepo.talk_excel_file_names()shared by both paths.agd_typesnow importsmsgspecanddeobfuscation; both are cycle-free.Testing
diff -r, excludingmetadata.jsoncommit fields).first_seen.scan_snapshotsmoke-tested against the current build (talk domain: 42,001 ids, matching the typed decode).pre-commit run(black, isort, mypy) and the full pytest suite pass (199 passed, 57 skipped).🤖 Generated with Claude Code