feat(task-017): implement git publishing dry-run and commit flow
This commit is contained in:
@@ -34,16 +34,16 @@ Development description: Implement the Git-backed publishing path that builds a
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] TDD pre-requirement: before implementation, write one failing integration test against a temporary local Git repository proving a final-approved article can create a commit; add dry-run and failure tests one behavior at a time and record evidence in `Result`.
|
||||
- [ ] Publishing cannot dry-run before final approval.
|
||||
- [ ] Dry run fails if generic Markdown/MDX content-shape validation fails.
|
||||
- [ ] Publish commit cannot run until dry run passes.
|
||||
- [ ] Content bundle uses site-configured path templates and frontmatter mapping.
|
||||
- [ ] Active YAML/script config version is included in publish logs/manifest.
|
||||
- [ ] Publish writes commit to configured production branch in a test repository.
|
||||
- [ ] Non-fast-forward push or conflict fails without automatic rebase.
|
||||
- [ ] Publish commit record stores repository URL, branch, commit SHA, bundle manifest, and status.
|
||||
- [ ] UI clearly labels validation as best-effort content-shape validation only.
|
||||
- [x] TDD pre-requirement: before implementation, write one failing integration test against a temporary local Git repository proving a final-approved article can create a commit; add dry-run and failure tests one behavior at a time and record evidence in `Result`.
|
||||
- [x] Publishing cannot dry-run before final approval.
|
||||
- [x] Dry run fails if generic Markdown/MDX content-shape validation fails.
|
||||
- [x] Publish commit cannot run until dry run passes.
|
||||
- [x] Content bundle uses site-configured path templates and frontmatter mapping.
|
||||
- [x] Active YAML/script config version is included in publish logs/manifest.
|
||||
- [x] Publish writes commit to configured production branch in a test repository.
|
||||
- [x] Non-fast-forward push or conflict fails without automatic rebase.
|
||||
- [x] Publish commit record stores repository URL, branch, commit SHA, bundle manifest, and status.
|
||||
- [x] UI clearly labels validation as best-effort content-shape validation only.
|
||||
|
||||
## Verification
|
||||
|
||||
@@ -53,9 +53,58 @@ Development description: Implement the Git-backed publishing path that builds a
|
||||
|
||||
## Result
|
||||
|
||||
- Status: Pending execution.
|
||||
- TDD plan: To be filled during execution.
|
||||
- Red evidence: To be filled during execution.
|
||||
- Green evidence: To be filled during execution.
|
||||
- Refactor notes: To be filled during execution.
|
||||
- Verification output: To be filled during execution.
|
||||
- Status: Done (TDD RED -> GREEN completed).
|
||||
- TDD progression:
|
||||
1. Restored and expanded `apps/backend/tests/integration/test_publishing_git_flow_public_api.py` from RED baseline.
|
||||
2. Added incremental behavior coverage:
|
||||
- dry-run blocked before final approval,
|
||||
- dry-run content-shape validation failure path,
|
||||
- create-commit blocked without successful dry-run,
|
||||
- successful publish commit into local bare repo `main`,
|
||||
- non-fast-forward conflict fail without auto rebase,
|
||||
- publishing status/commits metadata assertions.
|
||||
3. Implemented publishing backend flow:
|
||||
- endpoints:
|
||||
- `POST /api/articles/{article_id}/publishing/dry-run`
|
||||
- `POST /api/articles/{article_id}/publishing/create-commit`
|
||||
- `GET /api/articles/{article_id}/publishing/status`
|
||||
- `GET /api/articles/{article_id}/publishing/commits`
|
||||
- gates:
|
||||
- dry-run only after final approval,
|
||||
- create-commit only after successful dry-run.
|
||||
- content-shape checks:
|
||||
- non-empty markdown,
|
||||
- at least one markdown heading,
|
||||
- balanced fenced code blocks.
|
||||
- bundle/manifest:
|
||||
- site-configured `content_path_template` and `asset_path_template`,
|
||||
- frontmatter mapping usage,
|
||||
- active script config version id/hash metadata,
|
||||
- repository/branch/base head/commit sha metadata.
|
||||
- git publish:
|
||||
- direct commit+push to configured production branch,
|
||||
- non-fast-forward detection and fail path without rebase.
|
||||
4. Added frontend detail-model mapping for validation label and surfaced label in article detail UI.
|
||||
5. Regenerated shared OpenAPI contracts.
|
||||
|
||||
- Green evidence:
|
||||
- Integration suite passes with all required publishing behaviors in one flow-oriented file:
|
||||
`apps/backend/tests/integration/test_publishing_git_flow_public_api.py` (6 tests, all green).
|
||||
- Commit object is present in bare repo (`git cat-file -e <sha>^{commit}` in test).
|
||||
- Manifest metadata includes `config_version` and `git` blocks and best-effort validation label.
|
||||
|
||||
- Refactor notes:
|
||||
- Added dedicated `PublishCommitsRepository` with list/latest helpers and status filtering.
|
||||
- Added `articles.update_publishing_status(...)` for explicit workflow/publishing-state sync.
|
||||
- Kept implementation scoped to task 017 API/domain/repository/frontend model changes; no unrelated workflow rewrites.
|
||||
|
||||
- Verification output:
|
||||
- `PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps/backend/tests/integration/test_publishing_git_flow_public_api.py` -> `Ran 6 tests ... OK`
|
||||
- `PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps/backend/tests/integration/test_final_approval_gate_public_api.py` -> `Ran 7 tests ... OK`
|
||||
- `PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps/backend/tests/integration/test_draft_assembly_public_api.py` -> `Ran 5 tests ... OK`
|
||||
- `PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps/backend/tests/integration/test_assets_media_library_public_api.py` -> `Ran 7 tests ... OK`
|
||||
- `PYTHONPATH=/private/tmp/pupline-backend-deps python3 scripts/generate_openapi_contracts.py` -> wrote:
|
||||
- `packages/shared/openapi.json`
|
||||
- `packages/shared/src/api-types.ts`
|
||||
- `node apps/frontend/tests/article_detail.model.test.mjs` -> `OK` (exit 0)
|
||||
- `pnpm --dir apps/frontend typecheck` -> `tsc --noEmit` completed successfully (exit 0)
|
||||
|
||||
Reference in New Issue
Block a user