droboticflow/docs/CODING_STANDARDS.md

37 lines
1.7 KiB
Markdown

# Coding standards (review-time rules)
Apply the matching rules during implementation and review. They cover business
and presentation contracts that cannot be fully enforced by a linter.
## Customer-facing copy stays minimal
For any UI change, apply [UI copy guidelines](ui/copy-guidelines.md), including
the applicable visual acceptance checks. This is a project requirement, not an
optional styling preference. Necessary error feedback and customer-authored
business content must remain available.
## Eligibility flags are server-shipped
Pool and list endpoints ship server-computed eligibility flags (today:
`canClaim` on human-item pool entries). The UI renders those flags.
The UI must not:
- rebuild eligibility locally from membership or role data it fetched (or
failed to fetch) itself — a view that skips a members fan-out then "knows"
nobody can claim, and hides entries the server would happily let the user
take (round 12: 可领取 3 → "暂无可领取");
- add gating conditions the server does not have (round 9: a leftover
`!projectId` disable kept the claim button grey in the all-projects view
that is now the default).
Local derivation may at most produce a display hint; it may never hide an
entry, disable an action, or change the empty-state message. When a list view
needs a flag the payload does not carry, extend the server payload — do not
guess client-side.
Rationale: `AGENTS.md` principle 5 already requires permissions to be enforced
on the server; this rule is its list-contract corollary. The server is the
only component that sees roles, project scoping, and claim state together;
every client-side reconstruction is a second, divergent permission model.