Skip to content

docs+mocks: v4.0.1 follow-ups from PR #1 review closure (Taiga #199) - #12

Open
t0kubetsu wants to merge 3 commits into
mainfrom
fix/199-docs-and-fixture-coherence
Open

docs+mocks: v4.0.1 follow-ups from PR #1 review closure (Taiga #199)#12
t0kubetsu wants to merge 3 commits into
mainfrom
fix/199-docs-and-fixture-coherence

Conversation

@t0kubetsu

@t0kubetsu t0kubetsu commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Mechanical follow-ups from the PR #1 review closure, per Taiga task #199 (documentation touch-ups + mock-fixture coherence). All additive/corrective; no endpoint or schema shape changes.

Documentation

  • ScanResult.trend documented (review A4 residual): api-design §2.4 and data-model §8.1 now describe the computed trend / TrendDirection, which existed in the contract and core/enums.py but in neither reference doc. The data-model note states it is computed at read and backed by no PostgreSQL enum, mirroring the computed verification status (§4.2).
  • Statements-only 500 dropped (review A19): GET /statements was the sole operation declaring a 500, with no stated rationale. The global fallback handler already guarantees problem+json for unhandled faults everywhere, so the declaration implied a special failure mode that does not exist. api/openapi.json re-exported.

Mock coherence

  • Revoked feed: the sample set revoked_at = created_at (June 1) while last_used_at was July 31 — a feed used two months after revocation. revoked_at now falls after the last delivery.
  • Cancel: POST /scans/{scan_id}/cancel returned a partial job; it now returns status = canceled with a cancellation status_reason. canceled appeared in no other sample, and the cancel response is where a client learns the terminal shape it must render.
  • Verification challenge: the pending sample's challenge was requested June 1 with a 7-day window, yet its recheck was recorded July 31 — a recheck against an unanswerable challenge. The challenge is now requested July 28, keeping the window open at the recheck and keeping pending truthful.

Checks

make export-openapi committed in sync · make lint clean · make typecheck 0 errors · make test 103/103.

Refs: Taiga #199 (v4.0.1 contract follow-ups from PR #1 review closure).

Summary by CodeRabbit

  • New Features

    • Added trend information to scan results, including improving, unchanged, and declining directions.
    • Added clearer examples for canceled scans and revoked asset feeds.
  • Documentation

    • Documented trend calculations, comparisons, and conditions where trends are unavailable.
    • Updated the statements API documentation to reflect its current error responses.
  • Bug Fixes

    • Corrected canceled-scan and revoked-feed responses to return appropriately stateful examples.

…ly 500

- api-design §2.4 and data-model §8.1 now describe the computed `trend`
  (`TrendDirection`), previously present only in the contract and
  core/enums.py (review A4 residual, Taiga #199).
- `GET /statements` no longer declares a 500: the global fallback handler
  answers problem+json everywhere, and no artifact explained why this one
  operation advertised a special failure mode (review A19, Taiga #199).
- Revoked-feed sample: `revoked_at` now falls after `last_used_at` instead
  of preceding it by two months.
- Cancel sample: `POST /scans/{id}/cancel` returns a `canceled` job with a
  cancellation `status_reason`; `canceled` appeared in no other sample.
- Verification challenge sample: requested recently enough that its answer
  window is still open at the recorded recheck, so a `pending` verification
  no longer carries an unanswerable challenge.
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1f82cc5c-03be-4536-b775-dfa0f798fa96

📥 Commits

Reviewing files that changed from the base of the PR and between b2a83b4 and 292d697.

📒 Files selected for processing (1)
  • src/nc3_testing_platform/domains/assets/examples.py

📝 Walkthrough

Walkthrough

The change updates statement API error documentation, documents the computed ScanResult.trend field, and adds deterministic revoked-feed and canceled-job examples for corresponding endpoints.

Changes

Response examples

Layer / File(s) Summary
Deterministic endpoint response examples
src/nc3_testing_platform/domains/assets/..., src/nc3_testing_platform/domains/scans/...
Asset-feed revocation returns a deterministic revoked feed. Scan cancellation returns a canceled job with its cancellation reason. Challenge timestamps use a dedicated request timestamp.

Scan result trend documentation

Layer / File(s) Summary
ScanResult.trend contract
docs/reference/api-design-v4_0_1.md, docs/reference/data-model-v4_0_1.md
The references document trend direction, signed deltas, compared-result identity, read-time computation, and null behavior. They state that the value is not persisted.

Statements API contract

Layer / File(s) Summary
Statements error response contract
api/openapi.json
The GET /api/v1/statements contract no longer declares a generic 500 Internal Server Error response.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: nicky-mezzina-lhc

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the documentation and mock-fixture follow-up changes described in the pull request objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/199-docs-and-fixture-coherence

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/nc3_testing_platform/domains/assets/examples.py`:
- Around line 35-37: The example configuration must ensure the challenge remains
answerable through the _T1 recheck. Add an assertion near
_CHALLENGE_REQUESTED_AT that the computed token expiration, token_expires_at, is
later than _T1, while preserving the existing TTL behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9c29e532-a088-4fe3-99b2-e8cb386d9cf1

📥 Commits

Reviewing files that changed from the base of the PR and between fe4c97f and b2a83b4.

📒 Files selected for processing (8)
  • api/openapi.json
  • docs/reference/api-design-v4_0_1.md
  • docs/reference/data-model-v4_0_1.md
  • src/nc3_testing_platform/domains/assets/examples.py
  • src/nc3_testing_platform/domains/assets/router.py
  • src/nc3_testing_platform/domains/scans/examples.py
  • src/nc3_testing_platform/domains/scans/router.py
  • src/nc3_testing_platform/domains/statements/router.py
💤 Files with no reviewable changes (2)
  • api/openapi.json
  • src/nc3_testing_platform/domains/statements/router.py

Comment thread src/nc3_testing_platform/domains/assets/examples.py
VERIFICATION_TOKEN_TTL is env-configurable; a short TTL would silently
recreate the pending-with-unanswerable-challenge incoherence this branch
fixes. The invariant now fails at import instead (CodeRabbit round 1).
@t0kubetsu

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@t0kubetsu

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@t0kubetsu t0kubetsu left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ECC review (/code-review, PR mode): clean — no findings above LOW. Validation green on the branch (ruff, pyright, 103 tests, OpenAPI regenerated in sync). Docs/trend semantics match the computed-not-stored pattern; the new fixtures cover the canceled-job and revoked-feed shapes clients must render. Advisory only: merge still waits on Nicky's review. Artifact: .claude/reviews/pr-12-review.md.

@t0kubetsu

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@t0kubetsu

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant