Skip to content

feat: batch mutations, JSON output, perf fix, cross-repo fix#43

Merged
avrabe merged 5 commits intomainfrom
feat/agent-ergo-batch
Mar 18, 2026
Merged

feat: batch mutations, JSON output, perf fix, cross-repo fix#43
avrabe merged 5 commits intomainfrom
feat/agent-ergo-batch

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Mar 18, 2026

Summary

Three parallel workstreams merged:

1. Performance fix

  • Copy on Severity enum (eliminates clones in validation loop)
  • #[inline] on hot accessors (store, schema, model, links)
  • Pre-sized HashMap/DiGraph with with_capacity(n) in LinkGraph::build
  • Eliminated redundant artifact_type() double-lookup
  • ~25-39% improvement on validate/100 benchmark

2. Cross-repo artifact discovery

  • ProjectContext::load() now loads external artifacts (prefixed with repo prefix)
  • rivet link and rivet add --link can now resolve cross-repo references
  • Graceful fallback when externals aren't synced (warns instead of failing)

3. Agent ergonomics (FEAT-055, FEAT-056)

  • rivet batch <file> — apply multiple mutations atomically from YAML
    • Supports add, link, modify actions
    • $prev variable for chaining (references last added artifact ID)
    • Two-phase: validate-all then apply-all
  • --format json enhanced for validate and coverage
    • Validate JSON: added result field (PASS/FAIL)
    • Coverage JSON: structured rules array with name/covered/total/percentage

Also fixed

  • Baseline tag git commands hardened against inherited GIT_DIR/GIT_WORK_TREE

Test plan

  • All tests pass
  • clippy clean
  • Benchmark validates improvement

🤖 Generated with Claude Code

Test and others added 5 commits March 18, 2026 08:28
Clear GIT_DIR and GIT_WORK_TREE environment variables in
check_baseline_tag and list_baseline_tags so they target the
specified repo_dir rather than an enclosing worktree. Also isolate
test git commands with env_remove to prevent tag collisions when
tests run inside a git worktree.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…EAT-055)

Add `rivet batch <file>` command that reads a YAML file containing
multiple mutations (add, link, modify) and applies them atomically.
All mutations are validated upfront before any file writes. Supports
$prev variable substitution to reference the ID generated by the
preceding add mutation, enabling chained artifact creation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…AT-056)

Add "result" field ("PASS"/"FAIL") to validate JSON output for both
standard and incremental pipelines. Restructure coverage JSON to use
"rules" array with percentage fields and "overall" summary object,
matching the agent-consumable schema specification.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ProjectContext::load() now loads external project artifacts (prefixed
with their repo prefix) so rivet link and rivet add --link can resolve
cross-repo references (e.g., sigil:L-7).

Fixes: FEAT-038
Refs: REQ-020

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…re-size collections

- Add Copy to Severity enum (eliminates clone overhead in validation loops)
- Add #[inline] to hot accessors in store, schema, model, links
- Pre-size HashMap and DiGraph with with_capacity(n) in LinkGraph::build()
- Eliminate redundant schema.artifact_type() double-lookup per artifact
- Defer ResolvedLink construction to the branch where it's used

Benchmark improvement: validate/100 ~25-39% faster.

Refs: REQ-013

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit 4cbe56a into main Mar 18, 2026
12 checks passed
@avrabe avrabe deleted the feat/agent-ergo-batch branch March 18, 2026 07:50
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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