Files
mercadodevida/work/artifacts/F-001/implementer.md
rikrdo 1d4eebca54 feat(F-001): scaffold modular monolith skeleton with boundary checker
- TypeScript + Fastify skeleton under project/ (src/modules, shared, infrastructure, app)
- scripts/check-module-boundaries.mjs enforcing module public-API rules (tested with fixtures)
- GET /health endpoint, error envelope without stack leakage
- specs/F-001-scaffold (SPEC/DESIGN/TASKS/TESTS), spec/tech.md dependency justification
- 30-ticket MercadoDeVida roadmap in backlog/features.json, spec/roadmap.md
- All gates approved: reviewer, security, qa; verify.sh green
2026-08-14 21:46:54 +02:00

56 lines
2.5 KiB
Markdown

# Implementer — F-001 Scaffold modular monolith skeleton
done -> work/artifacts/F-001/implementer.md
## Files created (all under project/)
- package.json, tsconfig.json, tsconfig.build.json, eslint.config.mjs, vitest.config.ts
- .prettierrc.json, .prettierignore, .gitignore, README.md
- scripts/check-module-boundaries.mjs
- scripts/tests/boundary-checker.test.ts
- scripts/tests/fixtures/{ok,cross-module-internal,deep-from-app}/ (boundary test fixtures)
- src/app/build-app.ts (composition root)
- src/app/tests/build-app.test.ts
- src/infrastructure/http/server.ts (listen entrypoint)
- src/modules/health/index.ts, src/modules/health/api/health.routes.ts, src/modules/health/tests/health.test.ts
- src/shared/errors.ts
## Files modified
- specs/F-001-scaffold/TESTS.md (test locations updated to final layout)
## Database migrations
- None.
## API changes
- Adds GET /health -> 200 {"status":"ok"}
- Adds 404 JSON envelope: {"error":{"statusCode":404,"message":"Not Found"}}
- Error handler never leaks stack traces (500 -> generic message).
## Tests added
- health module API test (module-scoped, no cross-module imports)
- composition root tests (health wired, 404 envelope without stack leak)
- boundary checker tests: ok tree, R1 violation fixture, R2 violation fixture, index import allowed
## Tests passed (evidence)
```
npm run lint -> OK (eslint + prettier)
npm run lint:boundaries -> Boundary check OK: 7 file(s) checked
npm run typecheck -> exit 0
npm run build -> exit 0 (dist generated)
npm test -> Test Files 3 passed (3), Tests 7 passed (7)
smoke: PORT=3999 node dist/infrastructure/http/server.js
curl /health -> HTTP 200 {"status":"ok"}
curl /nope -> {"error":{"statusCode":404,"message":"Not Found"}}
```
## Known limitations
- Boundary checker covers static import/export specifiers only (no require(), no runtime reflection). Acceptable for TS ESM codebase.
- No request_id / structured logging yet (F-003 scope).
- No CI pipeline defined (repo-level decision, out of F-001 scope).
## Follow-up work
- F-002 database foundation, F-003 request context, F-004 config/flags (per backlog dependencies).
## Notes
- The boundary checker caught a real violation during build (health test importing src/app). Fixed by moving composition tests to src/app/tests and keeping module tests module-scoped. This is the rule working as designed.
- design_prompt.md added to .prettierignore: it is a project input document, not product code.