# LS5007: Marked Act Raises an Undeclared Event

## Intent

LS5007 is a compiler check that reports an aggregate method marked with a use case raising an event the use case does not list in `raises`, because an unlisted event starts a consequence nobody reviewed. This page states what the rule reports, where the error sits, and how to declare or drop the event.

## Reference

### What the Rule Enforces

LS5007 enforces [Raise the Declared Events from the Marked Act](https://litespec.dev/4.0.0/backend/domain.md#raise-the-declared-events-from-the-marked-act) (`litespec/backend/domain#raise-the-declared-events-from-the-marked-act`). It runs in Domain only. Its category is `LiteSpec.Traceability`.

### What the Rule Reports

The rule reports a root method marked with a use case that raises an event the use case does not list in `raises`. `use-case/spending.approve-expense` lists `event/expense.approved` in `raises` and nothing else. The diagnostic sits on the method name.

### Failing Example

```csharp
/// <implements>use-case/spending.approve-expense</implements>
public void Approve(ApproverId approver, DateTimeOffset decidedAt)
{
    State = new ExpenseApprovedState(approver, decidedAt);
    RaiseDomainEvent(new ExpenseApprovedEvent(Id));
    RaiseDomainEvent(new ExpenseReimbursedEvent(Id));
}
```

### Passing Example

```csharp
/// <implements>use-case/spending.approve-expense</implements>
public void Approve(ApproverId approver, DateTimeOffset decidedAt)
{
    State = new ExpenseApprovedState(approver, decidedAt);
    RaiseDomainEvent(new ExpenseApprovedEvent(Id));
}
```

### How to Fix

List the event in the use case `raises`, or stop raising it from the marked method.

## Notes

### What the Rule Ignores

The rule does not report a method with no use-case mark. It does not report an event the use case lists in `raises`. The rule stays silent when no `.litespec/project.json` is in reach, or when the docs root it names cannot be resolved; the CLI owns that configuration error. It does not run outside Domain.

### Severity

The rule reports an error. A finding that a live exception covers stays silent. An `.editorconfig` entry for the rule id overrides the computed severity.
