Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.

Add a Clockify platform lens - #24

Merged
michielbdejong merged 1 commit into
mainfrom
clockify-lens
Sep 21, 2026
Merged

michielbdejong merged 1 commit into
mainfrom
clockify-lens

Conversation

@michielbdejong

Copy link
Copy Markdown
Contributor

Summary

Phase A of the timesheet plugin's Project/Person enrichment (ontola/atomic-plugins#4). Adds platform-lenses/clockify/, mirroring the github-issues/google-calendar layout (lens/{types,projection}.ts, an index.ts re-export).

clockifyProjection previously lived only in atomic-plugins' integrations/clockify/localthought.ts, as a locally-duplicated implementation against a type triple structurally identical to but not derived from this repo's FetchedPlatform/FetchedRecord/Term contract. This migrates it here unchanged (same start/end-interval derivation, same break/running-timer handling) rather than continuing to extend the duplicate in place.

What's new

  • resolveClockifyReferences: a pure function matching each time entry's projectid/userid against project/member records fetched in the same batch — the lens-layer counterpart to the projectId/userId references localthought/overlays' Clockify crud-causality overlay now declares via CRUD Causality 0.3.0 (CRUD Causality: cross-resource references (foreign keys) pondersource/openapi-extensions#24, merged). It resolves identity only, the same way that spec's Reference Object does: a raw id with no matching record in the batch is a dangling reference (not fetched — archived, paginated out, etc.), reported as such rather than treated as an error.
  • Deliberately not included: allocating or writing an Atomic resource for the referenced project/member. That needs AtomicIdentityMap/AtomicLens (or equivalent), and stays with whichever layer owns identity and durable state for the imported table — this lens stays passive, per docs/atomic-data.md's "Passive platform lenses" contract (no dataset access, no identity lookups).

Verification

pnpm install --frozen-lockfile, pnpm lint, pnpm test, pnpm build all pass — 9 new tests (start/end derivation, break/running-timer skipping, project/member passthrough, reference resolution including the dangling case), 114 total, 0 new lint warnings.

Follow-up needed elsewhere

browser/data-browser/package.json in ontola/atomic-server pins devonian to a specific commit (github:localthought/devonian#fb415ef...), so platform-lenses/clockify won't be reachable there until that pin is bumped to a commit on main that includes this PR — same two-step pattern as localthought/overlays' catalog.json pin. Left that bump for a follow-up once this merges, rather than pointing it at an unmerged branch.


🤖 Generated with Claude Code

https://claude.ai/code/session_01Cng3r2ijbx8fBVZjLsEdH9


Generated by Claude Code

Phase A of the timesheet plugin's Project/Person enrichment
(ontola/atomic-plugins#4): migrates clockifyProjection out of
atomic-plugins' integrations/clockify/localthought.ts, where it lived
as a locally-duplicated implementation against a type triple
structurally identical to but not derived from this repo's own
FetchedPlatform/FetchedRecord/Term contract. Mirrors the
github-issues/google-calendar platform-lenses layout (lens/{types,
projection}.ts, an index re-export) rather than extending the
duplicate in place.

clockifyProjection's start/end-interval behavior is unchanged. Adds
resolveClockifyReferences, a pure function matching each time entry's
projectid/userid against project/member records fetched in the same
batch -- the counterpart, at the lens layer, to the projectId/userId
references localthought/overlays' Clockify crud-causality overlay now
declares via CRUD Causality 0.3.0 (pondersource/openapi-extensions#24).
It resolves identity only, same as that spec's Reference Object;
allocating or writing an Atomic resource for the referenced project or
member -- and fetching project/member in the first place -- stays
with whichever layer owns identity and durable state for the imported
table, not this lens.

pnpm lint / test / build all pass; 9 new tests, 114 total.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cng3r2ijbx8fBVZjLsEdH9
@michielbdejong
michielbdejong merged commit 107e034 into main Sep 21, 2026
2 checks passed
michielbdejong added a commit to ontola/atomic-server that referenced this pull request Sep 21, 2026
Phase A of the timesheet plugin's Project/Person enrichment
(ontola/atomic-plugins#4): integrations/clockify/localthought.ts
duplicated a FetchedPlatform/FetchedRecord/Term type triple structurally
identical to devonian's own, instead of importing it -- unlike the
Google Calendar/GitHub Issues LocalThought platforms, which already do.
clockifyProjection now lives in devonian/platform-lenses/clockify
(localthought/devonian#24) alongside a new resolveClockifyReferences,
matching each time entry's projectid/userid against project/member
records fetched in the same batch. This module keeps only what's
genuinely plugin-specific: the rolling look-back window / query builder.

No public export of this module changes -- ClockifyLocalThought.tsx's
imports (CLOCKIFY_APP, CLOCKIFY_PLATFORM, clockifyFields,
clockifyImportQuery, clockifyProjection, defaultClockifySelection,
LOOKBACK_OPTIONS, ClockifySelection, LookbackDays) all still resolve,
several of them now re-exported rather than declared locally.

Needs browser/data-browser/package.json's pinned devonian commit
bumped once localthought/devonian#24 merges, before this actually
resolves -- same pin-then-bump pattern as localthought/overlays'
catalog.json. Left unbumped here rather than pointing it at an
unmerged branch; full pnpm install/build wasn't run for the same
reason (it would only prove the *old*, still-duplicated behavior).


Claude-Session: https://claude.ai/code/session_01Cng3r2ijbx8fBVZjLsEdH9

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants