Skip to content

Refactor-Sensitive Function

This example marks a polling function as RefactorSensitive. That trait requires a matching RefactorConstraint memory for the same function target.

module bridge
resource Attestation
component BridgePoller {
owns Attestation
grants Read<Attestation>
fn pollAttestation : RefactorSensitive
effects complete {
Read<Attestation>
}
}
memory BridgePollingDelayConstraint : RefactorConstraint<fn BridgePoller.pollAttestation> {
applies_to fn BridgePoller.pollAttestation
status Unexplained
confidence High
summary "Previous attempts to lower this delay caused intermittent settlement failures."
who { owner BridgeTeam }
}

Run the checker against the fixture:

Terminal window
shp check fixtures/pass/memory_guard_refactor_constraint_unknown/audit.shape

The model passes because the function has the required design memory. status Unexplained keeps uncertainty explicit: the team knows this shape is refactor-sensitive, even if the full explanation still lives in issue history or incident notes.

Use shp memory to list recorded rationale and memory entries:

Terminal window
shp memory fixtures/pass/memory_guard_refactor_constraint_unknown/audit.shape

Example output:

Memory Guards
fn BridgePoller.pollAttestation
memory BridgePollingDelayConstraint
type: RefactorConstraint
status: Unexplained
confidence: High
owner: BridgeTeam