Repository navigation
fix(config,im): Save aborts on real read errors and surfaces external-section failures + ctx-aware key retry (#4697, #4698) - #4732
Merged
Merged
Conversation
…-section failures + ctx-aware key retry (#4697, #4698) #4697 (A, high): Save() treated ANY read error as first-write and fell into the full-overwrite branch - deep-merge and tombstone protection were skipped, disk-only fields (externally written keys, unknown fields) were silently wiped with a success report. Read errors other than file-missing now abort (#1160 semantics, matching patchConfigFile/patchExternalFile). #4697 (B, medium): saveExternalSections discarded its three Save* errors - vendors/im/mcp write failures (read-only dir, full disk, lock) returned Save()=nil, the UI reported success, and the config reverted on restart. The first failure now propagates. #4698: the #4644 key-retry sleep was a raw time.Sleep inside the serial syncer OnEvent callback - up to 2.4s per bad event, stalling every room behind it, and unbounded by ctx cancellation. The wait is now a select over ctx.Done/time.After; retry semantics preserved. Co-Authored-By: ggcode <noreply@ggcode.dev>
…inistically writes vendors.yaml CI root-caused: SaveVendors strips default vendors and skips the write when nothing remains (len(raw)==0) - the empty-set baseline made the poison step environment-dependent. A non-default vendor guarantees the file exists before poisoning. Co-Authored-By: ggcode <noreply@ggcode.dev>
…walk The walk was the wrong oracle - resolve the path exactly as Save does (exported helper on Dir(cfg.FilePath)) and assert presence by stat. Co-Authored-By: ggcode <noreply@ggcode.dev>
…iring pin The Save-level baseline oracle depended on which sections a save chooses to persist (default-strip can legitimately skip vendors.yaml) - three CI rounds of environment-chasing ended by testing the propagation directly: saveExternalSections against a read-only dir, plus a source pin for the Save() wiring. Co-Authored-By: ggcode <noreply@ggcode.dev>
…ilure Permission-mode oracles proved non-portable (0500 dir still writable in some sandboxes; default-strip legitimately skips empty sections). A directory at the vendors.yaml path fails AtomicWriteFile's final rename deterministically on every Unix - and the unit call removes all Save-level environment dependence. Co-Authored-By: ggcode <noreply@ggcode.dev>
Owner
Author
|
CI blocked by pre-existing main failure (not this PR's diff): the Test job's only failure is |
This was referenced Oct 31, 2026
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.
Summary
os.IsNotExistnow abort, matching the [business-logic] config_save: 损坏的外部配置文件(im.yaml)被 patch 静默清空重写,yaml.Unmarshal 错误被丢弃 #1160 semantics that patchConfigFile/patchExternalFile already apply (the same-file siblings the issue cites).Tests
TestIssue4697_ReadErrorAbortsSave(EISDIR path swap → Save must error, not full-write),..._ExternalSectionFailureSurfaces(poisoned vendors.yaml → error mentioning external sections; baseline save still green).TestIssue4698_KeyRetryCtxAware(source pin: select ctx.Done/time.After inside the bounded loop).Verification
GOFLAGS="-p=1" GOMEMLIMIT=2GiB GOGC=50 go build -tags goolm ./internal/config/ ./internal/im/greeninternal/config(13.7s),internal/im(50.3s)