Skip to content

adr: jobs replace services#8

Draft
0xgleb wants to merge 8 commits into
masterfrom
adr/associated-job
Draft

adr: jobs replace services#8
0xgleb wants to merge 8 commits into
masterfrom
adr/associated-job

Conversation

@0xgleb
Copy link
Copy Markdown
Collaborator

@0xgleb 0xgleb commented May 14, 2026

No description provided.

0xgleb added 7 commits May 9, 2026 18:03
MIT LICENSE plus repo-wide configuration that applies to every PR in the stack: .gitignore, .yamlfmt (formatter config), and .coderabbit.yaml (review automation).
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.
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.
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.
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.
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.
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.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

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.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c8cca64f-e3a9-4e40-8c0e-4e6ed82971a3

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch adr/associated-job

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.

Copy link
Copy Markdown
Collaborator Author

0xgleb commented May 14, 2026

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.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@0xgleb 0xgleb mentioned this pull request May 14, 2026
@0xgleb 0xgleb force-pushed the adr/associated-job branch 3 times, most recently from 005fece to 6be35b6 Compare May 14, 2026 09:23
@0xgleb 0xgleb force-pushed the adr/associated-job branch from 6be35b6 to a7950b2 Compare May 14, 2026 09:40
Base automatically changed from docs/examples to feat/deferred-types May 14, 2026 15:38
Base automatically changed from feat/deferred-types to feat/ci May 14, 2026 15:39
Base automatically changed from feat/ci to feat/docs May 14, 2026 15:39
Base automatically changed from feat/docs to feat/copy-crates May 14, 2026 15:40
Base automatically changed from feat/copy-crates to feat/nix-flake May 14, 2026 15:41
Base automatically changed from feat/nix-flake to feat/license May 14, 2026 15:41
Base automatically changed from feat/license to master May 14, 2026 16:05
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