Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

CW-051 · Publish labour aggregates to the ecosystem

Open
#51 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
postgresql, typescript
Domain
api, backend, data

Research direction

Read docs/labour-data-contract.md first, then inspect the existing outbox described by CW-006 and the payroll and attendance flows. Implement the versioned labour-data/1.0 emissions and replay behavior described there, and use the acceptance criteria to verify suppression, reconciliation, revisions, privacy, unmapped centres, and idempotent replay.

Written by the indexing model from the issue text.

Description

P3 payroll phase-E

Priority P3 · Area payroll · attendance · Estimate L · Phase E (ecosystem)

What to build

Implements docs/labour-data-contract.md, whose every decision was settled on 2026-09-25. Read it first — this ticket does not restate it.

Nothing is waiting on this. The consuming ERP feature is Enterprise-edition work scheduled after ERP v1. It is written now because the decisions are fresh, not because there is a date. Cwork itself is and remains entirely Apache 2.0; that edition split is the ERP's, and the contract is a documented public interface any other consumer may implement against.

  • A costCentre → locationCode mapping, maintained in Cwork, many-to-one — Cwork owns the cost centre, so it owns the mapping.
  • labour.cost.period_closed when a payroll run closes; labour.hours.day_locked when attendance for a day is locked.
  • Suppression at LABOUR_MIN_GROUP (5), merging into UNALLOCATED, pulling the next-smallest group in when that bucket would come from fewer than two — otherwise subtracting the published groups from the total reveals the number the rule exists to hide.
  • Revisions: revision, previousRevision, and the revision inside the idempotency key. Without it a restatement looks exactly like a duplicate of the figure it corrects and is discarded by the mechanism meant to make delivery safe.
  • Emission through the existing outbox (CW-006), to a consumer holding a scoped, revocable machine credential whose every call is audited.
  • A replay endpoint by period, not a cursor: the aggregates are recomputed from stored payroll and attendance, so replay is idempotent and cheap.
  • Versioned labour-data/1.0, independently of Cwork's 0.x.

Acceptance criteria

  • No employee identity and no individual pay appears in any emission — a test puts distinctive names, ids and salaries in the fixture and asserts none of them reaches an event.
  • A cost centre of four people is suppressed, and the totals still reconcile: published plus UNALLOCATED equals the period.
  • UNALLOCATED never represents a single group.
  • Re-closing a period emits revision 2 carrying full figures, and a consumer that never saw revision 1 can use it as an opening position.
  • An unmapped cost centre is emitted with locationCode: null, not dropped.
  • Replaying a period twice changes nothing on the consumer's side.

Blocked by

None technically. By sequence it sits behind the phase 3 filings and the other phase E tickets — #48, #50, then #49 after #43.

Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
1d 15h
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 SuruchBoss/Cwork

All issues in SuruchBoss/Cwork

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.