fix(confgen): preserve sub-table book/sheet name in merger errors#420
Merged
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #420 +/- ##
==========================================
+ Coverage 74.87% 74.94% +0.07%
==========================================
Files 88 88
Lines 9384 9388 +4
==========================================
+ Hits 7026 7036 +10
+ Misses 1785 1781 -4
+ Partials 573 571 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
wenchy
approved these changes
Jun 18, 2026
When parseMessageFromOneImporter fails inside the ParseMessage merger goroutine, only PrimaryBookName/PrimarySheetName were attached to the wrapped error. Because Collector keeps just the outermost withMessage as outerWM, this overwrote the inner WrapKV layer that carried the actual sub-table's BookName/SheetName, so error messages pointed at the primary table instead of the offending sub-table. Attach the sub-table's BookName/SheetName on the same outer WrapKV layer alongside the primary names, so all four fields survive into the final NewDesc.
…ution Add isolated testdata under internal/confgen/testdata/collector_merger/ to verify error origin attribution in merger flow (shard CSV + main book with merger option). Kept in a separate top-level dir to avoid polluting the shared collectortest proto package consumed by normal/overflow suites via buildWorkbookIndex shard resolution.
d223100 to
9a93349
Compare
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
When a merger sub-table fails to parse, error messages incorrectly attributed the failure to the primary book/sheet instead of the offending sub-table. This PR fixes the attribution and adds an integration test to lock the behavior in.
Problem
ParseMessagerunsparseMessageFromOneImporterfor each merger importer in a goroutine. When one fails, the returned error was wrapped only withPrimaryBookName/PrimarySheetName:Collectorretains only the outermostwithMessageasouterWM, so this outerWrapKVoverwrote the inner layer that carried the actual sub-table'sBookName/SheetName. The finalNewDesctherefore pointed at the primary table rather than the shard that actually failed.Fix
Attach the sub-table's
BookName/SheetNameon the same outerWrapKVlayer alongside the primary names, so all four fields survive toNewDesc:bookName/sheetNameare now computed once and reused for both the error path and the success-pathoneMsg.Test
Added
internal/confgen/testdata/collector_merger/containing:proto/merger.proto— a workbook (MergerCollector#*.csv) with one sheet whosemergeroption pullsMergerShard*.csv#MergerCollectorItemConf.csv/merger/MergerCollector#@TABLEAU.csv,MergerCollector#MergerCollectorItemConf.csv,MergerShard1#MergerCollectorItemConf.csv— fixtures triggering a parse error in the shard.collector_integration_test.goasserts the error description contains the shard book/sheet (MergerShard1/MergerCollectorItemConf) rather than only the primary book/sheet.Why a separate top-level testdata dir?
buildWorkbookIndexresolves merger shard globs in the test'sinputDir. Ifmerger.protolived under the sharedcollector/proto/directory, thenormal/andoverflow/test suites — which reuse the samecollectortestproto package — would fail to resolveMergerShard*.csvin their owninputDirs. An isolatedcollector_merger/dir with its own proto package avoids polluting those suites; the trade-off is one extra top-level testdata directory.Risk
Low. Pure additive on the error path (extra KV fields) plus new test fixtures. No behavior change on the success path beyond hoisting two local variables.