# field-recomposition-range-review

> Enforced Field recomposition retains quotient/remainder envelopes beyond the modulus.

Canonical: https://nightshade.dicksonwu.xyz/rules/field-recomposition-range-review.html
Release: Nightshade 0.1.1 (v0.1.1)

| Field | Value |
| --- | --- |
| Rule ID | `field-recomposition-range-review` |
| Severity | info |
| Confidence | high |
| Maturity | experimental |
| Selection | Audit default |
| Policy intent | not required |
| Default enabled | yes |
| Category | Audit-default ordinary rules |
| Engine facts used | owned-numeric-expressions, successful-predicates, resolved-types |
| Release | v0.1.1 |

## Selection and scope

Selected by the default audit profile, so an ordinary scan runs it.

```sh
./.nightshade/node_modules/.bin/nightshade ./contracts --detectors field-recomposition-range-review
./.nightshade/node_modules/.bin/nightshade detector show field-recomposition-range-review
```

The first command runs only this rule; `--detectors` takes a comma-separated list. The second prints the rule's metadata from your installed version.

Severity is review priority. It does not express exploitability or impact. Confidence is detector metadata, not a probability. All built-in rules are experimental.

Compiler scope: the engine supports the pinned profiles 0.28.0, 0.29.0, 0.30.0, 0.31.1, 0.33.0-rc.2, 0.34.0, 0.35.0-rc.1 and 0.35.0, with ZKIR2 by default. Support for this rule can be narrower; the rule documentation below states any narrower scope.

## Corpus checks

Synthetic corpus checks for this rule in the 0.1.1 proof run. A check counts only with compiler acceptance and complete analysis.

| Positive detected | Corrected quiet | Lookalike quiet | Other negative quiet | Incomplete |
| ---: | ---: | ---: | ---: | ---: |
| 5/5 | 4/5 | 4/5 | 0/0 | 0 |

Deviations recorded for this rule:

| Case | Kind | Expected to observed lines | Issue |
| --- | --- | --- | --- |
| synthetic-regressions.json / field-recomposition-range-review-86 | corrected | [7] to [7] | control hit |
| synthetic-regressions.json / field-recomposition-range-review-86 | lookalike | [7] to [7] | control hit |

These are behavior checks on synthetic fixtures, not a precision or recall estimate. See [evaluation](https://nightshade.dicksonwu.xyz/evaluation.md#synthetic-corpus).

## Rule documentation

From https://github.com/DicksonWu654/nightshade/blob/v0.1.1/docs/detectors/field-recomposition-range-review.md at v0.1.1.

Availability: default. Severity: info. Confidence: high.

`field-recomposition-range-review` reports an informational source observation. It reviews an enforced Field equality
(including negated comparisons) whose owned numeric expression is a shallow
`quotient * constant + remainder`, allowing commuted operands. The constant must
be a power of two greater than one. Both scalar operands must preserve an exact
raw entry-parameter or witness source identity, have no ledger dependencies, and
be distinct after successful scalar equality normalization. Names do not establish
quotient/remainder intent. Native results, ledger reads and derived operands are
outside this first shape.

The rule uses existing numeric observation machinery and reconstructs integer
constraints separately for each completed successful history. Equality aliases,
checked numeric casts, retained integer domains, orderings and exclusions can
constrain the exact operand envelopes. It reports when their mathematical
multiply-plus-add upper endpoint reaches the Field modulus. Histories at the same
entry, equality site and matched side share a stable finding with separate retained
envelopes; bounds from sibling histories are never combined.

The report establishes only a retained envelope fact. It does not establish joint
operand feasibility, integer decomposition intent, ambiguity, an invalid execution,
proof failure or deployed impact. Relation matching is shallow: expanded Boolean
formulas, recursive algebra and alternate decompositions
are outside scope. Successful equality against the modular result is not an integer
range certificate. Missing exact evidence, unfinished requested entries,
contradictory constraint reconstruction and allowance exhaustion produce rule-scoped
incomplete diagnostics and no partial finding set.

The rule distinguishes a bounded quotient from a wider value that can wrap during
recomposition. Compiler acceptance is checked separately; no proof or runtime
execution is used. Intentional modular arithmetic can satisfy the same source
shape. Review whether integer reconstruction is intended before changing a bound;
the envelope is not proof the operands jointly reach it or a concrete execution
wraps.

## Suppress a match

If a match is intentional, suppress it on the line before with the exact rule ID and a reason of at least eight characters:

```compact
// nightshade-disable-next-line field-recomposition-range-review -- Reason this match is intentional
```

Diagnostics cannot be suppressed, and an unmatched directive for a selected rule makes analysis incomplete. See [configuration](https://nightshade.dicksonwu.xyz/configuration.md#suppress-an-intentional-match) for fingerprint suppressions and baselines.

## References

- [Rule source document at v0.1.1](https://github.com/DicksonWu654/nightshade/blob/v0.1.1/docs/detectors/field-recomposition-range-review.md)
- [Catalog entry in rules.json](https://nightshade.dicksonwu.xyz/rules.json)
- [All rules](https://nightshade.dicksonwu.xyz/rules.md#audit-default-ordinary-rules)
- [Limitations](https://nightshade.dicksonwu.xyz/limitations.md)
