Skip to content

SchemaGetter.makeTreeRecord mutates duplicate array-valued leaves #7640

Closed

Description

@kitlangton

What version of Effect is running?

effect 4.0.0-rc.112 source at 0af0985d5c132b33e14a2df59e0567d7ba2a1710, Node 26.5.0.

What steps can reproduce the bug?

import { SchemaGetter } from "effect"

const first = ["read"]
console.log(SchemaGetter.makeTreeRecord([
  ["permissions", first], ["permissions", ["write"]]
]))
console.log(first)

What is the expected behavior?

{ permissions: [["read"], ["write"]] }, with first still ["read"]. The generic helper accepts array-valued leaves and documents duplicate-path aggregation.

What do you see instead?

{ permissions: ["read", ["write"]] }, with first mutated to ["read", ["write"]]. Frozen array leaves throw. Scalar and object-valued duplicates pass.

Additional information

Regression tests: pnpm test --run packages/effect/test/schema/SchemaGetter.test.ts gives 3 failures / 40 passes on base and 43 passes with the fix. Structural conflict replacement is a separate existing behavior, addressed by #6627.

Audit

Runtime correctness audit; intended label: audit.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions