Skip to content

refactor(backend): separate runtime artifacts from source tree#549

Open
Benedict315 wants to merge 1 commit into
OlufunbiIK:mainfrom
Benedict315:main
Open

refactor(backend): separate runtime artifacts from source tree#549
Benedict315 wants to merge 1 commit into
OlufunbiIK:mainfrom
Benedict315:main

Conversation

@Benedict315
Copy link
Copy Markdown

@Benedict315 Benedict315 commented Apr 29, 2026

Problem

Generated and runtime artifacts (audit logs, coverage reports) were being written directly into source directories, polluting the backend source tree with transient files.

Solution

  • Created backend/reports/ directory as a dedicated location for runtime artifacts
  • Updated eventStore.ts and report.ts to output to backend/reports/ instead of backend/src/audit-trail/
  • Updated .gitignore to exclude generated artifacts from the source tree while keeping the reports directory tracked via .gitkeep
  • Updated README.md to document the new artifact locations

Changes

  • Created: backend/reports/.gitkeep
  • Modified: .gitignore - added patterns for runtime artifacts
  • Modified: backend/src/audit-trail/eventStore.ts - changed log output path
  • Modified: backend/src/audit-trail/report.ts - changed report output path
  • Modified: backend/src/audit-trail/README.md - documented artifact locations

Verification

  • No CI impact - coverage and build outputs remain unaffected
  • Code automatically creates reports/ directory if missing
  • Existing .gitignore patterns for coverage/ and dist/ remain intact

Closes issue #477

Summary by CodeRabbit

  • Documentation

    • Added audit trail system documentation detailing generated runtime artifacts and their storage locations.
  • Chores

    • Reorganized backend artifact storage to a centralized reports directory.
    • Updated configuration to exclude generated backend artifacts and coverage data from version control.

- Create backend/reports/ directory for runtime artifacts
- Update eventStore.ts and report.ts to output to backend/reports/
- Update .gitignore to exclude generated artifacts from source tree
- Update README.md with new artifact locations

No CI impact - coverage and build outputs remain unaffected.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

@Benedict315 is attempting to deploy a commit to the olufunbiik's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

📝 Walkthrough

Walkthrough

The PR reorganizes audit trail runtime artifacts from the source tree into a dedicated backend/reports/ directory. It updates .gitignore to exclude reports and audit files, adds a .gitkeep file to track the new directory, and modifies audit-trail module paths to write artifacts to the new location.

Changes

Cohort / File(s) Summary
Audit Artifact Directory Structure
.gitignore, backend/reports/.gitkeep, backend/src/audit-trail/README.md
Updated .gitignore to exclude backend/reports/ and audit-specific output files while preserving the directory via .gitkeep. Added documentation describing audit trail runtime artifacts and their storage location.
Audit Trail Module Path Updates
backend/src/audit-trail/eventStore.ts, backend/src/audit-trail/report.ts
Migrated audit log path from module-local to ../../reports/audit.log and report output path to ../../reports/audit-report.json. Both modules now verify/create the target reports directory at initialization before writing.
Removed Artifacts
backend/src/audit-trail/audit-report.json
Deleted previously stored audit report sample containing metadata and event summary.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • Issue #477: The changes directly address relocating audit trail runtime artifacts from source tree to backend/reports/, including creation of .gitkeep, updates to .gitignore, audit-trail README documentation, and path modifications in audit-trail source files.

Poem

🐰 Hop hop, files now roam free,
To reports directory they flee,
Audit logs find their nest,
Away from source—what's best!
Tidy burrows, tidy trees. 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'refactor(backend): separate runtime artifacts from source tree' accurately and specifically summarizes the main change: moving generated runtime artifacts out of the source directories into a dedicated backend/reports/ directory.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@backend/src/audit-trail/eventStore.ts`:
- Around line 5-6: The retention logic is pointed at the old file path; update
enforceRetention() in retention.ts to use the same audit log location as
eventStore (either import LOG_PATH from eventStore.ts or compute path using
REPORTS_DIR: path.join(__dirname, '..', '..', 'reports', 'audit.log')) so the
function reads backend/reports/audit.log and correctly applies retention to real
audit data.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8fa76123-d1ec-48bd-89b4-5136b1c31c10

📥 Commits

Reviewing files that changed from the base of the PR and between b356a85 and 935f139.

📒 Files selected for processing (6)
  • .gitignore
  • backend/reports/.gitkeep
  • backend/src/audit-trail/README.md
  • backend/src/audit-trail/audit-report.json
  • backend/src/audit-trail/eventStore.ts
  • backend/src/audit-trail/report.ts
💤 Files with no reviewable changes (1)
  • backend/src/audit-trail/audit-report.json

Comment thread backend/src/audit-trail/eventStore.ts
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