# Task 6 — Current-location World API report

## Scope delivered

- Added `WorldService.getCurrentLocation(characterId)`.
- Added `GET /api/world/current-location` using the stable demo character.
- Added `WorldModule`, including TypeORM repositories for `Character` and
  `LocationConnection`, and imported it through `AppModule`.
- `WorldService` completes due travel before loading the character, returns the
  complete current-location DTO, returns only enabled outgoing connections, and
  exposes a target summary, duration, and textual danger rating only. The raw
  `ambushChance` is not part of the public DTO; `0.0500` maps to `LOW`.
- Kept the existing database-free health E2E harness valid by overriding the
  newly imported `WorldModule`, just as it already overrides the database,
  character, and travel modules.

## Required preflight

- Read the complete Task-6 brief and the binding project documentation,
  including the visual asset style guide.
- Inspected `world-travel-screen.png`, `combat-screen.png`, and
  `hunting-screen.png` in `docs/references/`.
- Preserved the user-owned untracked `apps/web/public/images/` directory and
  `docs/references/Ashen_Realms_Visual_Asset_Style_Guide_V1.md` unchanged.

## TDD evidence

### RED

Command:

```powershell
npm test --workspace=@ashen-realms/api -- world.service.spec.ts --runInBand
```

Initial result: failed because `./world.service` did not exist. After the
minimal initial implementation, the test exposed that a disabled connection
could still be returned by an unexpected repository result. The service now
defensively filters disabled connections in addition to querying with
`enabled: true`.

### GREEN

```powershell
npm test --workspace=@ashen-realms/api -- world.service.spec.ts --runInBand
```

Result: 1 suite passed, 2 tests passed.

## Verification evidence

```powershell
npm test --workspace=@ashen-realms/api -- --runInBand
# 8 suites passed, 20 tests passed

npm run test:e2e --workspace=@ashen-realms/api -- --runInBand
# 1 suite passed, 2 tests passed

npm run build:api
# Nest build completed successfully

# From apps/api:
.\node_modules\.bin\prettier.cmd --check <Task-6 TypeScript files>
npx eslint <Task-6 TypeScript files>
# Prettier: all matched files use Prettier code style; ESLint exit 0

git diff --check -- apps/api/src/app.module.ts apps/api/src/world apps/api/test/app.e2e-spec.ts
# exit 0
```

The initial E2E run was reproducibly red because the new `WorldModule` caused
TypeORM repository construction after the test had intentionally replaced the
database module. Adding its corresponding empty module override restored the
existing database-free health test without changing product behavior.

## Deliberate limits and concerns

- The approved first slice only needs the seeded 5% route, so the public
  connection danger mapping currently distinguishes `LOW` (at or below 5%) and
  `HIGH` (above 5%). Future routes may require finer danger tiers when their
  product thresholds are specified.
- This task adds no database-backed route E2E assertion; the dedicated
  migration/seed route smoke test is scheduled for Task 10.
