Shopify / Shopify/packwerk

[Bug Report] Behaviour of enforce_dependencies: key missing

Open
#319 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Ruby
Stars
1.9k
Forks
121
Avg merge
2m
Merged PRs (30d)
1

Description

Description
Without enforce_dependencies: present in a package config, it is assumed that dependency enforcement is false. I think this is a bug because the key should be required. You can turn off dependency enforcement if you want, but the package YAML should explicitly do so. It makes it easier to turn on later, and to have a more readable config file.

Since dependency enforcement is Packwerk's only flagship check now, I don't know why you wouldn't want to use it eventually.

To Reproduce
Create a package.yml without enforce_dependencies and run bin/packwerk validate. This passes, and Packwerk registers this as being disabled / false.

Expected Behaviour
Validation fails and asks for the ket to exist, or the default is true.

Screenshots
If applicable, add screenshots to help explain your problem.

Version Information

  • Packwerk: 3.0 / edge
  • Ruby 3.2.1

Additional Context
I think we want to make the key required. It makes the most sense to me. All checker keys should likely be made required.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the package.yml configuration handling reached by bin/packwerk validate, and run the reproduction with enforce_dependencies omitted. Check the existing validation behavior and tests, if present. Done means validation consistently rejects a missing key or applies the agreed true default, with coverage for the missing-key case.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.