Fix type errors, comment accuracy, test hygiene, and harvest normalization#19
Fix type errors, comment accuracy, test hygiene, and harvest normalization#19andreimerlescu merged 30 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds alias support to figtree so callers can register alternate (short/long) flag names that map to the same underlying *Value, and centralizes name/alias canonicalization via resolveName.
Changes:
- Introduces
resolveNameand updates most public APIs to resolve canonical fig names (alias support). - Updates parsing/mutation persistence for maps/lists (including string-based parsing paths) and adds regression tests.
- Adds/adjusts locking in several code paths and expands alias/concurrency test coverage.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| alias.go | Adds canonical name resolution + alias registration; introduces Problems() |
| alias_test.go | Adds concurrent pollinate read test + expands alias usage tests |
| parsing.go | Routes lookups through resolveName in from() |
| loading.go | Adds locking around loadFlagSet() |
| internals.go | Locks setValuesFromMap() and resolves names before mutate |
| mutations.go | Uses canonical names in getters; adjusts list parsing from string/*string |
| mutations_store.go | Resolves names in Store; fixes map parsing SplitN limit; improves change detection |
| mutations_store_test.go | Adds tests for map parsing from raw string and mutation firing behavior |
| validators.go | Uses canonical name resolution for validators |
| rules.go | Uses canonical name resolution for rules |
| callback.go | Uses canonical name resolution for callbacks |
| errors.go | Uses canonical name resolution for ErrorFor |
| miracles.go | Adds locking + canonicalization for FigFlesh |
| map_flag.go | Uses canonical name resolution in MapKeys |
| list_flag.go | Uses canonical name resolution in ListValues |
| mutagenesis.go | Resolves canonical names in MutagenesisOfFig |
| assure.go | Refactors many validator error paths/messages |
| test.config.ini | Updates sample config format to INI-style key=value |
Comments suppressed due to low confidence (2)
mutations_store.go:66
- Store sends on tree.mutationsCh while holding tree.mu.Lock(). If the channel is unbuffered/full (and With() currently initializes it unbuffered), Store can block indefinitely and effectively deadlock all other tree operations. Consider making mutationsCh always buffered per Options.Harvest and/or performing a non-blocking send (select with default) or sending after releasing the mutex.
if tree.tracking && !tree.angel.Load() {
// error is at this line due to the deadlock
tree.mutationsCh <- Mutation{
Property: name,
Mutagenesis: strings.ToLower(string(mut)),
Way: "Store" + string(mut),
assure.go:586
- AssureListMinLength returns "list is empty" when len(l) < min, even if the list is non-empty but shorter than min. This makes the error incorrect and unhelpful. Consider reporting the required minimum and the actual length.
l := v.ToList()
if len(l) < min {
return fmt.Errorf("list is empty")
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…is of thoroughness
…omitted by mistake
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
mutagenesis.go:40
- MutagenesisOfFig only reads shared state; taking an exclusive tree.mu.Lock() reduces concurrency unnecessarily. Prefer tree.mu.RLock()/RUnlock() here (resolveName only reads aliases).
// MutagenesisOfFig returns the Mutagensis of the name
func (tree *figTree) MutagenesisOfFig(name string) Mutagenesis {
tree.mu.Lock()
defer tree.mu.Unlock()
name = tree.resolveName(name)
fruit, ok := tree.figs[name]
if !ok {
return ""
}
return fruit.Mutagenesis
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…t, clean up test env, fix harvest normalization Agent-Logs-Url: https://github.com/andreimerlescu/figtree/sessions/91a91017-32b2-411d-8c19-35dfd7d408a7 Co-authored-by: andreimerlescu <50429147+andreimerlescu@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…oolString to figFlesh
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…the lock deadlock scenario in the Store() method
…er silent problem
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tch actual output Agent-Logs-Url: https://github.com/andreimerlescu/figtree/sessions/6ae317aa-ed23-4c89-ac93-5fa9d002ab15 Co-authored-by: andreimerlescu <50429147+andreimerlescu@users.noreply.github.com>
|
LGTM 👍 |
TestFigTree_SaveTo_ListRoundTrip)["one", "three", "two"]to match actual implementation output