Skip to content

Commit 3b0ef4f

Browse files
tmp
1 parent 9920fd1 commit 3b0ef4f

126 files changed

Lines changed: 25777 additions & 9097 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
- `uv sync --all-extras` installs the full dev environment.
1212
- `uv sync --reinstall-package egglog --all-extras` rebuilds the Rust extension after changes in `src/`.
13+
- `make test` is the default command for a full test sweep; it runs the suite in `--release` mode and uses the repo's parallel runner.
1314
- `uv run pytest --benchmark-disable -q` runs the Python tests without benchmark calibration.
1415
- `make mypy` runs the type checker.
1516
- `make stubtest` checks the runtime against the type stubs.
@@ -30,6 +31,25 @@
3031
- Prefer relative imports inside `python/egglog`.
3132
- When changing public high-level APIs, update the public docs, stubs, and pretty/freeze round-trip expectations together.
3233
- Higher-order callable type probing should stay isolated from the live ruleset: copy declarations and run with no current ruleset so inference does not register temporary unnamed functions or rewrites.
34+
- If a helper returns a primitive or container and must participate in rewrites or higher-order container ops, implement it as an exact Rust builtin.
35+
- If that helper can naturally be partial, prefer a fallible builtin on the builtin/base sort itself over wrapping the result in a subsystem-local optional sort.
36+
- If that partial builtin may be undefined for some inputs, remember the runtime behavior precisely:
37+
- in actions, undefined partial primitive results error
38+
- in facts / antecedent-style use, undefined partial primitive calls cause the rule to skip rather than firing
39+
- in higher-order container ops, the container primitive should define the policy for undefined callback results, for example skipping those entries or failing the whole op
40+
- Use partial builtins in antecedent/lookup positions by default; do not materialize them in actions unless definedness has already been proven.
41+
- In Python, only pass exact builtins or partials of exact builtins into higher-order container ops for this workflow.
42+
- Do not add Python-bodied primitive/container helpers or anonymous lambda callbacks for these paths.
43+
- Prefer `x == y` over `eq(x).to(y)` for ordinary equality facts, checks, and rule antecedents when the sort uses the default equality relation.
44+
- Only fall back to `eq(x).to(y)` when the sort overloads `__eq__` and you explicitly need the raw equality relation rather than the overloaded meaning.
45+
- Prefer the correct container shape for higher-order ops:
46+
- use the container whose semantics match the operation rather than forcing the logic through whatever higher-order primitive already exists
47+
- use `Set` for support / keys / uniqueness-preserving operations
48+
- use `MultiSet` only when multiplicity is semantically required
49+
- use `Vec` when order, positional access, or stable sequencing is part of the semantics
50+
- use `Map` when the operation is keyed and values matter, not just the key support
51+
- if the right higher-order container op does not exist for the right container type, add it in Rust instead of forcing the logic through a mismatched container
52+
- A bare expression in an action already materializes that expression; do not write `union(x).with_(x)` when `x` alone has the same effect.
3353

3454
## Array API
3555

@@ -45,6 +65,9 @@
4565

4666
- Prefer the minimal code change and the minimal diff that solves the task; only broaden the change if the smaller fix is not sufficient.
4767
- For long-running profiling or trace probes, run them with explicit timeouts, check for lingering worker processes before and after, and inspect memory usage after any timeout or manual kill before starting the next experiment.
68+
- For raw engine/container primitive smoke tests, prefer `/Users/saul/p/egg-smol/tests/map.egg` with `cargo run --manifest-path /Users/saul/p/egg-smol/Cargo.toml -- /Users/saul/p/egg-smol/tests/map.egg`.
69+
- Do not rerun broad suites after doc-only or comment-only edits; run the smallest targeted check that could actually fail.
70+
- If you need to run the full repo test suite, prefer `make test` over ad hoc `cargo test` or broad `pytest` invocations.
4871
- Run `make mypy` for typing changes.
4972
- Run targeted pytest for touched modules.
5073
- Run `make docs` for docs or public API changes.

Cargo.lock

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ opentelemetry = "0.28"
1818
opentelemetry-otlp = { version = "0.28", features = ["http-proto", "reqwest-blocking-client", "trace"] }
1919
opentelemetry-stdout = { version = "0.28", features = ["trace"] }
2020
opentelemetry_sdk = "0.28"
21-
egglog = { git = "https://github.com/egraphs-good/egglog.git", default-features = false, rev = "b5c211b9def133cad9540a11744e8a1e40bd2a29" }
22-
egglog-ast = { git = "https://github.com/egraphs-good/egglog.git", rev = "b5c211b9def133cad9540a11744e8a1e40bd2a29" }
23-
egglog-core-relations = { git = "https://github.com/egraphs-good/egglog.git", rev = "b5c211b9def133cad9540a11744e8a1e40bd2a29" }
24-
egglog-reports = { git = "https://github.com/egraphs-good/egglog.git", rev = "b5c211b9def133cad9540a11744e8a1e40bd2a29" }
25-
egglog-bridge = { git = "https://github.com/egraphs-good/egglog.git", rev = "b5c211b9def133cad9540a11744e8a1e40bd2a29" }
21+
egglog = { path = "../egg-smol", default-features = false }
22+
egglog-ast = { path = "../egg-smol/egglog-ast" }
23+
egglog-core-relations = { path = "../egg-smol/core-relations" }
24+
egglog-reports = { path = "../egg-smol/egglog-reports" }
25+
egglog-bridge = { path = "../egg-smol/egglog-bridge" }
2626

2727

28-
egglog-experimental = { git = "https://github.com/egraphs-good/egglog-experimental.git", default-features = false, rev = "3f38efab7307b765bdb912b81e99736f27e00b1f" }
28+
egglog-experimental = { path = "../egglog-experimental", default-features = false }
2929
egraph-serialize = { version = "0.3", features = ["serde", "graphviz"] }
3030
serde_json = "1"
3131
pyo3-log = "*"
@@ -43,3 +43,10 @@ base64 = "0.22.1"
4343
# enable debug symbols for easier profiling
4444
[profile.release]
4545
debug = true
46+
47+
[patch."https://github.com/egraphs-good/egglog.git"]
48+
egglog = { path = "../egg-smol", default-features = false }
49+
egglog-ast = { path = "../egg-smol/egglog-ast" }
50+
egglog-core-relations = { path = "../egg-smol/core-relations" }
51+
egglog-reports = { path = "../egg-smol/egglog-reports" }
52+
egglog-bridge = { path = "../egg-smol/egglog-bridge" }

0 commit comments

Comments
 (0)