Skip to content

Add pre-commit hooks for Objective favorite and mujoco_viewer validation#517

Merged
davetcoleman merged 1 commit intomainfrom
ci/validate-objective-favorites
Mar 3, 2026
Merged

Add pre-commit hooks for Objective favorite and mujoco_viewer validation#517
davetcoleman merged 1 commit intomainfrom
ci/validate-objective-favorites

Conversation

@davetcoleman
Copy link
Member

@davetcoleman davetcoleman commented Feb 22, 2026

Summary

Converts the CI validation checks into local pre-commit hooks per @JWhitleyWork's feedback, so they run on every commit and as part of the existing pre-commit CI job (no additional GHA servers needed).

Adds two bash scripts under scripts/ as local pre-commit hooks:

  • check_objective_favorites.sh — Enforces two rules:
    1. Non-runnable Objectives (<Metadata runnable="false"/>) must not be favorited
    2. Maximum 8 favorited Objectives per config package — if everything is favorited, nothing is favorited
  • check_mujoco_viewer.sh — Ensures mujoco_viewer is not set to true in any committed config file

Both hooks are triggered by relevant file patterns (.xml and config.yaml respectively) and run via the existing format.yaml CI workflow.

Test plan

  • Both scripts pass locally: bash scripts/check_objective_favorites.sh and bash scripts/check_mujoco_viewer.sh
  • Both hooks pass via pre-commit run --all-files
  • CI pre-commit job passes on this PR
  • Verify that adding _favorite="true" to a non-runnable Objective causes pre-commit to fail
  • Verify that exceeding 8 favorites in a config package causes pre-commit to fail

🤖 Generated with Claude Code

@davetcoleman davetcoleman force-pushed the ci/validate-objective-favorites branch from d3622da to cfeb17e Compare February 22, 2026 00:27
@davetcoleman
Copy link
Member Author

This won't pass until #516 is merged in (and cherry picked to main), which fixes the original problem.

@davetcoleman davetcoleman added this to the 9.1.0 milestone Feb 22, 2026
@davetcoleman davetcoleman force-pushed the ci/validate-objective-favorites branch from cfeb17e to 10eebbe Compare February 23, 2026 00:21
@davetcoleman davetcoleman changed the base branch from v9.0 to main February 24, 2026 16:57
@davetcoleman davetcoleman force-pushed the ci/validate-objective-favorites branch from 10eebbe to 5743513 Compare February 24, 2026 17:08
@davetcoleman davetcoleman changed the title Add CI check for objective favorite metadata Add CI check enforcing max 8 favorites per config package Feb 24, 2026
@JWhitleyWork
Copy link
Member

These would be much better suited as part of the pre-commit hook. Please convert to bash scripts that can be run as part of pre-commit. This verifies their correctness on every commit and also when the pre-commit job runs as part of CI. No GHA servers required.

…tion

Adds two local pre-commit hooks as bash scripts:
- check-objective-favorites: Ensures non-runnable Objectives are not
  favorited and enforces a max of 8 favorites per config package
- check-mujoco-viewer: Ensures mujoco_viewer is disabled in config files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@davetcoleman davetcoleman force-pushed the ci/validate-objective-favorites branch from 287588d to 1e58fe0 Compare February 25, 2026 00:57
@davetcoleman davetcoleman changed the title Add CI check enforcing max 8 favorites per config package Add pre-commit hooks for Objective favorite and mujoco_viewer validation Feb 25, 2026
@davetcoleman
Copy link
Member Author

Reworked per your feedback — moved from GHA workflow jobs to local pre-commit hooks (bash scripts in scripts/). They'll run on every commit and via the existing format.yaml pre-commit CI job, no additional GHA servers needed.

Copy link
Member

@JWhitleyWork JWhitleyWork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@davetcoleman davetcoleman merged commit a014161 into main Mar 3, 2026
5 checks passed
@davetcoleman davetcoleman deleted the ci/validate-objective-favorites branch March 3, 2026 03:19
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.

2 participants