gstack/test/helpers
David Grant abafb38137 fix: counter model-design bias toward fewer tables and JSONField shortcuts
The "minimal diff" engineering preference in plan-eng-review and plan-ceo-review
is correct for bug fixes but systematically biased AI reviewers against schema
normalization: creating a new model touches more files than adding columns, so
the preference pushed recommendations toward merging concerns into existing
tables and using JSONField as a polymorphism escape hatch. Both failures share
one root — "fewer parts feels simpler" at the cost of FK integrity, DB-level
constraints, queryability, and type safety.

Template changes (both skills' preferences lists):
* Data model exception to minimal-diff — schema design normalizes first,
  denormalizes for measured reasons, counts concepts not tables.
* JSONField is not an escape hatch for polymorphism — promote to explicit
  columns + CheckConstraints when variants are knowable at design time.

plan-eng-review cognitive patterns (renumbered 1–18):
* Normalize first, denormalize for measured reasons (Codd/Knuth/Beck).
* Single Responsibility Principle applies to data models (Martin/Codd).
* Structure beats blobs for known polymorphism.

plan-eng-review Architecture section:
* Data model honesty check covering nullable-semantic, column clusters,
  parent-field-shadowed-by-child, JSONField-hiding-schema smells.
* Full Data model review checklist subsection — 11 proactive checks
  (SRP, nullable-semantic, hidden-models, parent-shadowed, JSONField,
  FK deletion, snapshot-vs-live, cross-scope, derived state, field naming,
  DB constraints).

Regression tests:
* 10 static grep guardrails in test/skill-validation.test.ts verify every
  load-bearing bullet survives future refactors (free, <5ms, catches silent
  deletion). Cognitive-patterns list contiguity (1–18) is asserted.
* New E2E case in test/skill-e2e-plan.test.ts (periodic tier) uses a
  synthetic SubscriptionTier plan to verify the skill recommends a
  separate model, pushes back on JSONField, and cites normalization/SRP.

Unchanged on purpose: investigate/, openclaw-investigate/ (minimal-diff
correct in bug-fix context), office-hours/ (minimal-viable as one of three
alternatives is fine), openclaw-ceo-review/ (doesn't contain the bullet).

Refs: Codd 1970 (normal forms), Knuth 1974 ("premature optimization"),
Beck ("make it work, make it right, make it fast"), Martin (SOLID/SRP).

Closes garrytan/gstack#1048

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 15:54:11 -07:00
..
codex-session-runner.ts fix: enforce Codex 1024-char description limit + auto-heal stale installs (v0.11.9.0) (#391) 2026-03-23 08:44:08 -07:00
e2e-helpers.ts feat: remove trigger guard + proactive opt-out prompt (#457) 2026-03-24 18:07:36 -07:00
eval-store.test.ts feat: QA restructure, browser ref staleness, eval efficiency metrics (v0.4.0) (#83) 2026-03-15 23:55:39 -05:00
eval-store.ts feat: worktree isolation for E2E tests + infrastructure elegance (v0.11.12.0) (#425) 2026-03-23 23:05:22 -07:00
gemini-session-runner.test.ts feat: Gemini CLI E2E tests (v0.9.2.0) (#252) 2026-03-20 08:30:09 -07:00
gemini-session-runner.ts feat: Gemini CLI E2E tests (v0.9.2.0) (#252) 2026-03-20 08:30:09 -07:00
llm-judge.ts feat: 3-tier eval suite with planted-bug outcome testing (EVALS=1) 2026-03-14 01:17:36 -05:00
observability.test.ts fix: never clean up observability artifacts — partial file persists after finalize 2026-03-14 12:37:38 -05:00
session-runner.test.ts feat: stream-json NDJSON parser for real-time E2E progress 2026-03-14 03:49:36 -05:00
session-runner.ts feat: content security — 4-layer prompt injection defense for pair-agent (#815) 2026-04-06 14:41:06 -07:00
skill-parser.ts feat: content security — 4-layer prompt injection defense for pair-agent (#815) 2026-04-06 14:41:06 -07:00
touchfiles.ts fix: counter model-design bias toward fewer tables and JSONField shortcuts 2026-04-17 15:54:11 -07:00