Skip to content

v0.3.0 - #2

Merged
sachin-panayil merged 4 commits into
mainfrom
sachin/deep-merge
Oct 7, 2026
Merged

sachin-panayil merged 4 commits into
mainfrom
sachin/deep-merge

Conversation

@sachin-panayil

@sachin-panayil sachin-panayil commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

v0.3.0

Problem

mergeWith previously used a shallow spread ({ ...baseline, ...existing, ...observed, ...derived }), which caused nested objects to be replaced wholesale. For example, an observed permissions.usageType could overwrite a manually set permissions.licenses. Observed values also always replaced manual edits, so fields like name were lost on subsequent runs (DSACMS/automated-codejson-generator#31). In addition, observed fields not defined by the active profile, such as repositoryHost on neutral, could leak into the output.

Solution

This release replaces the shallow merge with policy-based recursive merging. mergeWith now filters observed data through filterValidFields, dropping unknown fields, and a new mergeValue function applies rules based on each field's dotted path. Observed values take precedence for fields such as repositoryURL, repositoryVisibility, laborHours, reuseFrequency.forks, and repository dates. tags and reusedCode are unioned, with reused-code entries deduplicated case-insensitively by URL or name. For all other fields, existing manual values are preserved and detected values only fill fields considered unset (undefined, null, or equal to the baseline default).

Result

Manual edits now survive repeated runs at any nesting depth. Fields such as name and description retain manual values unless blank, while tags and dependencies are unioned instead of replaced. Deleted detected tags or dependencies are restored on the next run, and baseline values such as maturityModelTier: 0 are treated as unset so detection can update them.

Test Plan

Testing includes bun install && bun test && bun run typecheck && bun run lint && bun run build, with 73 tests passing.

@sachin-panayil sachin-panayil self-assigned this Oct 1, 2026

@natalialuzuriaga natalialuzuriaga left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM! Amazing work on this

Comment thread src/assemble.ts
Comment thread src/README.md
@sachin-panayil
sachin-panayil merged commit fd7ffe4 into main Oct 7, 2026
6 of 10 checks passed
@sachin-panayil
sachin-panayil deleted the sachin/deep-merge branch October 7, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants