Repository navigation
social: refuse a damaged Settings or identity file instead of reading it as absent - #2721
Conversation
… it as absent readJson returned undefined for every failure, so a parked identity file that existed but did not parse read as "nothing saved": a server switch restarted the Bot as a stranger and the next park() replaced the only copy. It also made a torn flybot-social-server.json fall back to the config server as if the owner had never chosen one. Read only ENOENT as absent and refuse (bot/refused, path named) otherwise. A switch reads the target's parked file before it parks or writes anything, so a torn file refuses with the live layer and every byte still in place; the Settings choice refuses the controller at start instead of falling back; the known-server list warns and leaves a damaged entry out. Fixes #2717
The known-server list is read on every status poll, so one damaged credentials file would repeat the same warning on each one; the operator needs it once. Fixes #2717
|
Verdict: PASS at 22ad4b1 Ran at this tip: Red first — a copy of this tip with The three red lines on the base source, verbatim:
What I checked against #2717:
Checks at this tip: 18 of 19 completed and green; the only failure is Non-blocking note: |
summary length 584
checkpoint length 1055
body length 3044
Written-by: Dev
Owner: Dev
Reviewer: Reviewer
Fixes #2717
A damaged
flybot-social-server.jsonorflybot-social-bots.<tag>.jsonis no longer read as "nothing was saved".readJsonreturnsundefinedonly forENOENT; a file that exists and cannot be read or parsed throwsbot/refused, names the path, and is left untouched.Choice on the switch: refuse the whole switch. The target server's parked identity file is read before anything moves, so a torn file refuses
controller.set({ server, confirm: true })with the live layer still connected, the file byte-identical, and the refusal naming the path — nothing is parked and no override is written.park()only writes when there is something to save, so a refused switch can never leave an empty file in place of the old one. A torn Settings choice refuses the controller at start instead of falling back toconfig.server; a damaged other-server credentials file is warned about once per path and left out ofknown[]; a missing file still means "nothing saved yet".Ran at this tip:
619/619 in the full social suite; 5/5 in the new file (3 fail on the base
server-config.js: red before the fix); lint-plugins 0 errors; changelog check: 7 fragments well formed.Not run:
npm run verify(out of this task's scope), the core suite, smoke test.arch-docsneeds git history, unavailable in this API-built copy;docs/subsystems/social.mdis updated in the same branch.Checkpoint
{
"pr": 2721,
"claim": "Dev",
"issue": 2717,
"summary": "Damaged social settings or identity files are no longer read as "nothing saved". readJson returns undefined only for ENOENT; a file that exists but cannot be read or parsed refuses with a path-naming bot/refused. A switch reads the target server's parked identities before parking, so a torn file refuses the switch with the live layer connected and every byte intact; a torn Settings choice refuses at start instead of falling back to the config server, and a damaged other-server credentials file is warned about once. Missing files still read as absent, so first runs keep working.",
"files": [
"plugins/social/src/server-config.js",
"plugins/social/test/server-config-damaged-json.test.js",
"changelog.d/2717-social-readjson.fixed.md",
"docs/subsystems/social.md"
],
"checks": {
"ran": "plugins/social suite, plugin lint, changelog check",
"result": "green",
"at": "22ad4b1dd2b5a98b5b0f0ac0441025dc8907b56e"
},
"next": "none — ready for review"
}