The gap
src/parse.js matches the literal string #[contracterror]. A contract that writes the attribute in fully qualified form is silently skipped, so its codes never enter the registry and a collision with it is never reported.
#[soroban_sdk::contracterror]
#[repr(u32)]
pub enum RouterError {
PairNotFound = 300,
}
This is the worst class of bug for this tool: a false negative in a check people gate merges on.
Where
const ATTRIBUTE = "#[contracterror]" in src/parse.js
- the fast path
if (!source.includes("#[contracterror]")) continue in bin/codepact.js must be relaxed at the same time, or the file is dropped before the parser ever sees it
Expected behaviour
Recognise #[contracterror] and any path-qualified form ending in contracterror, with arbitrary whitespace inside the brackets.
Definition of done
- a parser test covering the qualified form and one covering
#[ contracterror ]
- the CLI fast path updated in the same PR
- no change to the reported line numbers for the unqualified form
The gap
src/parse.jsmatches the literal string#[contracterror]. A contract that writes the attribute in fully qualified form is silently skipped, so its codes never enter the registry and a collision with it is never reported.This is the worst class of bug for this tool: a false negative in a check people gate merges on.
Where
const ATTRIBUTE = "#[contracterror]"insrc/parse.jsif (!source.includes("#[contracterror]")) continueinbin/codepact.jsmust be relaxed at the same time, or the file is dropped before the parser ever sees itExpected behaviour
Recognise
#[contracterror]and any path-qualified form ending incontracterror, with arbitrary whitespace inside the brackets.Definition of done
#[ contracterror ]