mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-14 14:17:58 +00:00
chore: drop CF→AWS migration tooling and stale JS-port references
The CF→AWS data migration (closed 2026-05-16) is long done and the tooling isn't wired into any production path. Remove the one-shot binary, its support package, and the migration runbook. In live code, replace 'JS-parity' / 'same shape as JS' / 'cross-runtime KV migration' comments with the real, stable reason for each behavior (wire-format invariant, null-vs-zero distinction, CloudWatch alarm field name, etc.). 24 files touched across lolschedule, loldle, wordle, twentyq, trading, misc, util, server, metrics, ai, keylock. - delete cmd/migrate_cf_data/ - delete internal/migration/ - delete docs/cf-to-aws-migration-runbook.md
This commit is contained in:
1 parent
c901f3ad40
commit
ec77a24db7
47 files changed
+142
-1491
No files matched your search
@@ -31,9 +31,9 @@ const defaultTarget = "VNG"
|
||||
// %s slots: target (escaped), sender mention, sender mention.
|
||||
const trongTruongHopTemplate = "Trong trường hợp nhóm này bị điều tra bởi %s, %s khẳng định không liên quan tới nhóm hoặc những cá nhân khác trong nhóm này. %s không rõ tại sao lại có mặt ở đây vào thời điểm này, có lẽ tài khoản đã được thêm bởi một bên thứ ba."
|
||||
|
||||
// lastPing mirrors the JS bot's wire format: { at: <ms-since-epoch number> }.
|
||||
// Stored as int64 ms-epoch (not time.Time → RFC3339) so a future cross-runtime
|
||||
// KV export/import migration round-trips byte-for-byte.
|
||||
// lastPing is the value stored at the `last_ping` key: { at: <ms-since-epoch> }.
|
||||
// int64 ms-epoch (not time.Time → RFC3339) keeps the on-disk shape compact
|
||||
// and consistent with every other timestamp field in the bot's KV.
|
||||
type lastPing struct {
|
||||
At int64 `json:"at"`
|
||||
}
|
||||
|
||||
@@ -45,9 +45,8 @@ func TestPing_WritesLastPingKV(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
kv := storage.NewMemoryKVStore()
|
||||
|
||||
// Drive the KV side directly: lock the wire format (ms-epoch number, not
|
||||
// RFC3339 string). A JS-written {at: 1700000000000} must round-trip into
|
||||
// the Go struct without a custom decoder.
|
||||
// Drive the KV side directly: lock the wire format as a ms-epoch number
|
||||
// (not an RFC3339 string), matching every other timestamp in the bot's KV.
|
||||
if err := kv.PutJSON(ctx, lastPingKey, lastPing{At: time.Now().UTC().UnixMilli()}); err != nil {
|
||||
t.Fatalf("PutJSON: %v", err)
|
||||
}
|
||||
@@ -60,16 +59,16 @@ func TestPing_WritesLastPingKV(t *testing.T) {
|
||||
t.Errorf("read-back lastPing.At = %d, want positive ms-epoch", got.At)
|
||||
}
|
||||
|
||||
// Also verify a value with the JS-shape decodes correctly.
|
||||
// Verify a hand-written {"at": <ms-epoch>} document decodes correctly.
|
||||
if err := kv.Put(ctx, lastPingKey, []byte(`{"at":1700000000000}`)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got = lastPing{}
|
||||
if err := kv.GetJSON(ctx, lastPingKey, &got); err != nil {
|
||||
t.Fatalf("GetJSON js-shape: %v", err)
|
||||
t.Fatalf("GetJSON ms-epoch shape: %v", err)
|
||||
}
|
||||
if got.At != 1700000000000 {
|
||||
t.Errorf("js-shape round-trip: At = %d, want 1700000000000", got.At)
|
||||
t.Errorf("ms-epoch round-trip: At = %d, want 1700000000000", got.At)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user