9 changed files with 456 additions and 6 deletions
@ -0,0 +1,59 @@ |
|||||
|
# W1 T1 Review: V38/V39 Migrations and Standard Seed |
||||
|
|
||||
|
## Verdict |
||||
|
|
||||
|
- **Spec compliance:** PASS |
||||
|
- **Task quality:** Approved |
||||
|
- **Overall:** PASS |
||||
|
- **Base:** `a2c66b3` |
||||
|
- **Head:** `7fe96cc` |
||||
|
- **Blocking findings:** none |
||||
|
|
||||
|
## Verification |
||||
|
|
||||
|
- Inspected the complete `a2c66b3..7fe96cc` diff, T1 brief, execution contract, design data model, V1 schema for FK type compatibility, and both new tests. |
||||
|
- Re-ran the exact T1 evidence command from `mydreamjob-server`: |
||||
|
`mvn -Dtest=OnboardingMigrationTest,OnboardingSeedDataIntegrationTest test` |
||||
|
- Result: `Tests run: 2, Failures: 0, Errors: 0, Skipped: 0`, `BUILD SUCCESS`. |
||||
|
|
||||
|
## Spec Compliance |
||||
|
|
||||
|
- V38 creates all three required tables and matches the approved column set, lengths, nullability, defaults, FK targets, uniqueness rules, and active/sort index in `design.md`: `V38__onboarding_checklist_and_company_knowledge.sql:4-57`. |
||||
|
- FK child/parent types are compatible with the existing `users.id` and `companies.id` BIGINT primary keys (`V1__base_schema.sql:5-6` and the existing company schema). |
||||
|
- V39 contains 12 fixed standard-checklist rows with explicit `item_key`, title, category, `sort_order`, `required`, and `active` values; there is no time-, request-, or random-dependent seed input (`V39__onboarding_standard_checklist_seed.sql:4-31`). |
||||
|
- `OnboardingMigrationTest.java:37-60` verifies the three tables, required columns, four unique indexes, four foreign keys, and the active/sort index. |
||||
|
- `OnboardingSeedDataIntegrationTest.java:51-79` verifies exact seed cardinality, content, category, required/active flags, `scope_type`, `scope_id`, and stable `sort_order ASC, id ASC` ordering. |
||||
|
- The diff adds only the two migrations plus their tests and SDD task-brief artifacts. No V1-V37 migration, existing API, or W2 entity/repository/service/controller was modified. |
||||
|
- Static inspection supports H2 `MODE=MySQL` and MySQL 8.4 syntax compatibility; the focused H2 test context passed. |
||||
|
|
||||
|
## Issues |
||||
|
|
||||
|
### Critical (Must Fix) |
||||
|
|
||||
|
None. |
||||
|
|
||||
|
### Important (Should Fix) |
||||
|
|
||||
|
None. |
||||
|
|
||||
|
### Minor (Nice to Have) |
||||
|
|
||||
|
- `OnboardingMigrationTest.java:38-60` checks column presence but not the migrated column types, nullability, defaults, or CHECK constraints. The generated SQL matches the design and the key unique/FK/index obligations are covered, so this is only a future drift-detection gap. |
||||
|
- The T1 commit also adds `T2.md`, which is outside the T1 Files In Scope (`task-briefs/T1.md:14-19`). It has no runtime or contract impact, but implementation commits should normally remain limited to controller-created planning artifacts or T1-owned files. |
||||
|
|
||||
|
## Residual Verification Warning |
||||
|
|
||||
|
- Real MySQL 8.4 execution was not performed in this review. The SQL is compatible by inspection and the T1 Done Definition's two H2 evidence tests pass, but the B1 verification gate should retain the contract's real-MySQL check before final acceptance. |
||||
|
- TDD RED is credibly reported with a missing-table failure and the current checkout independently reproduces GREEN. The RED order cannot be reconstructed from the single final commit, because tests and migrations were committed together; this does not affect the implementation verdict. |
||||
|
|
||||
|
## Assessment |
||||
|
|
||||
|
**Task quality:** Approved |
||||
|
|
||||
|
**Reasoning:** T1 implements the approved schema and deterministic standard seed with appropriate focused integration coverage, no scope-breaking implementation changes, and a reproducible green evidence run. |
||||
|
|
||||
|
Controller receipt command when `ssf` is available: |
||||
|
|
||||
|
```bash |
||||
|
ssf execution review changes/n04-onboard --wave W1 --base a2c66b3 --head 7fe96cc --report changes/n04-onboard/.superpowers/sdd/reviews/W1-T1.md --verdict pass |
||||
|
``` |
||||
@ -0,0 +1,72 @@ |
|||||
|
# W1 T2 Review: Onboarding Entities, Repositories, and Review Aggregation |
||||
|
|
||||
|
## Verdict |
||||
|
|
||||
|
- **Spec compliance:** PASS |
||||
|
- **Task quality:** Approved |
||||
|
- **Overall:** PASS |
||||
|
- **Base:** `7fe96cc` |
||||
|
- **Head:** `ef4a9b8` |
||||
|
- **Blocking findings:** none |
||||
|
- **Cannot verify:** real MySQL 8.4 schema validation and JSON/tag retrieval; H2 `MODE=MySQL` passed. |
||||
|
|
||||
|
## Verification |
||||
|
|
||||
|
- Read `task-reviewer-prompt.md`, `writing-good-tests.md`, T2 brief, execution contract, design data model, V38, the complete `7fe96cc..ef4a9b8` diff, and the existing `JobReview`, `JobReviewDimensionScore`, `Job`, and `Company` mappings needed to judge the named risks. |
||||
|
- Scope check: the diff contains only the nine files allowed by the T2 brief, with 732 added lines and no unrelated or modified historical files. |
||||
|
- Re-ran the focused T2 evidence command from `mydreamjob-server` with `JAVA_HOME=D:\java` and Maven `3.9.7`. |
||||
|
- Result: `Tests run: 5, Failures: 0, Errors: 0, Skipped: 0`, `BUILD SUCCESS`. |
||||
|
- `git diff --check 7fe96cc..ef4a9b8` reported no whitespace errors. |
||||
|
|
||||
|
## Spec Compliance |
||||
|
|
||||
|
- `OnboardingChecklistItem.java:27-94` maps the approved table, all fields, unique constraints, defaults, optimistic version, and audit timestamps against `V38__onboarding_checklist_and_company_knowledge.sql:4-30`. |
||||
|
- `request_hash` is mapped with `CHAR(64)` at `OnboardingChecklistItem.java:80`, matching `V38__onboarding_checklist_and_company_knowledge.sql:17`; `OnboardingRepositoryIntegrationTest.java:107-133` verifies both persistence and the migrated H2 column type/length. |
||||
|
- `StudentOnboardingProgress.java:27-63` and `CompanyKnowledge.java:27-62` match the remaining V38 columns, nullability, lengths, unique keys, versions, and audit fields. |
||||
|
- `OnboardingChecklistItemRepository.java:13-25` filters `active=true`, selects active standard rows plus active rows for the requested company, requires both company discriminators for company rows, and orders by `sortOrder ASC, id ASC`. |
||||
|
- `StudentOnboardingProgressRepository.java:14-18` provides both the student/item batch lookup and the exact student/item lookup required by T2. |
||||
|
- `CompanyKnowledgeRepository.java:9-11` provides the unique company lookup. |
||||
|
- `JobReviewRepository.java:35-67` aggregates only reviews whose status is `PUBLISHED` and whose moderation status is `AUTO_APPROVED` or `APPROVED`; all company aggregation is scoped through `jobs.company_id`. |
||||
|
- `JobReviewDimensionScoreRepository.java:46-63` performs the eight-dimension aggregation in one database query and applies the same company, publication-status, and moderation-status filters. |
||||
|
- The review aggregation queries avoid loading review entities or issuing per-job/per-review queries, satisfying the no-N+1 requirement. |
||||
|
- `OnboardingRepositoryIntegrationTest.java:78-195` covers active/inactive standard and company items, cross-company isolation, stable ordering, request-hash mapping, student/item progress scoping, and company knowledge scoping. |
||||
|
- `OnboardingRepositoryIntegrationTest.java:198-264` covers company scoping, moderation filtering, score distribution, raw tags, and dimension aggregation. Tags are selected as the raw database column and ordered deterministically by review ID, as required. |
||||
|
- No service, controller, DTO, state machine, migration, or unrelated production file was added by T2. |
||||
|
|
||||
|
## Strengths |
||||
|
|
||||
|
- The entity mappings follow the approved V38 schema closely, including the non-obvious `CHAR(64)` request hash. |
||||
|
- The effective-checklist query encodes both company ownership discriminators, preventing a cross-company item from leaking through a mismatched `scope_id` or `company_id`. |
||||
|
- Company review aggregation is implemented as set-based JPQL and consistently applies public-status rules in every query. |
||||
|
- The integration test uses real Spring Data/JPA persistence and independently checks cross-company and moderation boundaries rather than mocking repository behavior. |
||||
|
|
||||
|
## Issues |
||||
|
|
||||
|
### Critical (Must Fix) |
||||
|
|
||||
|
None. |
||||
|
|
||||
|
### Important (Should Fix) |
||||
|
|
||||
|
None. |
||||
|
|
||||
|
### Minor (Nice to Have) |
||||
|
|
||||
|
- `OnboardingRepositoryIntegrationTest.java:217-219` labels a review as hidden by setting `moderationStatus=PENDING`, but every company-A review still has `status=PUBLISHED`. A production mutation removing the `r.status = 'PUBLISHED'` predicate from all three company queries would therefore still pass the test. Add a review with `status=HIDDEN` and `moderationStatus=APPROVED`, then assert it is excluded from count, rating distribution, tags, and dimensions. The production queries are currently correct, so this is a coverage gap rather than a runtime defect. |
||||
|
- The checklist query trusts `scope_type=STANDARD` without also enforcing the approved `scope_id=0`/`company_id IS NULL` invariant. The design explicitly assigns that consistency check to the application layer and T2 adds no standard-writing path, so this is only defense in depth. |
||||
|
|
||||
|
## Residual Verification Warning |
||||
|
|
||||
|
- The implementer correctly disclosed that real MySQL 8.4 was not exercised. H2 `MODE=MySQL` validates the new mappings and executes the aggregation queries successfully, but MySQL schema validation and JSON/tag returns remain a B1 verification-gate check. |
||||
|
|
||||
|
## Assessment |
||||
|
|
||||
|
**Task quality:** Approved |
||||
|
|
||||
|
**Reasoning:** T2 implements the approved persistence mappings and repository queries with correct scoping and public-review filtering, keeps the diff within scope, and passes focused integration evidence. The only findings are non-blocking coverage/defense-in-depth suggestions. |
||||
|
|
||||
|
Controller receipt command when `ssf` is available: |
||||
|
|
||||
|
```bash |
||||
|
ssf execution review changes/n04-onboard --wave W1 --base 7fe96cc --head ef4a9b8 --report changes/n04-onboard/.superpowers/sdd/reviews/W1-T2.md --verdict pass |
||||
|
``` |
||||
@ -0,0 +1,150 @@ |
|||||
|
# W1 Wave Review: Onboarding Data Model and Read-Only Query Foundation |
||||
|
|
||||
|
## Verdict |
||||
|
|
||||
|
- **Wave:** W1 |
||||
|
- **Base:** `a2c66b3` |
||||
|
- **Head:** `ef4a9b8` |
||||
|
- **Spec compliance:** PASS |
||||
|
- **Task quality:** PASS |
||||
|
- **Overall:** PASS |
||||
|
- **Blocking findings:** None |
||||
|
|
||||
|
## Scope Reviewed |
||||
|
|
||||
|
Read and checked: |
||||
|
|
||||
|
- `changes/n04-onboard/execution-contract.md` |
||||
|
- `changes/n04-onboard/specs/onboarding-checklist/spec.md` |
||||
|
- `changes/n04-onboard/specs/company-knowledge/spec.md` |
||||
|
- `changes/n04-onboard/design.md` |
||||
|
- `changes/n04-onboard/.superpowers/sdd/task-briefs/T1.md` |
||||
|
- `changes/n04-onboard/.superpowers/sdd/task-briefs/T2.md` |
||||
|
- `changes/n04-onboard/.superpowers/sdd/reviews/W1-T1.md` |
||||
|
- `changes/n04-onboard/.superpowers/sdd/reviews/W1-T2.md` |
||||
|
- Complete `a2c66b3..ef4a9b8` implementation diff, including migrations, entities, repositories, review aggregation queries, and integration tests. |
||||
|
|
||||
|
`git diff --check a2c66b3..ef4a9b8` reported no whitespace errors. The wave contains no service, controller, DTO, or state-machine implementation, matching W1 scope. |
||||
|
|
||||
|
## Test Evidence |
||||
|
|
||||
|
Command run from `mydreamjob-server`: |
||||
|
|
||||
|
```powershell |
||||
|
$env:JAVA_HOME='D:\java'; $env:Path='D:\java\bin;'+$env:Path |
||||
|
& 'D:\maven\apache-maven-3.9.7\bin\mvn.cmd' '-Dtest=OnboardingMigrationTest,OnboardingSeedDataIntegrationTest,OnboardingRepositoryIntegrationTest' test |
||||
|
``` |
||||
|
|
||||
|
Result: |
||||
|
|
||||
|
```text |
||||
|
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0 |
||||
|
BUILD SUCCESS |
||||
|
``` |
||||
|
|
||||
|
Per-class result: |
||||
|
|
||||
|
- `OnboardingMigrationTest`: 1 test, 0 failures/errors/skips. |
||||
|
- `OnboardingRepositoryIntegrationTest`: 5 tests, 0 failures/errors/skips. |
||||
|
- `OnboardingSeedDataIntegrationTest`: 1 test, 0 failures/errors/skips. |
||||
|
|
||||
|
## Cross-Task Integration Review |
||||
|
|
||||
|
### Migrations vs Entity Mappings |
||||
|
|
||||
|
PASS. |
||||
|
|
||||
|
- V38 creates all three approved tables with the contract column set, nullability, lengths, defaults, foreign keys, uniqueness rules, and active/sort index. |
||||
|
- Entity mappings match V38 for all three tables: `OnboardingChecklistItem`, `StudentOnboardingProgress`, and `CompanyKnowledge`. |
||||
|
- `request_hash` is mapped explicitly as `CHAR(64)`, matching V38 and the design requirement. |
||||
|
- Unique constraint annotations on the entities match the database constraint names and column sets: |
||||
|
- `uk_onboarding_checklist_scope_item` |
||||
|
- `uk_onboarding_checklist_company_idempotency` |
||||
|
- `uk_student_onboarding_progress_student_item` |
||||
|
- `uk_company_knowledge_company` |
||||
|
- The new entities are validated under H2 `MODE=MySQL` with `ddl-auto=validate`; the test scopes validation to the three new onboarding tables because an unrelated legacy H2 type mismatch exists in `auth_tokens`. |
||||
|
- No V1-V37 migration or existing table definition was modified. |
||||
|
|
||||
|
### Unique Constraints and Version Fields |
||||
|
|
||||
|
PASS. |
||||
|
|
||||
|
- Checklist item uniqueness matches the design for standard/company scope and per-company idempotency. |
||||
|
- Student progress is unique on `(student_user_id, item_id)`. |
||||
|
- Company knowledge is unique on `company_id`. |
||||
|
- All three entities use `@Version Long` with builder default `0L`, matching the database `version BIGINT NOT NULL DEFAULT 0`. |
||||
|
- No cross-task mismatch was found between database defaults and entity initial values. |
||||
|
|
||||
|
### Effective Checklist Query |
||||
|
|
||||
|
PASS for W1. |
||||
|
|
||||
|
- `findEffectiveChecklistItems(companyId)` returns only active rows. |
||||
|
- It includes active standard rows and active company rows only when both `scopeId` and `companyId` equal the requested company. |
||||
|
- Ordering is deterministic: `sortOrder ASC, id ASC`. |
||||
|
- Integration coverage verifies inactive standard/company items are excluded, other-company items are excluded, and equal-sort-order rows are stable by ID. |
||||
|
- Non-blocking follow-up: the query trusts `scope_type=STANDARD` without also requiring `scope_id=0` and `company_id IS NULL`. The design assigns that consistency invariant to the application layer, and no W1 write path can create malformed standard rows. W2 should preserve that invariant when adding services. |
||||
|
|
||||
|
### Progress Lookup |
||||
|
|
||||
|
PASS for W1. |
||||
|
|
||||
|
- Batch lookup is scoped by `studentUserId` and a collection of item IDs. |
||||
|
- Exact lookup is scoped by `studentUserId` and `itemId`. |
||||
|
- The database/entity unique constraint guarantees at most one progress row per student/item pair. |
||||
|
- Integration coverage verifies multi-student isolation and correct `completedAt` retrieval. |
||||
|
- Non-blocking follow-up for W2: first-write races must be translated through the unique constraint into the approved idempotent/concurrent behavior; W2 also needs to define behavior for an empty item collection if that path is possible. |
||||
|
|
||||
|
### Public-Only Company Review Aggregation |
||||
|
|
||||
|
PASS. |
||||
|
|
||||
|
- Rating count/average, rating distribution, and tag queries all restrict to `status = 'PUBLISHED'` and moderation status `IN ('AUTO_APPROVED', 'APPROVED')`. |
||||
|
- Dimension aggregation applies the same publication and moderation predicates. |
||||
|
- Every company-level query scopes reviews through `jobs.company_id`; other-company data is excluded. |
||||
|
- Aggregation is set-based and does not introduce an obvious N+1 path. |
||||
|
- Integration coverage verifies company isolation, moderation filtering, rating distribution, tags, and eight-dimension aggregation. |
||||
|
- Non-blocking coverage follow-up: add a review with `status=HIDDEN` and `moderationStatus=APPROVED` to prove the status predicate independently of the moderation predicate. The production queries are currently correct. |
||||
|
|
||||
|
### Scope Discipline |
||||
|
|
||||
|
PASS. |
||||
|
|
||||
|
- Production changes are limited to the three migrations, six onboarding persistence files, and additive methods in the two existing review repositories. |
||||
|
- No existing API behavior, historical migration, or unrelated production file was changed. |
||||
|
- T1 review noted that its commit also added the T2 task brief; this is planning-artifact housekeeping and has no runtime or contract impact. |
||||
|
- No W2/W3 service, controller, DTO, security, or OpenAPI implementation was introduced. |
||||
|
|
||||
|
### Readiness for W2 |
||||
|
|
||||
|
PASS with documented follow-ups. |
||||
|
|
||||
|
W2 can build on the W1 interfaces for effective checklist reads, student/item progress lookup, company knowledge lookup, and public company review aggregation. Before W2 closes, it must: |
||||
|
|
||||
|
- Validate and enforce standard/company scope consistency in service code. |
||||
|
- Handle progress insertion races and version conflicts according to 9705 semantics. |
||||
|
- Preserve the required PUBLISHED + approved moderation filter in all knowledge-summary paths. |
||||
|
- Parse raw JSON tags robustly across H2 and MySQL, since H2 returns the raw JSON column in a representation that may include outer quoting. |
||||
|
- Preserve deterministic tie-breaking for top tags and ordering of response data. |
||||
|
- Keep the real MySQL 8.4 migration/schema check as the B1 verification-gate obligation; H2 `MODE=MySQL` passed, but real MySQL was not run in this wave. |
||||
|
|
||||
|
## Findings |
||||
|
|
||||
|
### Critical |
||||
|
|
||||
|
None. |
||||
|
|
||||
|
### Important |
||||
|
|
||||
|
None. |
||||
|
|
||||
|
### Minor |
||||
|
|
||||
|
- Add the `status=HIDDEN, moderationStatus=APPROVED` aggregation test case noted above. |
||||
|
- Add defense-in-depth scope-consistency enforcement for standard rows in the effective-checklist service path. |
||||
|
- Preserve the existing validation-filter workaround as test-only infrastructure; it should not mask new onboarding mapping mismatches. |
||||
|
|
||||
|
## Assessment |
||||
|
|
||||
|
W1 is internally consistent and ready to hand off to W2. The migrations, entity mappings, repository queries, and focused integration evidence agree with the approved contract and both specs. No blocking finding prevents W2 from starting. |
||||
|
|
||||
@ -0,0 +1,56 @@ |
|||||
|
# T3 任务简报:学生有效清单与完成状态 |
||||
|
|
||||
|
## Where This Fits |
||||
|
|
||||
|
- Wave: W1 |
||||
|
- Depends on: T2 |
||||
|
- Contract: `changes/n04-onboard/execution-contract.md` |
||||
|
- Specs: `changes/n04-onboard/specs/onboarding-checklist/spec.md` |
||||
|
|
||||
|
## Objective |
||||
|
|
||||
|
实现 STUDENT 读取有效入职清单和更新本人完成状态的 Service、DTO 与 Controller,先用失败测试锁定回退、合并排序、完成率和幂等语义。 |
||||
|
|
||||
|
## Files In Scope |
||||
|
|
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/OnboardingChecklistService.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/OnboardingChecklistController.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/dto/ChecklistItemView.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/dto/EffectiveChecklistResponse.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/dto/ProgressUpdateRequest.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/dto/ProgressUpdateResponse.java` |
||||
|
- `mydreamjob-server/src/test/java/com/mydreamjob/onboarding/OnboardingChecklistServiceTest.java` |
||||
|
- `mydreamjob-server/src/test/java/com/mydreamjob/onboarding/OnboardingChecklistControllerTest.java` |
||||
|
|
||||
|
## Required Behavior |
||||
|
|
||||
|
- `GET /api/v1/onboarding/companies/{companyId}/checklist` 仅服务 STUDENT。 |
||||
|
- 企业没有活动自定义项时返回通用清单并设置 `customized=false`;有自定义项时返回通用项+企业项并按 `sortOrder ASC, id ASC` 排序。 |
||||
|
- 响应包含 companyId、companyName、customized、totalItems、completedItems、completionRate 和 items。 |
||||
|
- item 包含 itemId、source、itemKey、title、description、category、required、sortOrder、active、completed、completedAt、progressVersion。 |
||||
|
- `PUT /api/v1/onboarding/companies/{companyId}/checklist/items/{itemId}/completion` 设置绝对完成状态。 |
||||
|
- 首次完成写入 completedAt;取消完成清空 completedAt。 |
||||
|
- 相同状态重复提交必须幂等成功,不增加数据库记录。 |
||||
|
- 状态不同且提供过期 version 时返回 `ONBOARDING_PROGRESS_CONCURRENT_UPDATE`。 |
||||
|
- item 必须属于该企业的活动项或活动通用项,否则返回 `ONBOARDING_CHECKLIST_ITEM_NOT_FOUND`。 |
||||
|
- 企业不存在返回 `COMPANY_NOT_FOUND`;非 STUDENT 返回 `FORBIDDEN`。 |
||||
|
- 完成率保留一位小数,空清单为 0.0,最大 100.0。 |
||||
|
|
||||
|
## TDD Requirement |
||||
|
|
||||
|
1. 先写 Service 和 Controller 失败测试,确认 RED。 |
||||
|
2. 再实现最小 DTO、Service、Controller 使测试 GREEN。 |
||||
|
3. 不实现企业自定义项 CRUD 或公司知识接口。 |
||||
|
|
||||
|
## Evidence Commands |
||||
|
|
||||
|
```powershell |
||||
|
cd D:\1\zhi\zhilai\mydreamjob-server |
||||
|
mvn -Dtest=OnboardingChecklistServiceTest,OnboardingChecklistControllerTest test |
||||
|
``` |
||||
|
|
||||
|
## Done Definition |
||||
|
|
||||
|
- 测试覆盖通用回退、企业合并、稳定排序、首次完成、重复相同状态、取消完成、版本冲突、跨企业 itemId 和企业不存在。 |
||||
|
- 响应不泄露内部用户字段。 |
||||
|
- 不修改既有已验收接口。 |
||||
@ -0,0 +1,53 @@ |
|||||
|
# T4 任务简报:企业自定义清单 CRUD 与幂等 |
||||
|
|
||||
|
## Where This Fits |
||||
|
|
||||
|
- Wave: W2 |
||||
|
- Depends on: T3 |
||||
|
- Contract: `changes/n04-onboard/execution-contract.md` |
||||
|
- Specs: `changes/n04-onboard/specs/onboarding-checklist/spec.md` |
||||
|
|
||||
|
## Objective |
||||
|
|
||||
|
在已有学生清单服务与 Controller 上增加 COMPANY 自定义清单 CRUD,先用失败测试锁定所有权、幂等和乐观锁。 |
||||
|
|
||||
|
## Files In Scope |
||||
|
|
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/OnboardingChecklistService.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/OnboardingChecklistController.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/dto/CompanyChecklistItemCreateRequest.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/dto/CompanyChecklistItemUpdateRequest.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/dto/CompanyChecklistItemView.java` |
||||
|
- `mydreamjob-server/src/test/java/com/mydreamjob/onboarding/OnboardingCompanyChecklistServiceTest.java` |
||||
|
- `mydreamjob-server/src/test/java/com/mydreamjob/onboarding/OnboardingCompanyChecklistControllerTest.java` |
||||
|
|
||||
|
## Required Behavior |
||||
|
|
||||
|
- `GET /api/v1/onboarding/company/checklist-items` 仅 COMPANY,读取本企业全部自定义项,含软删除项与 version。 |
||||
|
- `POST /api/v1/onboarding/company/checklist-items` 创建本企业项,校验 title 1-120、description <=1000、category 枚举、sortOrder 0-9999、required 默认 false、idempotencyKey <=64。 |
||||
|
- 相同企业 + 相同 idempotencyKey + 相同规范化请求体返回原条目;不同请求体返回 `ONBOARDING_IDEMPOTENCY_CONFLICT`。 |
||||
|
- 活动自定义项达到 50 条时返回 `ONBOARDING_ITEM_LIMIT_EXCEEDED`。 |
||||
|
- `PUT /api/v1/onboarding/company/checklist-items/{itemId}` 更新标题、说明、分类、排序、必填和 active,必须校验 version。 |
||||
|
- 过期 version 返回 `ONBOARDING_CHECKLIST_ITEM_CONCURRENT_UPDATE`。 |
||||
|
- `DELETE /api/v1/onboarding/company/checklist-items/{itemId}?version={version}` 软删除;重复删除已非活动项幂等成功。 |
||||
|
- 所有企业操作仅限当前 COMPANY 拥有的企业,跨企业 itemId 返回 `ONBOARDING_CHECKLIST_ITEM_NOT_FOUND`。 |
||||
|
- 企业不存在返回 `COMPANY_NOT_FOUND`,非 COMPANY 返回 `FORBIDDEN`。 |
||||
|
|
||||
|
## TDD Requirement |
||||
|
|
||||
|
1. 先写 Service/Controller 失败测试并确认 RED。 |
||||
|
2. 再实现最小 DTO、Service、Controller 使测试 GREEN。 |
||||
|
3. 不实现公司知识接口。 |
||||
|
|
||||
|
## Evidence Commands |
||||
|
|
||||
|
```powershell |
||||
|
cd D:\1\zhi\zhilai\mydreamjob-server |
||||
|
mvn -Dtest=OnboardingCompanyChecklistServiceTest,OnboardingCompanyChecklistControllerTest test |
||||
|
``` |
||||
|
|
||||
|
## Done Definition |
||||
|
|
||||
|
- 覆盖查询、创建、幂等重放、幂等冲突、上限、更新、版本冲突、软删除、重复删除和跨企业隔离。 |
||||
|
- 创建请求哈希可重复,不依赖随机或当前时间。 |
||||
|
- 既有学生清单行为不回归。 |
||||
@ -0,0 +1,57 @@ |
|||||
|
# T5 任务简报:公司知识配置与公开评价摘要 |
||||
|
|
||||
|
## Where This Fits |
||||
|
|
||||
|
- Wave: W2 |
||||
|
- Depends on: T4 |
||||
|
- Contract: `changes/n04-onboard/execution-contract.md` |
||||
|
- Specs: `changes/n04-onboard/specs/company-knowledge/spec.md` |
||||
|
|
||||
|
## Objective |
||||
|
|
||||
|
实现 COMPANY 知识配置读取/Upsert 和 STUDENT 公司知识聚合接口,先用失败测试锁定基础信息回退、小样本保护和八维摘要。 |
||||
|
|
||||
|
## Files In Scope |
||||
|
|
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/CompanyKnowledgeService.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/CompanyKnowledgeController.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/dto/CompanyKnowledgeUpdateRequest.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/dto/CompanyKnowledgeView.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/dto/CompanyKnowledgeOverviewResponse.java` |
||||
|
- `mydreamjob-server/src/main/java/com/mydreamjob/onboarding/dto/ReviewSummaryView.java` |
||||
|
- `mydreamjob-server/src/test/java/com/mydreamjob/onboarding/CompanyKnowledgeServiceTest.java` |
||||
|
- `mydreamjob-server/src/test/java/com/mydreamjob/onboarding/CompanyKnowledgeControllerTest.java` |
||||
|
|
||||
|
## Required Behavior |
||||
|
|
||||
|
- `GET /api/v1/onboarding/company/knowledge` 仅 COMPANY;无记录返回 configured=false、空内容、version=0;有记录返回 configured=true、culture、workPolicies、onboardingGuide、updatedAt、version。 |
||||
|
- `PUT /api/v1/onboarding/company/knowledge` 仅 COMPANY;首次创建允许无 version;已有记录必须提供当前 version;冲突返回 `ONBOARDING_KNOWLEDGE_CONCURRENT_UPDATE`。 |
||||
|
- 知识字段按纯文本处理,culture <=2000,workPolicies <=4000,onboardingGuide <=4000,至少一个非空。 |
||||
|
- `GET /api/v1/onboarding/companies/{companyId}/knowledge` 仅 STUDENT;企业不存在返回 `COMPANY_NOT_FOUND`。 |
||||
|
- 无知识记录时 knowledgeState=BASIC_ONLY、knowledge=null,并返回企业基础资料白名单。 |
||||
|
- 有知识记录时 knowledgeState=CONFIGURED。 |
||||
|
- 评价只统计该公司全部岗位下 PUBLISHED 且 AUTO_APPROVED/APPROVED 的评价。 |
||||
|
- 0 条:state=EMPTY,totalReviews=0,平均分/分布/标签/维度汇总为空。 |
||||
|
- 1-2 条:state=INSUFFICIENT,返回 totalReviews,不返回任何均值。 |
||||
|
- 至少 3 条:state=SUFFICIENT,返回 averageRating、ratingDistribution、topTags(次数降序、字典序升序,最多 10)、八个维度的 averageScore/sampleCount/dataState。 |
||||
|
- 缺失维度 sampleCount=0、dataState=INSUFFICIENT。 |
||||
|
- 响应不得包含 ownerUserId、studentUserId、审核原因、哈希、IP、User-Agent。 |
||||
|
|
||||
|
## TDD Requirement |
||||
|
|
||||
|
1. 先写 Service/Controller 失败测试,确认 RED。 |
||||
|
2. 再实现最小 DTO、Service、Controller 让测试 GREEN。 |
||||
|
3. 不修改既有评价/企业接口响应。 |
||||
|
|
||||
|
## Evidence Commands |
||||
|
|
||||
|
```powershell |
||||
|
cd D:\1\zhi\zhilai\mydreamjob-server |
||||
|
mvn -Dtest=CompanyKnowledgeServiceTest,CompanyKnowledgeControllerTest test |
||||
|
``` |
||||
|
|
||||
|
## Done Definition |
||||
|
|
||||
|
- 覆盖 COMPANY 无记录/已有记录/创建/更新/版本冲突。 |
||||
|
- 覆盖 STUDENT BASIC_ONLY、CONFIGURED、EMPTY、INSUFFICIENT、SUFFICIENT。 |
||||
|
- 覆盖公开审核过滤、标签排序、八维缺失和数据最小化。 |
||||
Loading…
Reference in new issue