Repository navigation
fix(company-os): every service writes its audit row by default, and a failed audit fails the operation (#20101) - #20426
Conversation
… failed audit write fails the operation (#20101)
… issue-20101-activity-default # Conflicts: # autobot-backend/llc/api/sprints.py # autobot-backend/llc/services/sprint_autoclose.py # scripts/python_file_size_known_large.py
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 14 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
Auto-sync: merging
|
| side | commit | subject | issue refs |
|---|---|---|---|
| main | ac18f28f3 |
Merge #20684 @ e17171d into the merge train | #20684 |
| main | 8d5876690 |
Merge #20672 @ 430178c into the merge train | #20672 |
| main | e17171d9e |
Merge main into issue-19725-lazy-collections (auto-sync) [skip ci] | none |
| main | 3f372114e |
Merge #20540 @ e474ca5 into the merge train | #20540 |
| main | 1aa2d0e7d |
chore(merge): merge origin/main into issue-20234-file-cleanup-proposals (#20234) | #20234 |
| main | 470afb93e |
Merge main into issue-19725-lazy-collections (auto-sync) [skip ci] | none |
| main | 430178c05 |
Merge main into issue-19726-bm25-refresh (auto-sync) [skip ci] | none |
| main | 3e7dc5531 |
Merge main into issue-19725-lazy-collections (auto-sync) [skip ci] | none |
| main | b1d49e90a |
Merge main into issue-19726-bm25-refresh (auto-sync) [skip ci] | none |
| main | a9185a872 |
fix(kb): a collection appears on its first write, not with its entity (#19725) | #19725 |
| main | fcb856a7e |
fix(kb): writes share one corpus-stats recompute instead of one each (#19726) | #19726 |
| main | 607c06e5d |
Merge main into issue-20234-file-cleanup-proposals (auto-sync) [skip ci] | none |
| main | 941e1e8de |
chore(merge): merge origin/main into issue-20234-file-cleanup-proposals (#20234) | #20234 |
| main | 2d1fa12e0 |
fix(chat): keep _hard_delete_file, note it is unwired behind the gate (#20234) | #20234 |
| main | e6caf4c5a |
fix(chat): re-propose failed or expired file cleanups, gate hard_delete bytes (#20234) | #20234 |
| main | 3 more commit(s) not listed | ||
| this branch | 6d40f13cd |
Merge main into issue-20101-activity-default (auto-sync) [skip ci] | none |
| this branch | 18b23a2a4 |
refactor(company-os): move the sprint org guard out of the routes, keeping the ceiling (#20101) | #20101 |
| this branch | 93aef44fc |
Merge remote-tracking branch 'origin/main' into issue-20101-activity-default | none |
| this branch | 651638dfe |
Merge main into issue-20101-activity-default (auto-sync) [skip ci] | none |
| this branch | d33a41329 |
Merge main into issue-20101-activity-default (auto-sync) [skip ci] | none |
| this branch | 33a84fbd0 |
Merge main into issue-20101-activity-default (auto-sync) [skip ci] | none |
| this branch | ea7c78d92 |
Merge remote-tracking branch 'origin/main' into issue-20101-activity-default | none |
| this branch | 880bbd6cd |
Merge remote-tracking branch 'origin/main' into issue-20101-activity-default | none |
| this branch | c7f0f9532 |
Merge remote-tracking branch 'origin/issue-8214-approval-reland' into issue-20101-activity-default | none |
| this branch | 695744122 |
fix(company-os): role assignment test stays at its ceiling, and open audit rows name #20417 (#20101) | #20417, #20101 |
| this branch | b337b465f |
fix(company-os): every service writes its audit row by default, and a failed audit write fails the operation (#20101) | #20101 |
…default # Conflicts: # scripts/python_file_size_known_large.py
…eping the ceiling (#20101)
|
Code review on PR #20426 (head b690d1e): APPROVE Delta since the reviewed head 93aef44: one own commit, 18b23a2 (sprint org guard moved into Reviewed: behaviour is identical to the inlined guard (same query, same
|
Refs #20101
Refs #8214
Follow-up: #20417, the services that still write no row. #20412, which this stacked on, has landed, so this diff is now its own.
Thinking Path
Most Company OS services never received an activity log and guarded each write with
if self.activity_log:, so audit writes silently did nothing. Making a real log the default removes that state. Once the log was always there, the guards turned out to have hidden calls that could never have worked.What Changed
services/base.py:LLCServiceBasebuilds a realLLCActivityLogServiceunless given one. Theif self.activity_log:guards are gone from 17 services andaudit().sprint_autoclose.pycalled.log(...)andportability.pycalled.append(...), neither of which exists.reporting_linepasseduser:<uuid>as an entity id;workflowpassed free text.TEMPLATE_PUBLISHEDandTEMPLATE_IMPORTEDwere referenced but undefined.handoff.py: three swallowed audit failures now fail the handoff withActivityRecordError.TemplateServicenow uses the base class.plan_convert.pyandcompany_os/workflows.pypass their log to child services.tests/company_os_e2e/_expected_activity.py: the goal row is asserted. Rows nothing writes yet now name bug(company-os): many services write no activity row at all, so the audit trail misses whole workflow steps #20417.services/portability.pyreached 601 lines after the merge, so_goal_titles_existmoved toPortabilityImportMixin.recordrejects anything else.From review, also fixed:
LLCActivityLogService.record, so all 40 raw call sites raiseActivityRecordErroron a failed write. A badactor_idstays aValueError, checked before the log is touched. A guard fails on any other way of writing a row.handoff.py: both directions audit before releasing the key or notifying, so a failed audit changes nothing.recordqueues them on the session, with commit and rollback listeners, so a rollback, or a savepoint rollback, publishes nothing.run_after_commitwouldn't work here, as most llc sessions don't useasync_session_scope.liveness_monitor.pynow has a real log and writes a valid row, and each run recovers in its own savepoint, so one failure doesn't hit the others. Its oldrecordcall would have raisedTypeError, hidden because no monitor was ever given a log. Its exemptions in the guards are gone.Behaviour changes to check:
agent.assignedrow.Verification
test_every_service_has_an_activity_log_20101.py: 15 tests with controls per detector.test_audit_rows_by_default_20101.py: 14 tests on a database, for goal, secret, label, relation and claim, each naming its actor, plus failed-write cases.mainat45f10d1773:llc/testsplustests/security, whole, 2934 passed, 2 skipped, 0 failed. The run still exits 1 because of a stub leak in a file this PR does not touch (test(security): test_onboarding_auth_regression leaks a hand-made onboarding.doctor module into sys.modules #18181).kb_summaryvalue fix(company-os): board approvals are enforced, and a hire happens only after approval (#8214) #20179 had moved. Fixed.Not established:
.returningon workflow delete. CI's end-to-end stack is the first Postgres run.liveness_monitor's savepoint, that a failed flush aborts a Postgres transaction, is a read of how Postgres behaves./ws/liveis tested through a spy.Model Used
Claude Sonnet 5 for implementation, Claude Opus 5.5 for direction and the merge
🤖 Generated with Claude Code