Add user-defined translation rules (--rules)#32
Merged
Conversation
…able Those parentheticals track who validates each scheduler against a real cluster (a process note in CLAUDE.md), not anything user-facing — Run.ai's and LSF's parser/emitter are first-class like every other. The Type column now just names the paradigm. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016PnTz6Zxqa4jHocK8kCbyx
Let users adjust a conversion without patching BAMMM: a --rules file rewrites the SPLAT IR between parse and emit, so one rule set applies regardless of the source/target pair. - internal/rules: a Ruleset of match → action entries. `when` matches on from/to/has/equals; actions are default, set, rename, remove, plus a warn string. Paths are full SPLAT document paths (spec.schedule.queue, ...), evaluated over a generic map so removes actually drop fields. - convert.ConvertWithRules threads the ruleset through parse → apply → emit and returns rule warnings; Convert stays a thin wrapper (nil ruleset). - `bammm convert --rules <file>` for single and bulk runs; warnings print to stderr. Worked example in examples/rules/, reference in docs/translation-rules.md (promoted from design to implemented). This is option 1 (declarative rules file) from the earlier design; CEL expressions and array-index paths remain future work. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016PnTz6Zxqa4jHocK8kCbyx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements option 1 — the declarative translation-rules file — plus a small
README fix that missed the merge window.
--rules(user-defined translation rules)Adjust a conversion without patching BAMMM. A rules file rewrites the SPLAT IR
between parse and emit, so one rule set works for any source/target pair:
internal/rules—whenmatches onfrom/to/has/equals; actions aredefault,set,rename,remove, with an optionalwarn. Full SPLATdocument paths (
spec.schedule.queue); evaluated over a generic map soremovegenuinely drops fields.convert.ConvertWithRulesthreads the ruleset through and returns warnings(printed to stderr);
Convertstays a thin nil-ruleset wrapper.--input-dir) conversions.examples/rules/; reference indocs/translation-rules.md(promoted from design → implemented).
CEL expressions and array-index paths are noted as future work.
Also: rescued README fix
Drops the internal
(Partner)/(Community)tags from the scheduler table (theytrack who validates each scheduler, not anything user-facing). This was
approved for #28 but pushed just after it merged, so it's cherry-picked here to
actually reach main.
Testing
internal/rulesunit tests: match gating, set/default/rename/remove, warn,nil-ruleset no-op.
--rulesroutes a value end-to-end (slurm→pbs →#PBS -q debug-queue+ stderr warning) and errors on a missing file.🤖 Generated with Claude Code