Skip to content

feat(audit): record an audit-log entry when an appointment is cancelled (AURORA-2) - #19

Merged
evg-g merged 5 commits into
mainfrom
story/AURORA-2
Oct 3, 2026
Merged

evg-g merged 5 commits into
mainfrom
story/AURORA-2

Conversation

@evg-g

@evg-g evg-g commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

ADLC proof report — AURORA-2 — appointments-api

Built by adlc-report.sh from the proof log, not from agent summaries.
Final tree: eca58022bc72c4392946bdd5813637f902107744. Proven: 3. Flagged: 0.

criterion surface assertion proof test verdict evidence
AC1.data [data] test_ac1_data_failed_cancel_commit_leaves_no_audit_row proven red at 37fa086ae6cc → green at eca58022bc72; red because: get_audit_log_repository builds the AuditLogRepository on its own session from app.state.sessionmaker and commits it independently at dependency exit, so the audit row survives when the request's cancel COMMIT fails
AC2.api [api] test_ac2_api_admin_reads_cancel_entry_and_filters_by_entity proven red at acd220504a5b → green at eca58022bc72; red because: deliberate break: AuditLogRepository.list_entries ignores the entity_id filter, so ?entity_id=X also returns Y
AC3.data [data] test_ac3_data_refused_cancel_records_no_audit_row proven red at 7f791195435c → green at eca58022bc72; red because: deliberate break: cancel handler records and commits an audit row right after the 404 check, before the 403/428/412/409 refusals

Proof log: /home/evgenig/.adlc/home__evgenig__aurora__appointments-api/proof-log.jsonl

Note — older behaviour, outside this ticket

Found while proving AC1.data, not introduced by this PR: get_session (src/appointments_api/db.py:40-49) commits in the yield-dependency exit, which FastAPI 0.141.1 runs after the response is sent. A request whose COMMIT fails still returns its success response (e.g. 200 with a CANCELLED body), while the database keeps the old state. This affects every write endpoint. The audit row stays consistent with the appointment either way (test_ac1_data_failed_cancel_commit_leaves_no_audit_row). Left for a separate ticket.

🤖 Generated with Claude Code

evg-g and others added 3 commits October 3, 2026 19:59
ADR 0016 records the audit-log write on appointment cancel: a small audit
service over an AuditWriter Protocol, a typed AuditAction enum, and the write
in the same transaction as the cancel. CONTEXT.md starts the domain glossary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cancel

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
entity_id: str,
before: dict[str, Any] | None,
after: dict[str, Any] | None,
) -> None: ...
evg-g and others added 2 commits October 3, 2026 20:19
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@evg-g
evg-g marked this pull request as ready for review October 3, 2026 17:29
@evg-g evg-g changed the title AURORA-2: Record an audit-log entry when an appointment is cancelled feat(audit): record an audit-log entry when an appointment is cancelled (AURORA-2) Oct 3, 2026
@evg-g evg-g closed this Oct 3, 2026
@evg-g evg-g reopened this Oct 3, 2026
@evg-g
evg-g merged commit 8b56014 into main Oct 3, 2026
24 of 25 checks passed
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.

2 participants