feat(server): source-tagged logs and parameterized scheduled jobs#149
Merged
Conversation
Two gaps surfaced running CcasServer in the foreground.
Log attribution: every app/job logged to one undifferentiated console
stream. Reuse ZIO log annotations (the formatter already rendered them,
nothing set them): ProgressDisplay.sourced sets a reserved `src` key that
`format` renders as a bracketed prefix, so lines read `[INFO ..] [Kind/slug]
msg`. JobRunner tags each job at its single submit choke point (slug best-
effort, `#id` fallback); rate-limit warnings tag `[rate-limit]` and scheduler
poll logs `[scheduler]` so global logs stay attributable even on a job fiber.
No-annotation path is byte-identical, so CLI apps are untouched.
Scheduled params: job_schedule.params was stored but the scheduler ignored
it, forcing hardcoded defaults (e.g. a full ClubData refresh every tick).
New ScheduleParams decodes per-kind option DTOs and threads them into the
app calls; absent params decode to the previous defaults exactly. Decoding
is eager (before submit) so a malformed row is isolated by the existing poll
guard without advancing last_run_at. Recruitment caps move to a shared
JobCaps so the HTTP and scheduled paths bound identically. Author via the
existing flag: `schedule add clubData --params '{"minAgeHours":24}'`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two improvements surfaced by running
CcasServerin the foreground.Log source attribution. Every app/job logged to one undifferentiated console stream. Reuses ZIO log annotations (the formatter already rendered them; nothing set them):
ProgressDisplay.sourcedsets a reservedsrckey thatformatrenders as a bracketed prefix — lines now read[INFO 14:03:22] [Membership/london-cc] msg.[Kind/slug]atJobRunner.submit(single choke point; slug best-effort,#idfallback, kind-only for global jobs).[rate-limit], scheduler poll logs[scheduler]— attributable even when running on a job's fiber.Parameterized scheduled jobs.
job_schedule.paramswas stored but the scheduler ignored it, forcing hardcoded defaults (e.g. a fullClubDatarefresh every tick). NewScheduleParamsdecodes per-kind option DTOs and threads them into the app calls.submit), so a malformed row is isolated by the existing poll guard without advancinglast_run_at.JobCapsso the HTTP and scheduled paths bound identically.schedule add clubData --interval-hours 24 --params '{"minAgeHours":24}'.minAgeHoursis opt-in (deriving from the interval would skip every club forever on a steady cadence).Fixes
None (no linked issue).
Testing
sbt test— 1013 pass, 0 fail (pre-push hook + local).TestScheduleParams(decode defaults / populated / malformed / stats both-or-neither).TestProgressBar+1 (srcrenders as prefix, other annotations stay trailing).TestJobScheduler+2 (params reachsubmit; malformed row doesn't block other schedules).[INFO ..] [MatchRef] hello from job.🤖 Generated with Claude Code