feat: nix flake#2
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (4)
📒 Files selected for processing (50)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.gitignore:
- Around line 1-9: Add the missing .tmp/ ignore rule to .gitignore so generated
artifacts are not committed; update the .gitignore (alongside entries like
.direnv/ and .env) to include a line with ".tmp/" (avoid duplicating an existing
rule and place it with other generated/local directories) to align with
AGENTS.md's generated-path policy.
In `@AGENTS.md`:
- Around line 367-382: The roadmap example links currently point to the wrong
repository (st0x.liquidity); update the example markdown lines that show
issue/PR links — specifically the patterns "- [ ] [`#N` Issue
title](https://github.com/ST0x-Technology/st0x.liquidity/issues/N)" and "PR: [`#M`
PR title](https://github.com/ST0x-Technology/st0x.liquidity/pull/M)" — to use
the correct repository base (event-sorcery) so both issue and PR example URLs
and any explanatory text reference the event-sorcery GitHub paths consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f46e875b-4e0b-43aa-8f53-d981da211551
⛔ Files ignored due to path filters (1)
flake.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
.envrc.gitignoreAGENTS.mdflake.nix
727a410 to
3246722
Compare
Rainix-based nix flake providing the rust toolchain, sqlx-cli, cargo-expand, cargo-nextest, and the pre-commit hooks listed in .pre-commit-config.yaml. .envrc auto-loads the shell via nix-direnv. flake.lock pins all inputs for reproducibility.
* feat: workspace + copy sqlite-es and event-sorcery crates Crates copied verbatim from st0x.issuance (sqlite-es) and st0x.liquidity (event-sorcery). Adds workspace Cargo.toml with strict lints (warnings/clippy::all/pedantic/nursery/unwrap_used/expect_used denied; unsafe_code forbidden), clippy.toml exempting unwrap/expect in tests, and the canonical events+snapshots schema migration. Workspace dependency versions audited and bumped to current semver-compatible releases. cqrs-es held at 0.4.12 — 0.5.0 is a major bump pending deliberate upgrade. * feat: AGENTS.md, README, and docs (cqrs, sqlx, ttdd) (#4) * feat: AGENTS.md, SPEC.md, README, and docs AGENTS.md adapted from upstream st0x conventions, trimmed to the rules that apply here (drops alloy/brokerage/onchain bits). SPEC.md describes the library's goals, components, and behavior. docs/domain.md is the CQRS/ES glossary and naming conventions. docs/cqrs.md is a usage reference. docs/sqlx.md is the running pitfall log. docs/ttdd.md is the type-driven TDD methodology. CLAUDE.md is a symlink to AGENTS.md so both names resolve to the same source of truth. * feat: GitHub Actions CI (#5) * feat: GitHub Actions CI Matrix runs cargo check / nextest / clippy / fmt --check, plus a separate job for pre-commit hooks. Every step uses 'nix develop -c …' so CI runs the same toolchain as local dev. Caches ~/.cargo and target/ keyed on lockfile + flake.lock. * feat: replace SqliteProjectionRepo with RepoFamily GAT (#6) * feat: replace SqliteProjectionRepo with ViewBackend GAT The previous design parameterized Projection over a Repo type that was bound to ViewRepository<Lifecycle<Entity>, Lifecycle<Entity>>. That bound named the pub(crate) Lifecycle type in a public position, tripping the private_bounds lint, and was suppressed with #[allow(private_bounds)] in three impl blocks pending the crate's extraction. ViewBackend is a GAT-on-trait HKT emulation: a ViewBackend instance is a type-level function (View, Aggregate) -> SomeRepo. Projection<Entity, Backend: ViewBackend> applies the function internally to obtain Backend::Repo<Lifecycle<Entity>, Lifecycle<Entity>>, so Lifecycle saturation happens inside the struct/method bodies, not in any public bound. SqliteViewBackend is the default. The three #[allow(private_bounds)] suppressions are removed. Test repos InMemoryRepo<View, Agg> and ConflictingRepo<View, Agg> made generic with paired ViewBackend adapters so existing tests still compile. * docs: add examples of how to use the repo (#7) Adds a runnable examples/ directory at the workspace root covering the core event-sorcery surface: - basic_entity: smallest setup -- EventSourced, Store, send/load, load_entity, send_command, load_all_ids, count_aggregates, load_ids_paginated, compact_events, incremental_vacuum. - projection: Materialized = Table with a SQLite generated column for filtered queries; load/load_all/filter/rebuild/rebuild_all; injects a domain Service via Arc<dyn Clock>. - reactor: multi-entity StockAlert reactor wired across two stores plus a single-entity AuditLog reactor running alongside an auto-projection. Each example has a README.md explaining the concept and a #[cfg(all(test, feature = "test-support"))] mod tests block exercising replay, TestHarness, TestStore, SpyReactor, and ReactorHarness. examples/README.md indexes the three; the repo-root README.md links to it. CI now runs every example in a dedicated matrix job and includes --all-targets so example test modules execute under cargo nextest.
* chore: bootstrap repo with LICENSE and shared config MIT LICENSE plus repo-wide configuration that applies to every PR in the stack: .gitignore, .yamlfmt (formatter config), and .coderabbit.yaml (review automation). * feat: nix flake (#2) * feat: nix dev shell + direnv Rainix-based nix flake providing the rust toolchain, sqlx-cli, cargo-expand, cargo-nextest, and the pre-commit hooks listed in .pre-commit-config.yaml. .envrc auto-loads the shell via nix-direnv. flake.lock pins all inputs for reproducibility. * feat: copy sqlite-es and event-sorcery crates (#3) * feat: workspace + copy sqlite-es and event-sorcery crates Crates copied verbatim from st0x.issuance (sqlite-es) and st0x.liquidity (event-sorcery). Adds workspace Cargo.toml with strict lints (warnings/clippy::all/pedantic/nursery/unwrap_used/expect_used denied; unsafe_code forbidden), clippy.toml exempting unwrap/expect in tests, and the canonical events+snapshots schema migration. Workspace dependency versions audited and bumped to current semver-compatible releases. cqrs-es held at 0.4.12 — 0.5.0 is a major bump pending deliberate upgrade. * feat: AGENTS.md, README, and docs (cqrs, sqlx, ttdd) (#4) * feat: AGENTS.md, SPEC.md, README, and docs AGENTS.md adapted from upstream st0x conventions, trimmed to the rules that apply here (drops alloy/brokerage/onchain bits). SPEC.md describes the library's goals, components, and behavior. docs/domain.md is the CQRS/ES glossary and naming conventions. docs/cqrs.md is a usage reference. docs/sqlx.md is the running pitfall log. docs/ttdd.md is the type-driven TDD methodology. CLAUDE.md is a symlink to AGENTS.md so both names resolve to the same source of truth. * feat: GitHub Actions CI (#5) * feat: GitHub Actions CI Matrix runs cargo check / nextest / clippy / fmt --check, plus a separate job for pre-commit hooks. Every step uses 'nix develop -c …' so CI runs the same toolchain as local dev. Caches ~/.cargo and target/ keyed on lockfile + flake.lock. * feat: replace SqliteProjectionRepo with RepoFamily GAT (#6) * feat: replace SqliteProjectionRepo with ViewBackend GAT The previous design parameterized Projection over a Repo type that was bound to ViewRepository<Lifecycle<Entity>, Lifecycle<Entity>>. That bound named the pub(crate) Lifecycle type in a public position, tripping the private_bounds lint, and was suppressed with #[allow(private_bounds)] in three impl blocks pending the crate's extraction. ViewBackend is a GAT-on-trait HKT emulation: a ViewBackend instance is a type-level function (View, Aggregate) -> SomeRepo. Projection<Entity, Backend: ViewBackend> applies the function internally to obtain Backend::Repo<Lifecycle<Entity>, Lifecycle<Entity>>, so Lifecycle saturation happens inside the struct/method bodies, not in any public bound. SqliteViewBackend is the default. The three #[allow(private_bounds)] suppressions are removed. Test repos InMemoryRepo<View, Agg> and ConflictingRepo<View, Agg> made generic with paired ViewBackend adapters so existing tests still compile. * docs: add examples of how to use the repo (#7) Adds a runnable examples/ directory at the workspace root covering the core event-sorcery surface: - basic_entity: smallest setup -- EventSourced, Store, send/load, load_entity, send_command, load_all_ids, count_aggregates, load_ids_paginated, compact_events, incremental_vacuum. - projection: Materialized = Table with a SQLite generated column for filtered queries; load/load_all/filter/rebuild/rebuild_all; injects a domain Service via Arc<dyn Clock>. - reactor: multi-entity StockAlert reactor wired across two stores plus a single-entity AuditLog reactor running alongside an auto-projection. Each example has a README.md explaining the concept and a #[cfg(all(test, feature = "test-support"))] mod tests block exercising replay, TestHarness, TestStore, SpyReactor, and ReactorHarness. examples/README.md indexes the three; the repo-root README.md links to it. CI now runs every example in a dedicated matrix job and includes --all-targets so example test modules execute under cargo nextest.

Closes RAI-459.
What
Bootstraps the repository with foundational project scaffolding:
.envrc— configuresnix-direnvto automatically load the Nix dev shell when entering the directory, watchingflake.nixandflake.lockfor changes.gitignore— excludes build artifacts, local databases, secrets, and tooling cachesflake.nix+flake.lock— defines the Nix dev shell withsqlx-cli,cargo-expand, andcargo-nexteston top of therainixbase environmentAGENTS.md— comprehensive AI agent guidance covering architecture, coding standards, workflow, testing strategy, security, and documentation conventionsWhy
The repository needed a reproducible development environment and a clear set of conventions for both human contributors and AI agents. The Nix flake ensures all developers get identical tooling.
AGENTS.mdencodes the project's architectural decisions, quality control policies, and domain rules in one place so AI agents can operate consistently without repeated clarification.How
The Nix flake inherits the
rainixdev shell and extends it with Rust-specific tooling.nix-direnvis wired via.envrcto activate the shell automatically.AGENTS.mdis structured as a living reference document with a strict character-limit policy to keep it maintainable, covering everything from planning hierarchy and epic decomposition to code style rules and financial data integrity requirements.Summary by CodeRabbit