Let plugins declare the header artifact indicator per variant kind

Open
#90 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
fastapi, python
Domain
backend, devtools

Research direction

Start with the plugin registry in server/orcaster_server/plugins.py and the artifact indicator logic in server/orcaster_server/api/admin_ui.py; read the existing hook validation and tests. Trace how registry declarations reach the header and how workspace tasks are queried. Done means the acceptance criteria pass, README.md and server/.env.example document the behavior, and the CHANGELOG records the compatibility note.

Written by the indexing model from the issue text.

Description

enhancement P3 question server

Problem

The dashboard header artifact indicator (produced and uploaded) is configured by two global settings: ARTIFACT_INDICATOR_SUFFIX and ARTIFACT_INDICATOR_SYNC_STATUS_PATH (server/orcaster_server/config.py:257-263). When the suffix is set, the indicator is shown in every workspace (server/orcaster_server/api/admin_ui.py:308-314, server/orcaster_server/templates/base.html:70).

  • produced counts artifacts whose path ends in the suffix, in the active workspace (server/orcaster_server/api/admin_ui.py:1057-1066). The query does not filter by tool, so it counts any task of any kind that writes a file with that suffix.
  • uploaded comes from one global status file (server/orcaster_server/api/admin_ui.py:2771).

The indicator belongs to one tool, but the core cannot say which. A workspace that only runs other tools still shows the indicator, with numbers that are not about its work.

The core already knows the tool of each task: tasks.variant_kind is set by a plugin extractor and indexed with tasks_variant_idx (server/orcaster_server/models.py:398-409). The plugin registry has add_variant_extractor, add_outcome_defaults and add_legacy_status_alias (server/orcaster_server/plugins.py:103, :119, :135), but no hook for the indicator.

Proposed change

  1. Add a registry hook, for example registry.add_artifact_indicator(kind, suffix, sync_status_path=None). The plugin declares the kind and the suffix. sync_status_path is only a default: the status file is written by an external sync job, so its path stays an operator setting. Validate it like the other hooks and raise PluginError when:
    • kind has no registered extractor (checked in validate());
    • the kind already has an indicator;
    • suffix is empty or not a string, or sync_status_path is not a string or None.
  2. Expose the declared indicators on the frozen Registry.
  3. Add t.variant_kind = :kind to the produced query when the indicator comes from a plugin.
  4. Read uploaded from ARTIFACT_INDICATOR_SYNC_STATUS_PATH when it is set, otherwise from the sync_status_path of the declaration.
  5. Show the indicator only in a workspace that has tasks of the declared kind (see Open questions). Other workspaces show the rest of the header unchanged, including the storage indicator.
  6. Document the hook in the plugin section of README.md (next to README.md:420), and the fallback in server/.env.example.

Compatibility

Existing deployments configure the indicator with the two env vars, and their plugins do not call the new hook yet.

Guard:

  • The hook is additive. Plugins that do not call it keep loading.
  • If no plugin declares an indicator and the env vars are set, the server keeps today's behavior: global suffix, global status file, indicator in every workspace. It logs one startup WARNING that names the new hook.
  • If a plugin declares an indicator, the declared kind and suffix win over ARTIFACT_INDICATOR_SUFFIX, with a startup WARNING that says so. ARTIFACT_INDICATOR_SYNC_STATUS_PATH, when set, still overrides the declared path, so uploaded keeps reading the file that the existing sync job writes.
  • When a plugin declares an indicator, produced no longer counts artifacts of tasks whose variant_kind is NULL. Existing rows keep the value they got at creation and are not backfilled (server/orcaster_server/models.py:397-409), so tasks created before the plugin had an extractor, or that no extractor recognized, drop out of the count. In existing workspaces produced can go down once the plugin declares. The release note says so.
  • A workspace allow-list setting for the sync status (for example ARTIFACT_INDICATOR_SYNC_WORKSPACES, proposed separately) still applies when a plugin declares: uploaded is shown only in a workspace that is on the list and has tasks of the declared kind. The declaration does not override the list.
  • No database migration: variant_kind already exists and is indexed.
  • The ARTIFACT_INDICATOR_SUFFIX fallback is removed only in a later release, announced in the CHANGELOG. ARTIFACT_INDICATOR_SYNC_STATUS_PATH stays as an operator override.

Acceptance criteria

  • The registry exposes the hook. Tests cover an unknown kind, a duplicate declaration and invalid values, each raising PluginError.
  • Test: with a declared indicator, produced does not count artifacts with the suffix from tasks of another kind.
  • Test: a workspace with tasks of the declared kind shows the indicator, and a workspace without them does not.
  • Test: with the env vars set and no declaration, the indicator output is identical to today and a startup WARNING names the hook.
  • Test: with both a declaration and the env vars, the declared kind and suffix win and a WARNING is logged.
  • Test: with a declaration and ARTIFACT_INDICATOR_SYNC_STATUS_PATH set, uploaded reads the env path, not the declared one.
  • Test: with a declared indicator, an artifact with the suffix from a task whose variant_kind is NULL is not counted in produced. The release note states that produced can go down in existing workspaces.
  • Test: with a declared indicator and a workspace allow-list setting, uploaded is shown only in a listed workspace that has tasks of the declared kind.
  • Existing deployments keep working without config changes.
  • README.md documents the hook and server/.env.example marks ARTIFACT_INDICATOR_SUFFIX as a fallback and ARTIFACT_INDICATOR_SYNC_STATUS_PATH as an override.
  • CHANGELOG entry under Unreleased.

Open questions

  • Visibility rule: show the indicator when the workspace has any task of the declared kind, or only when produced > 0?
  • In which release is the ARTIFACT_INDICATOR_SUFFIX fallback removed? Keeping it for at least one release lets existing deployments upgrade the server before their plugin registers the hook.
  • Should one kind be able to declare more than one indicator?
Dominant language
Python
Stars
0
Forks
0
Avg merge
1d 1h
Merged PRs (30d)
10

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AInvirion/orcaster

All issues in AInvirion/orcaster

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.