Skip to content

chore(rules): add Rule 12 — locked accessors must not leak internal pointers#4

Merged
arcaven merged 1 commit intodevelopfrom
chore/go-rule-locked-accessor
Apr 19, 2026
Merged

chore(rules): add Rule 12 — locked accessors must not leak internal pointers#4
arcaven merged 1 commit intodevelopfrom
chore/go-rule-locked-accessor

Conversation

@arcaven
Copy link
Copy Markdown
Collaborator

@arcaven arcaven commented Apr 19, 2026

Summary

Mirrors the rule added to marvel after orc finding-032-store-sync-contract-leak. The rule:

Never return internal pointers from a locked accessor. If a type owns state behind a mutex, its Get/List methods return value copies. Mutations go through Update methods that take the lock.

Switchboard doesn't currently have a Store-shaped type, but the rule belongs in the shared Go ruleset so any future state-owning type follows it from day one.

Refs: orc finding-032

Test plan

  • Doc-only change, no code affected

…d accessors

Mirrors the rule added to marvel (orc finding-032). Store.Get/List
return value copies; mutations go through Update* methods that take
the lock. Rule applies to any Go type that owns mutable state behind
a mutex.

Refs: orc finding-032
@github-actions
Copy link
Copy Markdown

Coverage Report

Total coverage: 81.8%

Package breakdown
github.com/arcavenae/switchboard/cmd/switchboard/main.go:12:	run		100.0%
github.com/arcavenae/switchboard/cmd/switchboard/main.go:30:	main		0.0%
total:								(statements)	81.8%

@arcaven arcaven merged commit 94b7c59 into develop Apr 19, 2026
8 of 9 checks passed
@arcaven arcaven deleted the chore/go-rule-locked-accessor branch April 19, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant