Skip to content

desloppify: code-health pass (objective ~99 both; FE overall 89.6, BE 87.6) - #3

Open
croto-bot wants to merge 10 commits into
devfrom
code-health
Open

desloppify: code-health pass (objective ~99 both; FE overall 89.6, BE 87.6)#3
croto-bot wants to merge 10 commits into
devfrom
code-health

Conversation

@croto-bot

Copy link
Copy Markdown
Collaborator

Summary

Full desloppify code-health pass on both projects, driven by glm-5.2 subagent reviews + execution. Skill document updated to v7.

Scores (final)

Project Overall Objective Strict Verified
Backend 87.6 99.4 86.5 99.4
Frontend 89.6 98.9 84.2 98.9

Mechanical/objective health is essentially maxed (~99) on both. Subjective dimensions were scored via 4 rounds of 20-dimension holistic review (glm-5.2 subagents).

What changed

Backend (4388 insertions / 13970 deletions net — heavy dead-code removal):

  • Removed ~211-LOC unused recursive_partial_model + dead ORM mixin classes
  • Surfaced error_code in all HTTP error responses (was dead metadata) via ErrorResponse schema + handler
  • Items router: cast() fiction → ItemResponse.model_validate(); get_all_paginated typed Page[Item]
  • Auth: validate_session honest User return; OAuth provider allowlist centralized; get_auth_service moved into auth package
  • Error handling: check_password catches Argon2Error (not bare Exception); ExternalApiService handles httpx.RequestError
  • Removed stale config (AWS/Axiom/fastapi-limiter/JWT-secret); redundant docstrings; UserService.create policy bypass
  • Reworked tests to TestClient route-level + behavioral assertions (597 tests, was 569)
  • Renames for honesty: health_check, _get_postgres_insert, get_current_user

Frontend:

  • Fixed test_health 34.5% → ~92% (the big mechanical lever): deleted duplicate orphan test, rewrote false-confidence useItems test, added co-located tests for 21 modules (231 tests, was 115)
  • API client hardened: network failures wrapped to ApiError (no raw TypeError leak); invalid JSON error bodies surfaced
  • executeAuthSubmit now rethrows (callers observe failure); useAuthSubmit rewrapped in useMutation
  • Logout single-teardown; ErrorBoundary substrcrypto.randomUUID; button forwardRef→function declaration
  • Feature files moved lib/features/{auth,items}/; removed package-lock.json (bun-only)
  • Rewrote README/FRONTEND_ARCHITECTURE to match the real app; deleted orphan DEMO_PAGE.md

Remaining gap to 90 (overall)

  • Backend (+2.4): genuine structural debt — the query-optimizer subsystem is load-bearing on the auth guard but over-layered (QueryBuilder forwarder chain); residual user↔auth package coupling; module-level _ph/settings singletons. These need focused refactors.
  • Frontend (+0.4): within review variance (89.6); remaining items are the UI forwardRef/function split and a couple of auth-orchestration edges.

Both verified/objective scores are ~99. Subjective scores reflect honest holistic review and are bounded by ±5–10 reviewer variance per dimension.

Test plan

  • Backend: uv run pytest tests/ -q → 597 passed
  • Frontend: bun run test → 231 passed; bun run lint clean; tsc --noEmit clean (src)

Croto Bot added 10 commits August 5, 2026 21:51
v7 adds monorepo per-project scan guidance, Rovo Dev runner,
agent directives, and subagent parallelism limits. Installed
desloppify via uv tool install.
- register: explicit HTTP_201_CREATED (resource creation semantics)
- PATCH /me: HTTP_202_ACCEPTED -> 200 (synchronous update)
- check_password: bare except Exception -> except Argon2Error
- ExternalApiService: add httpx.RequestError handler (502)
- remove del-token hack + TODO/# Example: placeholder comments

569 tests pass; ruff clean on edited files.
…s cleanup

- Remove unused recursive_partial_model + 3 helpers (~211 LOC) and its tests
- Remove dead ORM base classes JSONUpdatesMixing/TimestampOrmBaseModel/JsonOrmBaseModel
- items router: replace cast() fiction with ItemResponse.model_validate()
- items service: simplify QueryOptions construction, hoist imports
- auth: remove cast in validate_session (honest User return type)
- centralize OAuth provider allowlist (OAUTH_PROVIDER_NAMES)
- update item router tests to new behavior

554 tests pass.
- Delete duplicate orphan src/lib/schemas.test.ts
- Rewrite false-confidence useItems.test.ts (now exercises real hooks,
  asserts cache invalidation + optimistic rollback)
- Strengthen useAuthSubmit.test.ts (URL/payload/toast/error assertions)
- Add co-located tests for 21 untested/transitive modules (routes, dialogs,
  shadcn/ui primitives, config, router)
- Exclude playwright.config.ts (test infra, not unit-testable)

192 tests pass (was 115); lint clean.
…ests

- Surface error_code in HTTP responses via custom exception handler
  + ErrorResponse schema (error_code previously dead metadata)
- Fix 4 ruff errors in app/database/db/ (TYPE_CHECKING); document optimizer
  entry points (it is load-bearing on the auth guard path, not dead)
- Tests: convert router tests to TestClient route-level, real-arg User fixture,
  domain-behavior assertions on repos, add base_repository/dependencies/logging
  coverage (+43 tests, 554->597)

597 tests pass.
…tests

- api-client: wrap network failures into ApiError (no raw TypeError leak);
  surface invalid JSON error bodies instead of silent swallow
- error-handler: shared getErrorMessage helper; items page uses it
- Relocate executeAuthSubmit out of hooks/ into lib/auth-actions
- sonner.tsx: align to function-declaration convention
- Add tests for auth-actions, useAuthSubmit hook, items route (+24 tests)

216 tests pass; lint clean.
- Rename sanity_check->health_check, _get_insert_dialect->_get_postgres_insert,
  load_user_context->get_current_user (honest names, all call sites)
- Relocate app/context.py -> app/core/context.py (no longer top-level orphan)
- Move get_auth_service into app/user/auth/dependencies.py (auth owns its DI)
- Document middleware placement rule (middlewares/ vs core/logging)
- Fix UserFilter stale first_name/last_name/full_name -> display_name
- Remove redundant exception docstrings + ItemRepository method-list docstring
- Remove UserService.create policy bypass (restore wide-event logging)
- Remove dead _serialize_record

597 tests pass.
…, tests

- executeAuthSubmit now rethrows after toasting (callers can observe failure)
- Extract ItemsPageHeader to remove items.tsx scaffold duplication
- Move feature-scoped files lib/ -> features/{auth,items}/ (lib/ infra-only)
- Delete orphan DEMO_PAGE.md; rewrite README + FRONTEND_ARCHITECTURE to match
  real app; fix config/useItems/Items naming drift
- Strengthen useAuthSubmit + items tests (+15 tests, deeper assertions)

231 tests pass; lint + tsc clean.
… cleanup

- Error handler now validates via ErrorResponse schema (honors contract)
- ItemService.get_all_paginated typed Page[Item] (was Any); drop type:ignore
- PATCH /me returns UserResponse (consistent return shape across PATCH endpoints)
- Remove stale config: AWS/Axiom/fastapi-limiter/JWT-secret settings + REPOSITORY_NAME
- Remove remaining restating exception docstrings; document dual auth-guard protocol

597 tests pass.
- useAuthSubmit rewrapped in useMutation (standard invalidation pattern)
- Logout single-teardown (clearAuthToken owns state, was running twice)
- ErrorBoundary: deprecated substr -> crypto.randomUUID
- ui/button forwardRef -> function declaration; textarea quote consistency
- Trim JSDoc bloat; remove restating comments; title TanStack->Manta
- Remove package-lock.json (bun is sole package manager)

231 tests pass; lint clean.
@croto-bot

Copy link
Copy Markdown
Collaborator Author

Linear Clone Showcase — Built on the code-health Branch

To validate the code-health improvements in this PR, we built a production-grade Linear clone directly inside template/, replacing the items example. The feat/linear-clone branch (21 commits, +32,509 lines) is built on top of code-health (92e94bf).

Validation Results

  • 192/192 behavioral assertions passed (verified live against real Postgres 18 + FastAPI via browser automation)
  • 884 backend tests passing (up from 597 at code-health baseline)
  • 579 frontend tests passing (up from 231 at code-health baseline)
  • All quality gates green: ruff clean, pytest green, tsc clean, eslint clean, vitest green

Features Built (6 milestones)

M0 — Foundation

  • Teams + roles (admin/member/guest), every entity team-scoped
  • Session/Bearer auth flows (register, login, logout, 401 redirect, deep-link preservation)
  • App shell: Sidebar, Topbar, dark mode (light/dark/system, persisted, no-flash)
  • SSR-safe hydration gate
  • Routing + first-visit onboarding

M1 — Issues Core

  • Issue entity with auto-generated per-team identifiers (TEAM-NN, concurrency-safe atomic sequence)
  • Full CRUD with server-side filter (status/priority/assignee/label), search (title ilike), sort (created/updated/priority), pagination
  • Issue detail drawer with inline editing (title, description, status/priority/assignee/label pickers)
  • Optimistic updates everywhere (onMutate cache patch + onError rollback + onSettled invalidate)
  • Workflow states (5 canonical: Backlog, Todo, In Progress, Done, Canceled) with position ordering
  • Labels with M2M association
  • Team scoping + role-based access (guest blocked from writes → 403)
  • 8s polling for near-real-time freshness (no websockets)

M2 — Projects & Cycles

  • Projects (CRUD, status, lead picker, target date, edit UI, project detail listing issues)
  • Cycles (CRUD, start/end date windows, end>start validation, progress tracking from terminal statuses, single-cycle invariant)
  • ProjectPicker + CyclePicker in issue drawer
  • Cross-surface badge consistency (assign shows everywhere)

M3 — Board, Views & Relations

  • Kanban board (native HTML5 drag-and-drop, optimistic status changes with rollback, empty columns as drop targets)
  • List↔board toggle preserving scope/filters
  • Saved Views (save/apply/match/delete filter+group_by+sort configs, dirty-change protection)
  • Sub-issues (parent/child nesting, expand/collapse, aggregate progress, link existing, detach promotes to top-level, circular reference guard)
  • Dependencies ("A blocks B", reciprocal display, circular-dependency rejection via bounded DFS, team-scoped picker)

M4 — Comments, Activity, Cmd+K

  • Comments (CRUD, newest-first, author-scoped edit/delete, empty state, composer with whitespace validation)
  • Activity feed (auto-generated read-only entries on 6 mutation types: status/assignee/priority/title/label-add/label-remove, best-effort generation, 8s polling)
  • Command palette (Cmd+K/Ctrl+K, cmdk fuzzy search, navigation targets + create actions, Esc close, empty/no-results states)
  • Keyboard shortcuts (c=create, g+i=issues, [/]=prev/next, Esc=close, ?=help, modifier-key guard so Cmd+C doesn't trigger shortcuts)

M5 — Performance & Polish

  • Board pagination (was silently capped at 50)
  • Deep-link redirect fix (preserves original path after login)
  • Empty states verified on all list surfaces
  • Console clean across all core flows
  • Dark mode legibility verified on every surface
  • Navigability verified (back/forward, deep links, unauth redirects)
  • README documenting the showcase app

Security Highlights

  • require_team_access(min_role=member) on ALL write paths including sub-resources (labels, dependencies, comments)
  • Cross-team field validation (defense-in-depth: label_id, status_id, assignee_id, project_id, cycle_id, parent_id all validated against the issue's team)
  • 404 (not 403) for cross-team entity references to avoid existence leak
  • Guest role blocked from all writes (403)

New Backend Modules (3-layer each)

teams, workflows, labels, issues, projects, cycles, views, comments, activity, issue_dependencies

New Frontend Components (highlights)

AppShell, IssueList, IssueBoard (DnD), IssueDetailDrawer, IssueFiltersBar, CommandPalette, KeyboardShortcutsProvider, CommentsThread, ActivityFeed, SubIssuesPanel, DependenciesPanel, ProjectFormDialog, CycleFormDialog, SaveViewDialog, SavedViews

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