Skip to content

feat: run becwright in CI (GitHub Action), query rule decisions (why), reposition as the enforcement layer#58

Merged
DataDave-Dev merged 6 commits into
mainfrom
feat/github-action-and-decision-memory
Jul 1, 2026
Merged

feat: run becwright in CI (GitHub Action), query rule decisions (why), reposition as the enforcement layer#58
DataDave-Dev merged 6 commits into
mainfrom
feat/github-action-and-decision-memory

Conversation

@DataDave-Dev

Copy link
Copy Markdown
Owner

Summary

Three roadmap items from the "infrastructure, not utility" direction, plus a version fix. Each commit is atomic and leaves the suite green.

1. Run becwright in CI — the layer that can't be skipped (95bda29, 2d8a528)

  • New check --diff <base> scope: checks only the files a branch changed vs <base>, using the three-dot range base...HEAD so it matches exactly what a PR shows as "Files changed".
  • An unknown base ref raises GitError → exit 2 (a loud CI failure) instead of silently passing on an empty file list (e.g. a shallow clone without the base ref).
  • Official composite action.yml: installs becwright, resolves the PR base branch, and runs check --diff. Pre-existing debt on the rest of the repo never fails the build, so it can be adopted on a large codebase without a red wall.
  • .github/workflows/becwright.yml dogfoods the action on this repo's own PRs (local action, version: ., fetch-depth: 0).
  • Why it matters: a local hook is skippable with git commit --no-verify; a required CI check is not. This makes the rules infrastructure of the pipeline.

2. Queryable decision memory (cc58177)

  • becwright why [id] surfaces each rule's intent, why_it_matters and rejected_alternatives on demand — not only when a commit is blocked. --json for programmatic use.
  • New MCP tool list_rules returns the same decision records, so an agent can read the decisions it must not violate before it writes code and steer clear of a broken commit.
  • report.rule_record() is the shared serializer behind both.

3. Positioning + lean-context copy (70a6773, 6c90a65)

  • Leads every one-liner (both README heroes, PyPI/npm descriptions, the Claude Code plugin) with "the enforcement layer for AI coding agents" — a piece of the stack, not a script. The sign-vs-guard hook stays.
  • Adds the honest token/context angle: a blocked commit returns the one rule that broke, its why and the exact lines — the agent fixes that precisely instead of re-reading the whole style guide into context.

Fix (04db382)

  • __version__ 0.3.00.4.0 to match pyproject.toml (left behind by the 0.4.0 release, so becwright --version disagreed with the package metadata).

Test plan

  • pytest241 passed, coverage 93.14% (gate 80%).
  • New tests: check --diff (5, incl. loud failure on a bad base and "ignores debt outside the diff"), becwright why (7), MCP list_rules (2).
  • Smoke-tested against this repo: check --diff main → exit 0; bad base → exit 2; why / why <id> / why --json / unknown id.
  • On this PR: confirm the new becwright GitHub Action check runs and goes green (validates action.yml end-to-end).

Follow-ups (intentionally not in this PR)

  • npm/becwright/package.json optionalDependencies are still pinned to 0.3.0 while the package is 0.4.0 — needs a per-platform bump at release time.
  • Publish a floating @v1 tag so consumers can uses: DataDave-Dev/becwright@v1; the README example currently pins @main with a note.
  • Update the GitHub repo "About" description + social preview to the new tagline.

The 0.4.0 release bumped pyproject.toml but left __version__ at 0.3.0, so `becwright --version` and the packaged metadata disagreed. Align them.
Adds a third scope to `becwright check`, alongside staged (default) and --all:
--diff <base> checks only the files a branch changed vs <base>, using the
three-dot range (base...HEAD) so it matches exactly what a pull request shows
as 'Files changed'. Content is read from the working tree (in CI the checkout
already is the committed code).

An unknown base ref raises GitError -> exit 2 (a loud CI failure) instead of
silently passing on an empty file list, e.g. on a shallow clone without the
base ref. --all and --diff are mutually exclusive.

This is the engine half of running becwright as a required CI check: a local
hook can be skipped with 'git commit --no-verify', a required check cannot.
action.yml is a composite action that installs becwright, resolves the PR base
ref, and runs 'becwright check --diff <base>' — checking only the files the PR
changed. Making it a required check enforces the rules even when the local
pre-commit hook is bypassed with --no-verify: infrastructure, not a suggestion.

Pre-existing debt on the rest of the repo never fails the build, so it can be
adopted on a large codebase without a red wall. Inputs: base, version,
python-version, args (all optional).

.github/workflows/becwright.yml dogfoods the action on this repo's own PRs via
the local action with version: . (installs the checked-out becwright), which
both verifies the action end-to-end and guards this repo the way we ask others
to guard theirs.
…memory

Every rule already carries its intent, the reason behind it and rejected
alternatives (the BEC's Bound half), but so far they only surfaced when a commit
was blocked. Now they can be read on demand:

- 'becwright why' lists every rule with its intent; 'becwright why <id>' shows
  the full decision record; '--json' emits it for programmatic use.
- The MCP server gains a 'list_rules' tool returning the same records, so an
  agent can read the decisions it must not violate *before* writing code and
  steer clear of a blocked commit instead of discovering the rule only when it
  fires.

report.rule_record() is the shared serializer behind both. This turns the
.bec/rules.yaml catalog into queryable architectural memory: you don't hand the
model all the context, you hand it the decisions it can't break.
Leads every one-liner with the category instead of the mechanism — a piece of
the stack, not a script. Consistent across the surfaces where the pitch appears:
both README heroes, the PyPI (pyproject) and npm descriptions, and the Claude
Code plugin (plugin.json + its README). The sign-vs-guard hook stays; the
positioning line now sits above it and the mechanism (runs the rules, blocks the
commit, any author) follows.
…json)

The honest version of 'give the AI only what it needs': a blocked commit
returns the one rule that broke, its why and the exact lines, so the agent fixes
that precisely instead of re-reading the whole style guide into context — and the
guarantee never depended on the model reading anything. Added to the AI-agents
section of both READMEs.
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@DataDave-Dev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 64d4d14b-e08a-42a7-b88f-eaccae92e321

📥 Commits

Reviewing files that changed from the base of the PR and between 2914845 and 6c90a65.

📒 Files selected for processing (16)
  • .github/workflows/becwright.yml
  • README.es.md
  • README.md
  • action.yml
  • documentation/mcp.md
  • integrations/claude-code/.claude-plugin/plugin.json
  • integrations/claude-code/README.md
  • npm/becwright/package.json
  • pyproject.toml
  • src/becwright/__init__.py
  • src/becwright/cli.py
  • src/becwright/git.py
  • src/becwright/mcp_server.py
  • src/becwright/report.py
  • tests/test_cli_and_git.py
  • tests/test_mcp.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/github-action-and-decision-memory

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@DataDave-Dev DataDave-Dev merged commit c43b64c into main Jul 1, 2026
5 checks passed
@DataDave-Dev DataDave-Dev deleted the feat/github-action-and-decision-memory branch July 1, 2026 23:39
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.

1 participant