Skip to content

Add native buffered file subscriber#60

Merged
brickfrog merged 3 commits into
mainfrom
main.cg9-6-file-subscriber-1780317740000-22209-0
Jun 1, 2026
Merged

Add native buffered file subscriber#60
brickfrog merged 3 commits into
mainfrom
main.cg9-6-file-subscriber-1780317740000-22209-0

Conversation

@brickfrog

Copy link
Copy Markdown
Owner

Summary

  • Add the new brickfrog/moontrace/file package with a sync non-blocking subscriber, bounded async drain worker, flush/shutdown lifecycle, counters, size rotation, retention cleanup, and optional gzip for rotated files.
  • Keep async and filesystem work confined to src/file with native implementation and clear unsupported-target lifecycle stubs for non-native targets.
  • Add native timeout-bounded async tests for append ordering, rotation, retention, gzip round trip, bounded batching, overflow drops, and graceful shutdown; add docs showing app-owned worker wiring.

TDD

  • Recorded tdd_intent for moontrace-cg9.6 file subscriber.
  • Recorded red with a real overflow-counter mutation: the file-subscriber test failed with dropped count 0 != 2.
  • Restored the implementation and recorded green, then done.

Verification

  • moon fmt --check
  • moon test --target native
  • moon build --target native --release
  • moon check --target all src/file
  • moon info && moon fmt (no extra changes)

Verification

Generated by Choir from commands executed in the leaf workspace.

  • moon fmt --check
    • exit: 0
    • head: a6a572c
    • output tail:
Finished. moon: no work to do
  • moon test --target native
    • exit: 0
    • head: a6a572c
    • output tail:
Total tests: 272, passed: 272, failed: 0.
  • moon build --target native --release
    • exit: 0
    • head: a6a572c
    • output tail:
Finished. moon: no work to do

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: GitHub Actions rollup reports all checks successful on the latest head — re-check review/merge policy on GitHub (not an approval or merge signal by itself).

Copilot AI 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.

Pull request overview

Adds a new native-only buffered file subscriber package (brickfrog/moontrace/file) that provides a synchronous, non-blocking enqueue API and an app-owned async worker to drain events to disk with size-based rotation, retention cleanup, and optional gzip for rotated files.

Changes:

  • Introduce src/file package with FileSubscriber + FileSubscriberConfig, async run/flush/shutdown, counters, rotation/retention, and gzip for rotated logs.
  • Add native async tests covering ordering, rotation/retention, gzip round-trip, bounded batching, overflow drops, and shutdown behavior.
  • Add user documentation describing intended wiring (app-owned worker) and rotation semantics.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/file/pkg.generated.mbti Exposes the new package API surface (subscriber constructor, lifecycle, counters, config).
src/file/moon.pkg Declares async/fs/gzip/io dependencies for the new file subscriber package.
src/file/file_subscriber.mbt Implements the native buffered file subscriber, worker drain loop, rotation/retention, gzip, and non-native stubs.
src/file/file_subscriber_test.mbt Adds native tests validating ordering, rotation/retention, gzip, batching/overflow, and shutdown semantics.
docs/file.md Documents how to wire the subscriber/worker and explains rotation + gzip behavior.

Comment thread src/file/file_subscriber.mbt
@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: comment-only review received — routed to main.cg9-6-file-subscriber-1780317740000-22209-0 (leaf pane).

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: GitHub Copilot issue-thread comment observed on PR — parent notified with updated gate snapshot (not merge approval).

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: comment-only review received — routed to main.cg9-6-file-subscriber-1780317740000-22209-0 (leaf pane).

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: fixes pushed by main.cg9-6-file-subscriber-1780317740000-22209-0 — resolving threads and checking gates (not merged yet).

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: GitHub Actions rollup reports all checks successful on the latest head — re-check review/merge policy on GitHub (not an approval or merge signal by itself).

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: fixes pushed by main.cg9-6-file-subscriber-1780317740000-22209-0 — resolving threads and checking gates (not merged yet).

@brickfrog

Copy link
Copy Markdown
Owner Author

Choir: GitHub Actions rollup reports all checks successful on the latest head — re-check review/merge policy on GitHub (not an approval or merge signal by itself).

@brickfrog brickfrog merged commit 4793a87 into main Jun 1, 2026
1 check passed
@brickfrog brickfrog deleted the main.cg9-6-file-subscriber-1780317740000-22209-0 branch June 1, 2026 13:23
@brickfrog brickfrog mentioned this pull request Jun 1, 2026
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