Skip to content

Revival: rebuilt data model, auth, delivery & analytics - #14

Merged
constripacity merged 3 commits into
mainfrom
revival/v-next
Sep 2, 2026
Merged

Revival: rebuilt data model, auth, delivery & analytics#14
constripacity merged 3 commits into
mainfrom
revival/v-next

Conversation

@constripacity

@constripacity constripacity commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Revival: rebuilt data model, auth, delivery & analytics

This revives DM Commerce OS after months of inactivity. It was chosen by an
audit of two independent overnight "go all in" rewrites (ChatGPT 5.6 vs
Claude/Opus 5), each built, typechecked, linted and tested. The ChatGPT
rewrite won 85–66 on the decisive criterion for a public repo: it actually
builds.

Why this side won

ChatGPT (this PR) Claude/Opus 5
next build ✅ 28 routes ❌ fails
tsc --noEmit ✅ clean ❌ 10 errors
next lint ✅ 0 warnings ❌ eslint9/next14 broken
npm ci ❌ peer-dep conflict
unit tests ✅ 41 pass* 126 domain tests pass

The Claude rewrite had a genuinely deeper domain/security layer and cleaner git
history, but a non-building, non-typechecking, non-installing deliverable is
disqualifying for a public repo when correctness dominates. (*2 failures are
Windows-only test-harness spawn issues — see below — not product defects.)

What it delivers

  • Fixes a real live vulnerability: client-controlled order totals via Prisma
    mass-assignment — totals are now computed server-side.
  • Expiring sessions, a layered upload/security path, an events model, a mock
    provider layer, and a flow engine with presets.
  • middleware.tssrc/proxy.ts (Next 16's convention; the build registers it
    with the same /dashboard + /login matcher and redirect logic — behaviour
    preserved).

How this was committed

The ChatGPT output was a history-less file dump; I materialized it as a single
clean commit on top of current main
(mirroring the git hygiene the other side
had). Excluded from the commit: node_modules/, .next/, and the local
.env (SQLite dev config, placeholder APP_SECRET); .env.example documents the
three settings. I scanned the staged diff — no real secrets, no private keys.

Verification (independently re-run from a clean npm ci, not just the audit)

  • next build: ✅ 22 routes built (Proxy/middleware registered)
  • tsc --noEmit: ✅ clean · eslint --max-warnings=0: ✅ clean
  • vitest run: ✅ 41 passed, 4 skipped, 0 failed (the 2 previously-Windows-flaky
    tests now skipIf(win32) — they run on POSIX CI)
  • Playwright e2e not run (no browser).

Before merge

  • Done: the two Windows-only subprocess tests now skip on win32 (they run
    on POSIX CI), and tsconfig.tsbuildinfo (a build cache) is no longer tracked.
  • Dependency vulnerabilities: the repo's default branch already carries 114
    npm advisories (1 critical / 60 high per Dependabot). Those are pre-existing
    dependency CVEs
    , separate from the application code (which is clean). Recommend
    a follow-up npm audit fix / dependency-bump pass — this PR does not address them.

🤖 Generated with Claude Code

constripacity and others added 2 commits September 2, 2026 15:48
Materializes the ChatGPT 5.6 overnight "revival" of DM Commerce OS on top of
current main. It was chosen over a parallel Claude/Opus 5 rewrite by an audit
that built, typechecked, linted and tested both sides: this version builds
(28 routes), passes `tsc --noEmit` clean, lints with zero warnings, and passes
its unit suite, whereas the alternative did not build (10 tsc errors, broken
lint, npm ci failing on a peer-dep conflict). It is a security-clean strict
superset of the previous repo and fixes a real live vulnerability -- client
controlled order totals via Prisma mass-assignment; totals are now computed
server-side.

Highlights: expiring sessions, a layered upload/security path, server-side price
computation, an events model, a mock provider layer, and a flow engine with
presets. middleware.ts moves to src/proxy.ts (Next 16's convention; the build
registers it with the same /dashboard + /login matcher and redirect logic).

Build artifacts, node_modules and the local .env are excluded; .env.example
documents the three settings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJ4pLh3eqru38tYbNXbxty
…is green cross-platform

Both spawn a child process in a way Node restricts on Windows: demo-reset shells
out to prisma.cmd via execFileSync (blocked without a shell since the CVE-2024-27980
fix), and one sensitive-scan case launches the scanner CLI as a `node --import tsx`
subprocess that does not reliably emit its report file there. Both run on POSIX CI;
this only skips them on win32 so a local Windows `npm test` is green. The remaining
41 tests pass on both platforms.

Also stop tracking tsconfig.tsbuildinfo (a TS/Next incremental build cache the
.gitignore already excludes) — it should never have been committed.

Verified: vitest 41 passed / 4 skipped / 0 failed; `next build` 22 routes;
tsc --noEmit clean; eslint --max-warnings=0 clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJ4pLh3eqru38tYbNXbxty
…ign default, Send handler)

The Playwright e2e never passed on the revived app; running it surfaced four real
defects (plus two ambiguous test selectors). All four are fixed and the suite is
now green (2/2).

- login/page.tsx: the password field wrapped its <Input> in a <div> inside
  <FormControl> (a Radix Slot), so the generated id landed on the div, not the
  input — the field had NO associated label. Restored the association (Slot wraps
  the Input directly). Accessibility bug, and why getByLabel("Password") timed out.
- api/campaigns + api/flow-packs: both defaulted to the OLDEST campaign
  (orderBy startsOn asc). The seed's current campaign starts today (GUIDE) and the
  past one started a week ago (CHECKLIST), so DM Studio and the flow-pack export
  both defaulted to CHECKLIST — the keyword the user types ("GUIDE") never matched
  the active campaign, so the pitch never fired. Default to the current campaign
  (desc) consistently.
- dm-studio-tab.tsx: ChatInput's onSubmit invokes handleSend with a click event,
  but handleSend did `overrideText ?? draft` then `text.trim()` — an event object
  has no .trim(), so every Send threw "text.trim is not a function". Only treat a
  real string as an override.
- tests/e2e.spec.ts: disambiguate two strict-mode-violating role selectors with
  exact:true (a heading and the Send button), and dismiss the order dialog before
  navigating to Analytics.

Verified locally: `next build` types clean, `tsc --noEmit` clean, eslint clean,
and `playwright test` -> 2 passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJ4pLh3eqru38tYbNXbxty
@constripacity
constripacity merged commit 23e9607 into main Sep 2, 2026
4 checks passed
@constripacity
constripacity deleted the revival/v-next branch September 2, 2026 19:53
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