Skip to content

Add property-based tests for Weave rebase and attribute-scope invariants #94

Description

@coderabbitai

Summary

Add substantive property-based tests or a bounded state model for the stateful behaviour documented by the weave-git-merge skill.

The current tests validate fixed documentation strings and one global rebase flow. They do not validate the ordering invariants for multi-commit rebases or the fallback behaviour across Git attribute scopes.

Rationale

A silently invalid resolution in an early rebase commit can become the ours stage for later commits. Attribute-scope fallbacks also depend on the operation type and the active Git attribute source. Static documentation checks cannot establish these invariants.

Affected areas

  • tests/test_weave_git_merge_skill.py
  • skills/weave-git-merge/SKILL.md
  • skills/weave-git-merge/references/behaviour.md
  • Any test fixtures or helper modules needed to model rebase replay and attribute scopes

Required changes

Add either Hypothesis tests or a bounded state model. Cover these dimensions:

  • Operation types: rebase and merge.
  • Attribute scopes: repository-tracked .gitattributes, local .git/info/attributes, and the global core.attributesFile.
  • Stage validity: base (:1:), ours (:2:), theirs (:3:), and the resolved working file.
  • Multi-commit replay transitions, including propagation when an early replay result is structurally invalid.
  • Fallback behaviour that disables only the intended attribute source and verifies the effective merge attribute.

Use generated or enumerated sequences to assert the documented safety properties. Do not rely only on fixed prose assertions.

Acceptance criteria

  • Tests cover every operation type and attribute scope listed above.
  • Tests cover valid and invalid index-stage combinations.
  • Tests model at least two replay transitions and verify that invalid early output cannot be accepted as a safe later ours stage.
  • Tests verify the expected fallback result for each supported attribute scope.
  • The tests fail when transition order, stage validity, or fallback scope handling is changed incorrectly.
  • Existing documentation tests remain intact.

Backlinks

Requested by: @leynos

Activity

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions