Repository navigation
Fix six small bugs: bot.json reapply, stale gateway.pid, send ID reuse, migrations, crash files, claim lines - #128
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 529d94971b
ℹ️ 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 made: [ChannelAdapter, string][] = []; | ||
| for (const channel of next.channels) { | ||
| const config = liveChannel(channel, next.name); | ||
| if (live.channels.get(channel.id) !== config) made.push([await this.#loadChannel(channel, next.name), config]); |
There was a problem hiding this comment.
Reload persisted adapter state after stopping the old channel
When a Feishu/Lark channel is reconfigured while it has unflushed state, constructing its replacement before removing the old adapter loads an outdated snapshot. FeishuChannel reads its state file in its constructor, but batches state writes for one second and flushes outstanding changes in stop(). The replacement therefore misses that final flush and subsequently overwrites it with its stale snapshot, losing recently learned message mappings and other channel state. For example, #storeOwn can then silently skip logging a card edit because its message-to-chat mapping is gone. Validate the new configuration first if needed, but load or refresh the replacement's persisted state after the old adapter has stopped.
Useful? React with 👍 / 👎.
…ce while a restart waits
3977887 to
5e1940a
Compare
… joins the arguments
Six small bugs from a code review, each fixed in its own commit, each with a test that fails before its fix.
test/definition.test.ts.pots startrefused, and on Windowspots service stopcould taskkill that program. Now the process's arguments must runpots start: the Pots entry point (thepotsbin,pots.js,pots.tsor the Windows shim) and thenstartas its first argument that is not an option, sopots --log-level debug startcounts./proc/<pid>/cmdlinegives the arguments on Linux; on macOS (ps) and Windows (Win32_Process) the line is split at spaces outside double quotes. A command line that cannot be read still counts as a gateway.pots service restartreads each PID's command line once while it polls, and the Windows stop checks afresh right before a forced stop. Test:test/cli.test.ts.spec/Outbox.tlaalready assumed one place per send ID; its comment now says so. Test:test/gateway.test.ts.addMissingColumns(src/core/sql.ts), which does it in one transaction, as log.ts does. Test:test/sql.parts.test.ts, with two real processes that open the pages store of an old schema; it fails on origin/main with "duplicate column name".crash-after-sendin a bot folder killed the whole gateway. Now they work only withPOTS_TEST_CRASH_FILES=1, whichtest/support/gateway.tssets. Test:test/gateway.behavior.test.ts. The crash tests in gateway.behavior, children, nesting, memory and pages still pass.writeSecretsremoved every earlier claim line, so a second link that wrote the same file before the first link was marked used made the first link open again after a crash. Now a write keeps the other claim lines, and each submission removes only its own line once its link is marked used, then clears its claim in the table. At the start, a used link whose claim is still in the table has its line removed too (a crash before the line went, or a receipt from an earlier release). Test:test/pages.parts.test.ts.Not taken from the review: a retry of a send ID with another destination can be overtaken by a later send to the first destination (needs a script that reuses an ID for another destination, with overlapping sends).
Tested:
npm run check, and only the touched test files, one at a time: definition, cli, gateway, properties, timers, sql.parts, pages, pages.parts, service, nesting, and the crash cases of gateway.behavior, children and memory. TLC was not run here. The outbox change touchesspec/Outbox.tla(comment only).