service-layer.md documents permission → mutate → audit → side effects, but actual code consistently does audit last
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- documentation
Research direction
Start with docs/specifications/service-layer.md and compare its ordering statement with the cited functions in src/lib/services/documents.ts, collections.ts, and records.ts. Spot-check additional write services to verify the audit-last pattern, then update the specification and confirm no reviewed service contradicts it.
Written by the indexing model from the issue text.
Description
docs/specifications/service-layer.md documents the fixed order as permission check → mutate → logAudit → any other required side effect. In practice, nearly every write service function does logAudit last, after its other side effects, not third — consistently, across files:
documents.tscreateDocument: mutate (:175-186) →recordCatalogDocumentCreated(:188-196) → access grant (:198-204) →logAudit(:206)collections.tscreateCollection: mutate (:124-130) →recordCatalogCollectionCreated(:132-138) → grant (:140-145) →logAudit(:147)records.tsdeleteRecord: mutate (:751) →releaseRecordLocator(:757-761) →logAudit(:762)
This is internally consistent across the codebase, so it reads as the spec's wording being imprecise rather than N independent implementation bugs — correcting the spec's text to describe actual (working, consistent) practice is far cheaper and lower-risk than reordering every write function for a pure documentation mismatch with no behavior change.
Surfaced during the 2026-09-12 architecture audit (code-level scan of src/lib/services).
- Update
service-layer.md's documented order to: permission check → mutate → other required side effects →logAudit(audit last, capturing the fully-completed operation) — or, if there's a real reason audit should come before side effects that the code is currently violating, flag that as a genuine bug instead and fix the code, not the spec - Spot-check a few more service functions beyond the three cited here to confirm the "audit last" pattern holds broadly before finalizing the spec wording
Done when: service-layer.md's documented order matches actual, verified practice, with no remaining files found to contradict it.
Priority: P2 — documentation accuracy, no behavior change expected (pending the spot-check confirming no real bug exists). Added to 0.5.0 — Stability, Reliability, and QA as part of this release's service-layer consolidation work.
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 1
- Avg merge
- 3h 53m
- Merged PRs (30d)
- 124
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from brylie/compendium
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
brylie/compendium#313 · 2 comments ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
brylie/compendium#294 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
brylie/compendium#250 · 1 comment ·
-
enhancement help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
brylie/compendium#233 · 2 comments ·
-
enhancement help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
brylie/compendium#221 · 2 comments ·
All issues in brylie/compendium
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100