Skip to content

Conversation

@Azorlogh
Copy link
Contributor

@Azorlogh Azorlogh commented Dec 1, 2025

Summary by cubic

Adds transaction templates to ledger schemas and lets clients execute transactions by template ID. When a schema is active, transactions must use a template; without a schema, existing behaviors still work.

  • New Features

    • Schema supports transaction templates (id, description, script, runtime).
    • Templates are validated at schema update; invalid templates return ErrInvalidSchema.
    • CreateTransaction accepts script.template and vars; cannot mix with postings or plain numscript.
    • With a schema: template is required. Without a schema: postings or plain numscript still allowed.
    • Transactions now include a template field; events (CommittedTransactions/RevertedTransaction) and responses return it.
    • OpenAPI/SDK/docs updated; storage persists templates with the schema and records transaction.template.
  • Migration

    • If using schemas: add templates under data.transactions and update clients to send script.template (+ vars). Do not send postings or ad‑hoc scripts.
    • If consuming InsertedSchema events: transactions is now included; Committed/Reverted transaction events now include template.

Written for commit c98d75c. Summary will update automatically on new commits.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/transaction_templates

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 and usage tips.

@Azorlogh Azorlogh force-pushed the feat/transaction_templates branch from 4a8518f to c98d75c Compare December 4, 2025 16:56
@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 73.33333% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.82%. Comparing base (f67c560) to head (c98d75c).

Files with missing lines Patch % Lines
internal/controller/ledger/controller_default.go 56.52% 2 Missing and 8 partials ⚠️
internal/transaction_templates.go 82.35% 3 Missing and 3 partials ⚠️
internal/api/v2/controllers_transactions_create.go 83.33% 0 Missing and 2 partials ⚠️
internal/errors.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           feat/schema    #1176      +/-   ##
===============================================
- Coverage        78.17%   77.82%   -0.35%     
===============================================
  Files              197      198       +1     
  Lines            10056    10115      +59     
===============================================
+ Hits              7861     7872      +11     
- Misses            1375     1379       +4     
- Partials           820      864      +44     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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