mateclaw/mateclaw-server/src/main/java/vip/mate/wiki/controller
倪程伟 b23cc32f33
fix(wiki): make global starter-pack templates read-only
Global transformation templates (workspace_id IS NULL, e.g. the 7 built-in
starter packs made global by V165) were shared across every workspace but
not actually read-only: any workspace member could edit or delete them,
mutating/affecting all workspaces, with deletes unrecoverable (Flyway
seed runs once).

- Controller: reject update/delete of null-workspace templates with 403
  (err.wiki.global_template_readonly); read/apply paths unchanged.
- Service: defense-in-depth — update/delete also reject global templates,
  guarding non-HTTP callers (WikiTool LLM entry points). delete() now
  checks the entity before deleting instead of deleting blindly.
- findByName: add deterministic ORDER BY (workspace_id IS NULL) ASC so a
  workspace-local template wins over a same-named global one (was LIMIT 1
  with no ordering). Consistent across H2/MySQL/Kingbase.
- i18n: new err.wiki.global_template_readonly (zh + en).
- Tests: +2 controller mock tests (403 on update/delete, no service write),
  +2 E2E tests (global template stays intact; findByName prefers local).

Tests: 10/10 green (4 controller + 6 E2E).
2026-07-15 14:57:18 +08:00
..
WikiAdminController.java feat(wiki): KB processing-failure visibility (error-code chain + silent sub-step alerts + cross-KB failure center) 2026-06-28 13:07:34 +08:00
WikiController.java feat(wiki): cross-KB wikilinks [[kbId/slug]] and raw-material batch filter/reprocess/delete (#506) 2026-07-10 12:01:48 +08:00
WikiEntityController.java fix(wiki): close IDOR in WikiRelationController & WikiEntityController (cross-KB id binding) 2026-06-28 14:41:19 +08:00
WikiHotCacheController.java feat(wiki): admin endpoints for hot cache — get / regenerate / reset 2026-05-02 21:46:02 +08:00
WikiRelationController.java fix(wiki): close IDOR in WikiRelationController & WikiEntityController (cross-KB id binding) 2026-06-28 14:41:19 +08:00
WikiResearchController.java feat(agent): Utf8SseEmitter + returnDirect end-to-end chain test 2026-04-26 08:32:44 +08:00
WikiTransformationController.java fix(wiki): make global starter-pack templates read-only 2026-07-15 14:57:18 +08:00