tools: Wise Old Man name change import script#321
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4dc7f51200
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const { parseArgs } = require('node:util'); | ||
|
|
||
| const { WOMClient } = require('@wise-old-man/utils'); | ||
| const { normalizeRsn } = require('@blert/common'); |
There was a problem hiding this comment.
Use a runtime-available normalizer
When this documented node tools/historic-name-changes.cjs ... command is run from a clean checkout before building workspaces, this require('@blert/common') resolves to the workspace package whose main is dist/index.js, but common/dist is not committed or produced by the root postinstall. The tool therefore aborts before parsing arguments unless the operator happens to have run the common build first; either inline this small normalization helper or load a file that exists at runtime.
Useful? React with 👍 / 👎.
Creates a script which looks up the full name change history for a player through the Wise Old Man APIs then submits it to the admin name change API, either in dry run or apply mode.
4dc7f51 to
9de74d0
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9de74d08bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (chain.length === 0) { | ||
| console.log(`No approved name changes found for "${opts.username}".`); | ||
| return; |
There was a problem hiding this comment.
Keep zero-change JSON output parseable
When --json is used for a player with no approved name changes, this branch still writes a human-readable sentence to stdout and exits successfully. Callers that consistently parse JSON output will fail on this otherwise normal result; emit a JSON value in this path or send the message to stderr when JSON mode is active.
Useful? React with 👍 / 👎.
| return { | ||
| oldName: nc.oldName, | ||
| newName: nc.newName, | ||
| effectiveFrom: nc.resolvedAt ?? nc.updatedAt ?? nc.createdAt, |
There was a problem hiding this comment.
Use the rename observation time for migration boundaries
When a WOM name-change request is approved after the rename was submitted or detected, resolvedAt is the administrative resolution time rather than when the new name became effective. The server treats effectiveFrom as the exact boundary for ownership windows, so Blert challenges recorded under the new name between creation and approval can be assigned to the old-name window or evicted from the target as prior-holder data; prefer the observation/creation timestamp rather than resolvedAt for this cutoff.
Useful? React with 👍 / 👎.
Creates a script which looks up the full name change history for a player through the Wise Old Man APIs then submits it to the admin name change API, either in dry run or apply mode.