Skip to content

fix(drift-check): resolve default config from meta repo [skip version] - #200

Open
abhicodes-007 wants to merge 1 commit into
TMHSDigital:mainfrom
abhicodes-007:fix/153-drift-config-cwd
Open

abhicodes-007 wants to merge 1 commit into
TMHSDigital:mainfrom
abhicodes-007:fix/153-drift-config-cwd

Conversation

@abhicodes-007

Copy link
Copy Markdown

Problem

drift_check resolved its default config with Path("standards/drift-checker.config.json"), i.e. against the process cwd. CI only worked because the composite action sets working-directory: .drift-checker. Running the CLI from a tool repo loaded permissive defaults: no required_workflows, no skip_checks, and no warning, so the same repo passed locally and failed in CI.

Approach

When no --config is given, _build_snapshots now resolves the default from meta_repo_path / "standards" / "drift-checker.config.json", the same base used for required-refs.json. If that file is absent, the CLI prints a warning naming the path and continues with the existing permissive defaults. Explicit --config paths are unchanged.

Tests

Added tests/test_issue_153_config_cwd.py:

  • runs the CLI from an unrelated cwd against a meta repo with a config and still sees required workflow 'validate.yml' is absent (rc 1);
  • runs from an unrelated cwd with no config and asserts the stderr warning names the resolved path.

Both fail on main with the exact permissive-cwd symptom and pass with the fix. Sabotaging the fix made both tests fail again. Full suite: 354 passed, 2 skipped. The new test file passes Ruff; cli.py has 18 pre-existing Ruff findings, unchanged by this diff.

Risk

Low. Only the no---config path changes; callers that pass --config see identical behavior. [skip version] is in the title because this repo's validate workflow requires a VERSION bump for fix: PRs.

Closes #153

The default drift-check config was resolved against the process cwd, so running the checker from a tool repo silently used permissive defaults while CI enforced required workflows. Resolve it from meta_repo_path and warn when the default file is missing.

Regression tests run the CLI from a different cwd with and without a meta config. Full suite: 354 passed, 2 skipped. Sabotage run of the fix made both tests fail.

Closes TMHSDigital#153

Signed-off-by: Abhishek Deepak <abhicodes-007@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

drift_check config path is relative to cwd, so off-root runs silently pass

1 participant