# DS conformance

This document defines what it means for a runtime to be
a **conforming** DS implementation. States the test
categories every runtime must pass and the pass
criteria for each. Does not enumerate individual tests
— the concrete catalogue lives runtime-side at [RCTS]
so test names and scenarios can evolve without
churning the language spec.

Paired with:

- [LDET] — the foundational
  guarantee the conformance suite verifies.
- [LTES] — the author-facing testing
  contract that every runtime must deliver.
- [RCTS] — the enumerated test catalogue the reference
  runtime publishes.

## What this is not

- Not the enumeration of tests. That lives in
  [RCTS]
  where test names, scenarios, and pass outputs can
  be versioned alongside the reference runtime.
- Not a test harness spec. Harness contracts live in
  [LTES] and
  [RTIM].
- Not a performance benchmark. Conformance is about
  correctness, not speed.

---

(LCON-1)=
## The conformance claim [LCON.1]

(LCON-1-1)=
[LCON.1.1] A runtime is **conforming** if it passes every test
in every category below against the conformance suite at
`specs/conformance/`, as tagged by the DS release it
claims ([LCON.5.1]). A runtime that fails any required test is
non-conforming, even if all other tests pass. There
is no partial conformance.

*see also:* [LCON.5.1](#LCON-5-1), [LTES.8.1](#LTES-8-1)

(LCON-1-2)=
[LCON.1.2] A runtime claims conformance for one or more
platform signatures (per [LDET.2.3]).

*see also:* [LDET.2.3](#LDET-2-3)

(LCON-1-3)=
[LCON.1.3] Test categories are split into **within-platform**
and **cross-platform**. Both require bit-for-bit identity;
the split records where the reference output was captured,
not how strictly it is compared. The category a runtime is
tested against depends on whether the test harness is
running on the claimed platform or across platforms.

---

(LCON-2)=
## Within-platform categories [LCON.2]

(LCON-2-1)=
[LCON.2.1] Required: bit-for-bit identity. Runtime runs on its
claimed platform signature; test outputs are compared
byte-for-byte against the catalogue's recorded
reference outputs.

(LCON-2-2)=
### Byte-for-byte replay [LCON.2.2]

(LCON-2-2-1)=
[LCON.2.2.1] For every recorded session in the catalogue, replaying
on the claimed platform produces output bit-identical
to the original recording. Zero bytes differ in the
captured output streams.

*ratified*

(LCON-2-2-2)=
[LCON.2.2.2] Pass criterion: `diff recorded.stream replayed.stream`
produces zero differences across every catalogue
scenario.

(LCON-2-3)=
### Rule-firing order [LCON.2.3]

(LCON-2-3-1)=
[LCON.2.3.1] For scenarios with multiple activations at the same
clock instant, the firing order matches the
spec-defined total order (the terminal ordinal, which is
source order, then activation-creation order within one
rule, per [LDET.5.1]).

*ratified*  —  *see also:* [LDET.5.1](#LDET-5-1)

(LCON-2-3-2)=
[LCON.2.3.2] Pass criterion: firing order in output matches the
catalogue's expected sequence exactly.

(LCON-2-4)=
### Hash-order independence [LCON.2.4]

(LCON-2-4-1)=
[LCON.2.4.1] Runtimes may use hash tables, heaps, or other
unordered data structures internally. When run with
the engine configured to reverse hash iteration order
(if the implementation exposes that configuration),
outputs must still match bit-for-bit.

*ratified*  —  *checks:* `idris`

(LCON-2-4-2)=
[LCON.2.4.2] Pass criterion: same test scenarios produce identical
output under reversed-hash-order configuration.
Runtimes that cannot reverse hash order (because their
internals are already hash-order-independent)
auto-pass.

(LCON-2-5)=
### Parallelism regression [LCON.2.5]

(LCON-2-5-1)=
[LCON.2.5.1] Runtimes may execute activations in parallel as an
optimisation. Running each scenario with parallelism
disabled and with parallelism enabled must produce
identical outputs.

(LCON-2-5-2)=
[LCON.2.5.2] Pass criterion: per-scenario outputs match
bit-for-bit between parallelism-off and parallelism-on
runs.

(LCON-2-6)=
### Integer arithmetic stability [LCON.2.6]

(LCON-2-6-1)=
[LCON.2.6.1] Edge-case integer scenarios (near-overflow, division,
modulo, bitwise operations, shift edge cases)
produce identical results every run.

*ratified*

(LCON-2-6-2)=
[LCON.2.6.2] Pass criterion: all integer edge-case scenarios
produce the catalogue's expected values.

*ratified*

(LCON-2-7)=
### Basic-float stability [LCON.2.7]

(LCON-2-7-1)=
[LCON.2.7.1] Scenarios exercising IEEE 754 basic operations
(+, −, ×, ÷, √) produce bit-identical output.

*ratified*

(LCON-2-7-2)=
[LCON.2.7.2] Pass criterion: float-result outputs match bit-for-bit
for basic-op scenarios.

---

*ratified*

(LCON-3)=
## Cross-platform categories [LCON.3]

(LCON-3-1)=
[LCON.3.1] When the test harness runs on a platform signature
different from the one that recorded the reference
outputs, these categories apply. Every one of them —
basic float operations, integer, string and ordering
scenarios alike — must be bit-identical: v1 admits only
correctly-rounded IEEE operations, so there is no
scenario a platform change can move ([LDET.3.4.1]).

*see also:* [LDET.3.4.1](#LDET-3-4-1)

(LCON-3-2)=
### Rule-order identity (cross-platform) [LCON.3.2]

(LCON-3-2-1)=
[LCON.3.2.1] Same scenario, different platforms — firing order is
bit-identical. Rule ordering does not depend on
floating-point or libm behaviour, so this is a hard
requirement even across platforms.

(LCON-3-2-2)=
[LCON.3.2.2] Pass criterion: firing-order sequence identical on
every claimed-conforming platform.

(LCON-3-3)=
### Integer identity (cross-platform) [LCON.3.3]

(LCON-3-3-1)=
[LCON.3.3.1] Integer arithmetic produces identical results on
every conforming platform. Two's-complement 64-bit
signed, deterministic division and modulo on
well-defined inputs.

(LCON-3-3-2)=
[LCON.3.3.2] Pass criterion: integer scenarios match bit-for-bit
across platforms.

(LCON-3-6)=
[LCON.3.6] **The two categories differ in provenance, not in
pass criterion.** A cross-platform run compares against a
reference captured under a different platform signature; it
compares it the same way, byte for byte. No scenario may be
excluded from strict conformance on the grounds that its
result is platform-dependent — under [LDET.3.4.1] no v1
result is.

*see also:* [LDET.3.4.1](#LDET-3-4-1)

(LCON-4)=
## Extended-capability categories [LCON.4]

(LCON-4-1)=
[LCON.4.1] These test language features beyond core determinism.
Required for full conformance.

(LCON-4-2)=
### Deterministic-clock contract [LCON.4.2]

(LCON-4-2-1)=
[LCON.4.2.1] The runtime's test harness provides a clock-source
the catalogue can drive explicitly
([RTIM]
covers the harness interface). Scenarios that set the
clock to specific instants observe the clock values
they set.

(LCON-4-2-2)=
[LCON.4.2.2] Pass criterion: `now()` reads in test scenarios
return exactly the harness-set value.

(LCON-4-3)=
### Adapter-mock contract [LCON.4.3]

(LCON-4-3-1)=
[LCON.4.3.1] The runtime's test harness accepts adapter-mock
responses for any `(service, args)` tuple. Scenarios
that declare mock responses see the mocked values on
`call` completion.

*ratified*

(LCON-4-3-2)=
[LCON.4.3.2] Pass criterion: adapter calls return the mocked
response the test declared; no real-adapter traffic
on mocked services.

*ratified*

(LCON-4-4)=
### Event-trace primitive [LCON.4.4]

(LCON-4-4-1)=
[LCON.4.4.1] The runtime records and replays the event trace per
[LFST]. Scenarios that record-then-replay
produce the byte-for-byte replay property above.

*ratified*

(LCON-4-4-2)=
[LCON.4.4.2] Pass criterion: records losslessly, replays
bit-identically.

(LCON-4-4-3)=
[LCON.4.4.3] Call provenance ([RFCS.15]): when provenance
recording is enabled, outbound calls persist as `CallIssued` atoms
that are compared, never injected. Pass criteria: stripping
every `CallIssued` atom leaves replay bit-identical; corrupting a
`CallIssued` field is flagged as the effect Divergence at that `seq`
([LFST.9.3.6]).

*see also:* [LFST.9.3.6](#LFST-9-3-6), [RFCS.15](#RFCS-15)

(LCON-4-5)=
### Introspection surface [LCON.4.5]

(LCON-4-5-1)=
[LCON.4.5.1] The runtime exposes the TESTING-spec'd introspection
surface (working-memory contents, activation agenda,
fired-rule list, justifier chains, metric values) to
the test harness.

*ratified*

(LCON-4-5-2)=
[LCON.4.5.2] Pass criterion: introspection queries return the
values the catalogue's assertion step expects.

---

*ratified*

(LCON-5)=
## Versioning [LCON.5]

(LCON-5-1)=
[LCON.5.1] The language spec commits to the **categories** here;
the suite at `specs/conformance/` carries the
**individual tests**. The suite has no version of its own: the suite
a DS release tags is that release's catalogue ([RCTS.5.1.1]), and
conformance is passing the catalogue of the release a runtime claims
([LCON.1.1]). A change to the suite is reviewed like any other change,
and lands in the next release's catalogue.

*see also:* [LCON.1.1](#LCON-1-1), [RCTS.5.1.1](#RCTS-5-1-1)

(LCON-5-2)=
[LCON.5.2] A runtime claims conformance against a specific DS
release's catalogue, and the claim names that release
([RCTS.5.2.1]). Adding tests does not affect a prior claim, and
neither does removing them: a claim against `v1.2.0` is a
statement about `v1.2.0`, and stays true however the catalogue
moves afterwards. What a later version does is make the older
claim narrower, not false.

---

*see also:* [RCTS.5.2.1](#RCTS-5-2-1)

(LCON-6)=
## Performance [LCON.6]

(LCON-6-5)=
- [LCON.6.5] **Conformance is correctness only.** Runtime A at 10 ms and runtime B
  at 100 ms can both conform.

