Skip to content

Watchflow Rules Validation Issues #9

@dimeloper

Description

@dimeloper

Problem Description

There are two critical issues with the current Watchflow rules validation system that impact developer experience and rule testing workflows:

1. Misleading Success Status When Rules File is Missing

Current Behavior:

  • When .watchflow/rules.yaml is missing, the check shows an error message but still reports "All checks have passed" and "All rules passed"
  • This creates confusion as the status indicates success despite the missing configuration

Example Output:

**Watchflow rules file not found**
The file `.watchflow/rules.yaml` is missing from your repository.

[... error message continues ...]

Merge info
All checks have passed ✅
2 successful checks
successful checks
* CI - Lint and Test / lint-and-test (pull_request) ✅
* Watchflow Rules — All rules passed ✅

Expected Behavior:

  • When rules file is missing, the check should fail with appropriate status
  • Status should clearly indicate that Watchflow validation failed
  • Should prevent merge if configured as a required check

2. Rules Only Read from Main Branch

Current Behavior:

  • Watchflow always reads rules from the main branch, regardless of which branch is being validated
  • This prevents testing rule changes in feature branches before merging
  • Makes it impossible to validate new rules alongside the code changes they're meant to protect

Impact:

  • Developers cannot iterate on rules in feature branches
  • Rule changes must be merged blindly without validation
  • No way to test rule modifications against the current PR changes

Expected Behavior:

  • Watchflow should provide a parameter/configuration option to read rules from the current branch being validated
  • By default, rules should continue to be read from main branch (maintaining backward compatibility)
  • When enabled, this allows rule development and testing in feature branches
  • Enables validation of both code and rule changes together in the same PR

Proposed Solutions

For Issue #1: Fix Missing Rules Status

  • Change check status to failed when .watchflow/rules.yaml is missing
  • Update status message to clearly indicate validation failure
  • Ensure GitHub branch protection rules can properly block merges

For Issue #2: Enable Branch-Based Rules

  • Add a configuration parameter to control rules source branch (default: main)
  • When parameter is set, read rules from the current branch being validated
  • Maintain default behavior of reading from main branch for backward compatibility
  • Update documentation with branch-based rule development workflow and new parameter usage

Acceptance Criteria

  • Missing rules file causes check to fail (not pass)
  • GitHub status clearly indicates Watchflow validation failure
  • Configuration parameter available to read rules from current branch
  • Default behavior remains reading rules from main branch
  • When enabled, rules can be read from feature branches
  • Rule changes can be tested before merging to main when parameter is configured
  • Backward compatibility maintained for existing setups
  • Documentation updated with new workflow patterns and parameter usage

Additional Context

These issues significantly impact the developer experience when working with Watchflow rules. The first issue can lead to false confidence in merge safety, while the second prevents proper rule development workflows when teams need to iterate on rules alongside their code changes.

The proposed parameter-based approach for branch rules maintains backward compatibility while enabling advanced workflows for teams that need to test rule modifications in feature branches.

Both changes would align Watchflow behavior with standard expectations for CI/CD tools and GitHub status checks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions