Examples
One minimal hub per supported language. Each shows an at: anchor and the rule that always
holds: quiet on cosmetics (formatting, comments, consistent renames), loud on logic. Run
surf verify once to seal the hash, then surf check gates it.
The anchor grammar and the verify loop are covered in Authoring hubs.
TypeScript
Section titled “TypeScript”anchors: - claim: rotation is single-use; a reused token triggers global logout at: src/auth/refresh.ts > TokenService > rotate- Rename a local, reformat, add a comment → no fire.
- Change
if (token.used)toif (token.used || token.expired)→ fires.
JavaScript / JSX
Section titled “JavaScript / JSX”anchors: - claim: cart total applies the member discount before tax at: src/cart.js > computeTotalJS/JSX is parsed by the TS-family grammar, so const computeTotal = (...) => { ... } resolves
the same as a function declaration.
- Drop an
await, flip*to+→ fires.
anchors: - claim: combining site hashes is order-sensitive at: surf-core/src/hash.rs > combine_site_hashesType > method walks into an impl: at: surf-cli/src/workspace.rs > Workspace > discover.
- Change
<to<=, alter a literal value → fires.
Python
Section titled “Python”anchors: - claim: retries use exponential backoff capped at 30s at: api/client.py > Client > _requestDecorators are transparent for resolution — @retry above def _request doesn’t change which
symbol the anchor finds — but they are part of the hashed span, so a decorator swap
(@retry → @retry_with_jitter) fires.
- Change the backoff base or the cap → fires.
Non-callables anchor too — module constants, type aliases, and class attributes:
anchors: - claim: retries fire on exactly these status codes at: api/client.py > RETRYABLE_STATUS_CODES - claim: the SDK supports these chains at: api/types.py > Chain- Add or remove a status code, or change a
Chainmember → fires.
anchors: - claim: the receiver validates the signature before decoding at: internal/webhook.go > Handler > VerifyGo methods attach by receiver, so the anchor is Type > Method even though the method isn’t
nested in the type. Top-level funcs/types use a single segment: cmd/main.go > Run.
- Reorder unrelated declarations → no fire. Change the comparison in
Verify→ fires.