Skip to content

Fix type errors, comment accuracy, test hygiene, and harvest normalization#19

Merged
andreimerlescu merged 30 commits intomainfrom
hotfix/alias
Apr 9, 2026
Merged

Fix type errors, comment accuracy, test hygiene, and harvest normalization#19
andreimerlescu merged 30 commits intomainfrom
hotfix/alias

Conversation

@andreimerlescu
Copy link
Copy Markdown
Owner

@andreimerlescu andreimerlescu commented Apr 7, 2026

  • Identify failing test (TestFigTree_SaveTo_ListRoundTrip)
  • Revert expected slice back to ["one", "three", "two"] to match actual implementation output

@andreimerlescu andreimerlescu requested a review from Copilot April 7, 2026 14:02
@andreimerlescu andreimerlescu self-assigned this Apr 7, 2026
@andreimerlescu andreimerlescu added the enhancement New feature or request label Apr 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 resolveName and 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copilot AI changed the title Alias Support Fix type errors, comment accuracy, test hygiene, and harvest normalization Apr 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

andreimerlescu and others added 6 commits April 8, 2026 11:26
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

andreimerlescu and others added 2 commits April 8, 2026 14:41
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>
@andreimerlescu
Copy link
Copy Markdown
Owner Author

LGTM 👍

@andreimerlescu andreimerlescu merged commit 6a8eb43 into main Apr 9, 2026
6 checks passed
@andreimerlescu andreimerlescu deleted the hotfix/alias branch April 9, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants