droboticflow/docs/CODING_STANDARDS.md
d-robotics 58e0e50570
Some checks failed
web-ci / checks (push) Has been cancelled
web-ci / checks (pull_request) Has been cancelled
🧪 Retro 2026-10-12: CI gate, known-failure baselines, devboot regression test, workbench smoke, review standards
Six follow-ups from the round8-12 hotfix retrospective:

- web-ci.yml: lint + Go/frontend tests on every push and PR (nothing ran
  app checks before; the round10 dev-mode regression shipped green)
- tests/known-failures.json + check-test-baseline.mjs: gate by exact
  failing-test id instead of hand-counted failure totals (14 frontend,
  70 Go upstream debts recorded from the dev tip)
- devboot.test.mjs: boots the real Vite dev server and pins the movi
  loader contract that broke round10 (query-less DEV url, /vendor stays
  off the module pipeline)
- scripts/local/smoke-workbench.mjs: pre-release smoke covering the
  seven recurring acceptance points (login/pool/claim/play-while-loading/
  captions/4x/playhead), 3x green against the local replica
- docs/CODING_STANDARDS.md + AGENTS pointer: eligibility flags are
  server-shipped, the UI renders them (rounds 9+12 lesson)
- vendor README host-element quirks section, HANDOFF gate pointers and
  movi-path verification rule, perf-audit report pinned with the
  post-round12 production 500 observation
- husky pre-commit: lint-staged (repo prettier scope) + tsc + gofmt
- gofmt: restore lint:go green on the dev tip (drift shipped silently
  in the perf merge and round12 because nothing gated it)
2026-10-12 18:07:02 +05:30

1.5 KiB

Coding standards (review-time rules)

Rules that cannot be enforced by a linter because they are cross-file consistency contracts between the server and the UI. Apply them while writing or reviewing the matching code; both exist because their violation shipped to production twice in one day (2026-10-12, rounds 9 and 12).

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.