Skip to content

CommonJS model: the depth cutoff fires on known leaves and sends the whole file to the pre-model path #36

Open

Description

@inth3shadows

Found in the round-1 review of branch fix/commonjs-model-gaps (stacked on PR #29, which fixes #32).

incomplete() returns 'depth cutoff' as soon as depth > 8, before it checks the value's kind. So a fully known leaf (data or a function) nested more than 8 levels deep makes the whole file unmodelled. Prototype chains count toward the same depth.

Repro: exports.a = a; exports.cfg = {l1:{l2:{l3:{l4:{l5:{l6:{l7:{l8:{l9: 1}}}}}}}}}; gives incomplete: depth cutoff, so every member, including a, resolves through the pre-model path.

This is safe, because the fallback is baseline, but it gives up more often than it needs to.

Fix direction: apply the cutoff only when the walk would go into an unexplored identity or union, not at a leaf.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions