Skip to content

errors.rs is ~2x the 500-line cap, so the C5 ratchet blocks every new error variant #43

Description

@EnRaiha

src/errors.rs is 990 lines with no #[cfg(test)] block, so every line counts
under the C5 rule and the file is already around twice the 500-line cap on
main (981 at d1e22fc). The ratchet in nodedb-preflight.sh fires on any
growth of an over-cap file, which makes a typed error variant — the normal way
this crate reports a new refusal — impossible to add without a waiver.

This is the waiver record for the wasm clock work: the review asked for a typed
refusal naming the policy and the missing clock, so
PagedbError::RetainPolicyNeedsClock { policy } adds 9 lines and trips C5. No
existing variant names both facts.

Proposal: split the file along the seams it already has —
CorruptionDetail, QuotaKind, Evictable and the impl PagedbError
constructors — into submodules of an errors/ directory, which brings the top
file under the cap and lets the ratchet do its job again. Alternative, if the
split is not wanted: teach the C5 check to accept a file that is over the cap at
base when the growth is only in the variant set, and say so in the message.

Found while fixing the wasm clock panic (#40). Not urgent, but it blocks every
future error variant.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions