8.2 KiB
| name | description |
|---|---|
| up-code-generate | Generate production-grade backend services, frontend views/screens, database migrations, API contracts, and integration adapters for the stories in the current iteration's backlog, with explicit delivery-surface coverage across portal/frontend, API, data, integration, infrastructure, and QA. Use this after up-wireframe-spec and up-test-model-generate have produced the iteration's screens, surface matrix, and test cases. Covers Stage 13 (Construction) of the UP-AI v1.0 Process (process/AI_Native_Unified_Process_v1.md). |
up-code-generate — Stage 13 (Construction, per iteration)
Objective
Implement the current iteration's stories as production-grade code — backend services, frontend screens/views, database migrations, API contracts, and integration adapters — adhering to the technology stack configured in tech-profile.yaml and requirement-driven development principles.
When to invoke
- After
up-wireframe-specandup-test-model-generatehave produced this iteration's screens and test cases. - Repeatedly within an iteration, once per story or logical group of related stories.
Read first
tech-profile.yaml(specifies backend language, framework, ORM, migrations, frontend framework, auth provider, and sandboxes)- Current iteration's
project_sdlc/05_iteration_planning/iterations/iteration-NN/iteration_backlog.md(STORY-xxx list) - Current iteration's
iteration_surface_matrix.md(required delivery surfaces and owners) - Current iteration's
parallel_work_plan.md(if parallel lanes are active) - Owning
project_sdlc/04_architecture_design/lld/LLD-0xx_*.md(API/table/event contracts) - Owning use case's
functional-reqs.md(acceptance criteria, validation, audit requirements) - This iteration's wireframes (
project_sdlc/06_wireframes/) and test cases (project_sdlc/07_test_design/) project_sdlc/06_wireframes/DESIGN.mdor active design system tokensarchitecture_spike_report.md(service template conventions)
Procedure
Pick the next STORY-xxx with status "Ready" from the iteration backlog. Implement only that story (or related group) per invocation:
Confirm every applicable surface in iteration_surface_matrix.md has an owner and repository path. If the story requires a frontend screen, frontend code is mandatory unless an approved CR-xxx/DEC-xxx explicitly defers it.
Backend service generation: Implement against the LLD API contract exactly — request/response shapes, status codes, error format, RBAC checks, tenant-context propagation, validation, and audit logging. Use the backend language/framework specified in tech-profile.yaml.
- When
framework: frappe, organize code within the target Frappe App, authoring DocType controllers (<doctype>.py), whitelisted remote procedures (@frappe.whitelist()), server scripts, and event hooks (hooks.py). - When
framework: djangoorfastapiorspring_boot, implement service controllers, repositories, and API routers matching LLD endpoint contracts. Write unit and integration tests covering the story's acceptance criteria. Add or update API collections (Bruno.bruor OpenAPI spec) for added/changed endpoints.
Frontend screen generation: Implement against the iteration's wireframe/field-level spec — fields, validation, navigation, error states.
- When
frontend.framework: frappe_desk, configure DocType FormViews, ListViews, Workspaces, and client scripts (<doctype>.js), or custom Vue/React SPAs using@frappe/ui. - When standard React/Vue/Angular, reuse
DESIGN.mdcomponent library, tokens, and Tailwind/shadcn controls. Write corresponding component and browser-E2E tests (e.g. Playwright) tagged withUC-xxx/FR-xxx/STORY-xxx.
Database implementation: Generate schema matching the LLD table definitions via the migration mechanism configured in tech-profile.yaml:
- When
framework: frappe, author DocType schema JSON files (<doctype>.json) with fieldtypes, options, and permissions, synchronized into MariaDB/PostgreSQL viabench migrate. - When SQLAlchemy/Django/Spring Boot/Prisma, generate migration files via Alembic, Django migrations, Flyway, or Prisma; do not hand-edit schema outside migrations.
Integration adapters: Implement external API triggers, requests, and failure handling against the contracts in tech-profile.yaml. Consume and verify against the Wave 0 Sandbox/Mock adapters so test suites run 100% deterministically and offline without external API dependencies.
Rules (apply to every story):
- Do not introduce unrelated changes or refactor unrelated files.
- Write unit/integration/contract/smoke/browser-E2E tests assigned to this story by
up-test-model-generate. - Implement validation, error handling, structured logging, and audit trails where the FR requires it.
- Enforce tenant isolation and authorization per the architecture spike's validated pattern.
- Update
iteration_surface_matrix.mdwith implementation status and verification evidence. Intraceability_graph.md, transition requirement status toImplemented (Domain/Schema)upon code and unit test completion. DO NOT mark requirements asDeliveredat this stage;Delivered (E2E Verified)is reserved for Gate 14.1 closure after all delivery surfaces, migrations, and dual QA assets pass. - Do not place secrets, live tokens, or production credentials in code, fixtures, logs, or commits.
- Strict Anti-Placeholder Rule: Stub functions, mock controllers where real database logic was specified, and zero-coverage test stubs are strictly forbidden. All code must implement genuine business logic. Every web portal/screen declared in
iteration_surface_matrix.mdmust have a physical, genuine frontend view implementation (.tsx/.vue) on disk wired via typed API clients and registered in the application router. Ghost screens or unimplemented UI placeholders cannot be marked asDelivered (E2E Verified)and will fail Gate 14.1 checkG14-013. - Automated Test Coverage Budgets: Ensure code meets the thresholds configured in
tech-profile.yaml:- Backend Domain & FSMs: ≥95.0% statement and branch coverage.
- Integration Adapters: ≥90.0% against Wave 0 sandboxes.
- Frontend UI Components: ≥80.0% component branch coverage + mandatory Playwright browser-E2E tests for primary user journeys. Exercise Happy Path, Alternate/Boundary, Failure, and FSM Invariant scenarios.
- Automated OpenAPI Client Code Generation: When building frontend consumers for backend APIs, run automated client type generation (e.g.,
npm run codegen:apiviaopenapi-typescriptororval). AI agents are strictly prohibited from handwriting custom TypeScript interfaces for backend entities, preventing response envelope and property drift. - Strict Zero Silent Mock Fallback Rule (
G14-017): Frontend components are strictly prohibited from falling back to hardcoded mock arrays or dummy objects when live API calls fail or return unexpected envelope keys (e.g.if (res && res.orders) setOrders(res.orders) else setOrders([mock])). API failures must render an explicit error boundary, alert banner, or empty state. Camouflaging API contract drift with silent mock fallbacks violates the anti-placeholder rule and fails Gate 14.1 with errorG14-017. - Single-Source Navigation RBAC Parity (
G14-015): Frontend navigation configurations (App.tsx/ALL_NAV_ITEMS) must derive permissions directly from backendROLE_PERMISSIONSandauth_matrix.yaml. Manually guessed or mismatchedallowedRolesarrays violate Segregation of Duties and fail Gate 14.1 checkG14-015.
Output expected
Source code changes; updated OpenAPI / Bruno specs in docs/api/bruno/; DB migrations; frontend portal artifacts; updated iteration_surface_matrix.md; requirement status transitioned to Implemented (Domain/Schema); execution log.
Exit criteria
Story implemented per LLD contract and screen spec across every applicable surface; API, data, integration, and frontend artifacts are synchronized; tests achieve configured coverage thresholds; requirements transitioned to Implemented (Domain/Schema); ready for up-defect-fix and Gate 14.1.
Related skills
Previous: up-wireframe-spec, up-test-model-generate. Next: up-defect-fix (code review, defect handling), then up-traceability-gate (Gate 14.1).