Source refs, JSON uploads and de-duplication #32

Merged
Gilles merged 9 commits from feat/28-sources-json-dedup into master 2026-10-28 22:34:03 +00:00
Owner

Closes #28

Part of the server monitoring plan (phase 1.3). Stacked on #31 (base feat/27-authentik-group-access): merge #30 and #31 first.

Changes

  • Report.RefKind.SOURCE (source): ref_value names a machine or tool (garion, kuma…). Migrations only alter choices (reports and events) and add Report.last_seen_at.
  • Upload endpoint: a JSON body {"report_type": "custom", …, "report": {…}} is accepted instead of a file (custom reports only; exactly one of file/report). commit_sha is optional; without it the raw file goes to <owner>/<repo>/<ref_kind>-<ref_value>/<timestamp>/…, so uploads never overwrite each other.
  • Format maison: optional metric key (JSON/YAML/XML), report-level expect_every parsed by the new apps.reports.durations and stored in the summary in seconds (dropped when unparseable). Unknown to older clients, nothing breaks.
  • De-duplication (process_report): on a source ref, a report without detail whose status and summary equal the latest processed report of the same stream is deleted (row + raw file); that report's last_seen_at moves forward instead. No event, no aggregate recompute. Branch/commit/PR reports are never de-duplicated.
  • prune_history also bounds source refs; event subjects read "source garion".
  • argus/upload-action needs no change (it always sends a commit).
  • README: how to push from a script; feature catalog entries; tests in apps/reports/test_sources.py.

Checks

pytest (209 passed), pylint 10/10, autopep8, bandit clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA

Closes #28 Part of the server monitoring plan (phase 1.3). **Stacked on #31** (base `feat/27-authentik-group-access`): merge #30 and #31 first. ## Changes - `Report.RefKind.SOURCE` (`source`): `ref_value` names a machine or tool (`garion`, `kuma`…). Migrations only alter `choices` (reports and events) and add `Report.last_seen_at`. - Upload endpoint: a JSON body `{"report_type": "custom", …, "report": {…}}` is accepted instead of a file (custom reports only; exactly one of `file`/`report`). `commit_sha` is optional; without it the raw file goes to `<owner>/<repo>/<ref_kind>-<ref_value>/<timestamp>/…`, so uploads never overwrite each other. - Format maison: optional metric `key` (JSON/YAML/XML), report-level `expect_every` parsed by the new `apps.reports.durations` and stored in the summary in seconds (dropped when unparseable). Unknown to older clients, nothing breaks. - De-duplication (`process_report`): on a `source` ref, a report without detail whose status and summary equal the latest processed report of the same stream is deleted (row + raw file); that report's `last_seen_at` moves forward instead. No event, no aggregate recompute. Branch/commit/PR reports are never de-duplicated. - `prune_history` also bounds `source` refs; event subjects read "source garion". - `argus/upload-action` needs no change (it always sends a commit). - README: how to push from a script; feature catalog entries; tests in `apps/reports/test_sources.py`. ## Checks pytest (209 passed), pylint 10/10, autopep8, bandit clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA
feature: source refs, JSON uploads and de-duplication
Some checks failed
ci / test (pull_request) Failing after 3m3s
ci / e2e (pull_request) Has been skipped
ci / docker (pull_request) Has been skipped
ci / deploy (pull_request) Has been skipped
5f84d1a5b5
- ref_kind=source (a machine or tool name), allowed on any project.
- The upload endpoint also takes a JSON body with the "format maison"
  report itself, no file; commit_sha becomes optional (a commit-less
  upload gets its own storage directory).
- Format maison: optional stable metric `key`, and `expect_every`
  (90s/15m/1h/7d...) kept in the summary in seconds.
- On a source ref, a report identical to the latest one of its stream
  is dropped and only moves that one's new last_seen_at forward.
- History pruning also bounds source refs.

Closes #28

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA
Author
Owner
<!-- argus-link-bot:argus/backend --> 📊 [Rapports Argus pour cette PR](https://reports.stationmyr.net/argus/backend/pr/32)
Merge branch 'feat/27-authentik-group-access' into feat/28-sources-json-dedup
All checks were successful
ci / test (pull_request) Successful in 3m11s
ci / e2e (pull_request) Has been skipped
ci / docker (pull_request) Has been skipped
ci / deploy (pull_request) Has been skipped
790efa831d
Merge branch 'feat/27-authentik-group-access' into feat/28-sources-json-dedup
All checks were successful
ci / test (pull_request) Successful in 3m10s
ci / e2e (pull_request) Has been skipped
ci / docker (pull_request) Has been skipped
ci / deploy (pull_request) Has been skipped
31e47f6e55
Gilles changed target branch from feat/27-authentik-group-access to master 2026-10-28 19:03:51 +00:00
Merge remote-tracking branch 'origin/master' into feat/28-sources-json-dedup
Some checks failed
ci / test (pull_request) Has been cancelled
ci / e2e (pull_request) Has been cancelled
ci / docker (pull_request) Has been cancelled
ci / deploy (pull_request) Has been cancelled
ccfdb6546a
# Conflicts:
#	README.md
fix: drop the access-groups block the master merge duplicated in the feature catalog
All checks were successful
ci / test (pull_request) Successful in 3m10s
ci / e2e (pull_request) Has been skipped
ci / docker (pull_request) Has been skipped
ci / deploy (pull_request) Has been skipped
6b50d3da9a
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA
Gilles merged commit 6a9da6891c into master 2026-10-28 22:34:03 +00:00
Gilles deleted branch feat/28-sources-json-dedup 2026-10-28 22:34:03 +00:00
Gilles referenced this pull request from a commit 2026-10-29 06:56:29 +00:00
Sign in to join this conversation.
No description provided.