Skip to content

[issue #99] Validate workflow template role ids against role and model registries in CI - #123

Open
Saber5656 wants to merge 3 commits into
mainfrom
codex/issue-99-template-role-ci-validation
Open

[issue #99] Validate workflow template role ids against role and model registries in CI#123
Saber5656 wants to merge 3 commits into
mainfrom
codex/issue-99-template-role-ci-validation

Conversation

@Saber5656

Copy link
Copy Markdown
Owner

Summary

Milestone M0 (contract hygiene) of the deterministic-harness migration (epic #120); unblocks deterministic role binding (#110). Adds a fail-closed CI validation that resolves every steps[].role of every active workflow template against the role sources, and fixes the existing silent contract drift (tech-implementer declared nowhere).

Changes

  • New organization/runtime/workflows/scripts/template_role_validator.py
    • Enumerates active templates from organization/runtime/workflows/registry.yaml (status=active: 6 templates / 21 steps) and resolves each steps[].role against three sources: the organization/roles/<id>/ directory, the role registry (role_layers), and the model registry (Model Routing table).
    • Model-registry resolution is status-aware: only status=active rows resolve; non-active roles fail with model_registry_entry_not_active, missing/empty status with model_registry_status_missing, unknown status values with model_registry_status_invalid — all typed errors naming template file, step, and role id. Parse errors and missing registries fail closed.
    • CLI supports explicit path overrides for test fixtures while the zero-argument CI invocation is unchanged.
  • organization/runtime/workflows/templates/standard_code_change.yaml: implement-step role tech-implementertech-backend (exists in the role directory and both registries, and matches how other code-change templates assign the implementation role).
  • scripts/validate_all.py: validator registered in CONTRACT_CMDS, so .github/workflows/validate.yml (push/PR) runs it with no workflow changes.
  • New organization/runtime/workflows/tests/test_template_role_validator.py (5 cases) including end-to-end negative coverage: a fixture with an unknown role id run as a subprocess asserts typed JSON errors, non-zero exit, and validate_all contract failure (run_contractresult=fail).

Testing

  • python3 organization/runtime/workflows/scripts/template_role_validator.pydecision: ok, 6 active templates / 21 steps, no errors.
  • python3 organization/runtime/workflows/tests/test_template_role_validator.py → pass (5 cases).
  • python3 scripts/validate_all.pyresult: pass (42 suites incl. the new one, contracts incl. the new validator).
  • Negative path exercised deliberately: unknown role id → role_directory_missing, role_registry_entry_missing, model_registry_entry_missing with non-zero exit propagating to a contract failure.

Review

  • tech-qa role review (independent session), two rounds:
    • Round 1: blocking — (1) model-registry status column ignored (reference/deprecated roles accepted → silent drift); (2) negative test covered only direct function calls, not the CLI exit → validate_all propagation.
    • Fixes applied (third commit), then round 2 re-review: approve — both findings verified resolved; CI integration and fail-closed path-override behavior confirmed.

Closes #99

🤖 Generated with Claude Code

@Saber5656 Saber5656 added the bug Something isn't working label Jul 17, 2026
@Saber5656 Saber5656 self-assigned this Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 31 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: a69ce9a6-817f-4158-8bb0-0b032e591a55

📥 Commits

Reviewing files that changed from the base of the PR and between f71b8cd and 3c1aff3.

📒 Files selected for processing (4)
  • organization/runtime/workflows/scripts/template_role_validator.py
  • organization/runtime/workflows/templates/standard_code_change.yaml
  • organization/runtime/workflows/tests/test_template_role_validator.py
  • scripts/validate_all.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-99-template-role-ci-validation

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.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[contracts] Validate workflow template role ids against role and model registries in CI

1 participant