Files
Jyotisha/PROGRESS-report-sectioned-20260830.md
T
Jesse_Chen 0ae3e2d796
Independent Staging Quality Gate / validate (push) Has been cancelled
Independent Staging Quality Gate / publish (push) Has been cancelled
feat(reports): generate personal reports by section
2026-08-30 22:59:17 +08:00

5.1 KiB
Raw Blame History

PROGRESS · personal report sectioning · 2026-08-30

Task 0 gate — observed after staging deployment

  • Telemetry commit: 1f1fdb1d155e472118ad7d1d4c49b1b5cb95bcb2.
  • Deployed staging SHA verified at https://staging.jyotisha.chat/api/health: 37c0c139656c5eab7150221e8c09d9aa6fcf95b8.
  • Observation window: 2026-08-30 20:4620:51 Asia/Taipei, one real authenticated “生成完整报告” run.
  • User-visible result: report did not complete; the report center shows report_schema_invalid.
  • Server event: one [personal-report] generation_failed with innerReason=final_parse_rejected.

Telemetry sample (privacy-safe fields only)

observed agent attempts outcome finishReason inputTokens outputTokens totalTokens repairAttempted
1 resolved stop 4,772 3,069 7,841 false

Gate metrics from this sample

  • Report failures: 1.
  • Agent telemetry attempts observed: 1.
  • finishReason="length": 0 / 1 = 0% of observed agent attempts; 0 / 0 = not applicable when restricted to agent attempts that themselves failed.
  • outputTokens p50: 3,069.
  • outputTokens p95: 3,069.
  • Important attribution: this run's agent call resolved with finishReason="stop"; the later report-level final parse failed. Therefore this sample does not support attributing the report failure to truncation.

Gate decision

Task 0 observation is complete. No output cap, schema relaxation, or schema tightening was made from the estimate in the task brief. The observed failure is recorded as a report-level parse failure, not a length failure. It is now permissible to begin Tasks 14, subject to the Docker/database stop rule and the remaining quality gates.

Task 14

  • Not started at the time of this entry.

Task 14 implementation

  • Task 1: added public.personal_report_sections in migration 20260830020000_personal_report_sections.sql. The migration is transactional and idempotent, enables RLS, grants authenticated read-only access to own rows, grants service-owned writes, and exposes security-definer section state functions (ensure, start, complete, block). report_document remains final-output-only.
  • Task 2: generation is now serial plan → section:<id> × N → summary → assemble → ready. Each section receives only the evidence refs declared by its plan entry plus completed section titles; summary receives only completed titles and claimStatus. Existing ready section rows are reused on resume and are not regenerated.
  • Task 3: section retry exhaustion marks that section blocked with an allowlisted error category, continues other sections, and assembles an explicit disclosure. A report fails only when every write section is blocked or summary/assembly fails.
  • Task 4: worker updates progress_percent and progress_phase; the report page renders phase-aware progress while preserving timed-out/resume/report-center states.

Validation

  • ./node_modules/.bin/tsc --noEmit --pretty false: passed.
  • npm run lint: passed with 0 errors and 24 pre-existing warnings.
  • Focused sectioned generation, resume, blocked fallback, polling, and database tests: 33 passed, 0 failed.
  • npm run test:db: passed with 34 passed, 0 failed (Docker-backed).
  • Full ./node_modules/.bin/tsx --test tests/*.test.ts: exit 1 in this local run. The report-polling assertion that locked the old fixed loading copy was the only failure caused by this change and was updated with the required explanation; the remaining observed failures were existing local environment/resource failures (parallel PostgreSQL fixture/migration startup and missing Python yaml module), listed for baseline comparison before final push.
  • npm run db:migrate:check: passed in isolated Docker PostgreSQL; apply exited 0, check exited 0, and reapply exited 0 with already applied 20260830020000_personal_report_sections.sql.
  • npm run build: passed; Next.js production build completed with 5 pre-existing Turbopack dynamic-filesystem warnings.

Full-test comparison

  • ./node_modules/.bin/tsx --test tests/*.test.ts: exited 1 in the final local run. The report-section focused tests remained green; no new report-generation or section-service failure was observed. The failing tests were outside this change and/or local-environment dependent:
    • service and restricted admin database identities stay separated
    • v9 legacy backfill maps statuses, keeps one resumable per user and is idempotent
    • ingest P0: education kinds, batch confirm, opening focus reuse, precision lock
    • PR-4 candidate decisions use server UUIDs, receipt-derived gates and separate acceptance/confirmation
    • changed staging workflows are syntactically valid YAML (local Python missing yaml)
    • additional database suites reported PostgreSQL fixture shutdown/permission/resource failures during the long parallel run.
  • These failures are not being reclassified as code-green; the focused acceptance suite and the required Docker-backed npm run test:db are the evidence for this change.

Delivery

  • Task 14 commit: pending local commit.
  • Staging push/deploy: pending.