-
Notifications
You must be signed in to change notification settings - Fork 0
Classify adapter lifecycle states in digests #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
2f1b224
fix(digest): classify adapter lifecycle states
8e4d194
feat(digest): add digest handlers and tests for CRM/productivity adap…
f73fc59
fix(adapters): preserve lifecycle actions through webhook normalization
3d1a887
fix(digest): wire lifecycle coverage across adapters
c1ce9a7
fix(digest): enforce category layout contracts
dd4f9f8
Address PR review lifecycle digest gaps
2ea0c3e
fix(digest): add issue tracking category aliases
62722aa
test(digest): cover issue metadata alias reconciliation
c130ccb
Tighten digest contract review feedback
99cb342
Tighten digest root filters and Linear wording
e908f4d
Fix Azure digest root contract
0930b9c
Tighten adapter digest review gaps
0c03c37
Anchor GitLab tombstone cleanup on prior aliases
f3c4eb3
Tighten adapter lifecycle digest consistency
8befe37
Close final adapter review gaps
968d1e9
Tighten GitLab alias cleanup
83121b3
Harden adapter digest contracts
6230cba
Harden GitHub tombstone recovery
4de562f
Tighten Salesforce lifecycle digest coverage
23cf184
Materialize Asana and ClickUp task aliases
6627ea0
Harden digest and alias lifecycle coverage
77b4d14
Close digest alias review gaps
a83d6ad
Tighten digest alias review gaps
d4ff5a7
Fix digest alias edge cases
50e0693
Harden digest alias path parsing
d7d9409
Close digest review edge cases
bb5b0d0
Handle GitLab tag deletes and wrapper digests
cd34b52
Avoid digest wrapper path collisions
8eb63a2
Require wrapper ids for digest suffix stripping
00a69ac
Use provider names for storage digest wrappers
954415d
Close digest wrapper and tag delete gaps
9b84884
Classify GitLab pipeline jobs in digests
ce278e3
Handle complex GitLab tag refs in digests
5613b38
Round trip complex GitLab tag refs
db500f3
Harden GitLab resource path parsing
c158891
Handle raw GitLab tag ref path boundaries
75a5c4b
Fix ambiguous GitLab tag ref paths
c7019ba
Normalize GitLab tag webhook paths
e2a0a70
Handle composed GitLab tag object IDs
75a2a31
Normalize GitLab tag auxiliary lifecycle paths
bc5e5bc
Normalize id-only GitLab tag refs
bdef03d
Suppress legacy GitLab tag digest paths
6be07dc
Harden GitLab tag cleanup digest paths
ed07033
Suppress flat GitLab tag cleanup digests
81a73d4
Finalize GitLab adapter publish lockfile
0c2313e
Harden GitLab adapter publish and digest contracts
d845d67
Close GitLab adapter digest parity gaps
d810670
Revert GitLab feature version bump
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| --- | ||
| description: Provider adapters must keep Relayfile digests and lifecycle state wired | ||
| paths: | ||
| - packages/*/src/** | ||
| - packages/*/test/** | ||
| - packages/*/src/**/__tests__/** | ||
| --- | ||
|
|
||
| # Relayfile integration digests | ||
|
|
||
| Relayfile digests are part of the adapter contract. If an adapter writes | ||
| provider records that agents can read, the adapter must also make those records | ||
| summarizable in the activity digest. | ||
|
|
||
| ## Required for adapters | ||
|
|
||
| - Export a real `digest` handler from `src/digest.ts` and the package `src/index.ts`. | ||
| - The digest handler must use `ctx.changeEvents({ providers: [ctx.provider] })` | ||
| and return deterministic bullets sorted by event time and id. | ||
| - Lifecycle verbs must be provider-aware. Explicitly classify terminal-state | ||
| actions such as `closed`, `merged`, `archived`, `completed`, `canceled`, and | ||
| `resolved`. | ||
| - Webhook ingestion must preserve terminal lifecycle state as record data. | ||
| Do not convert `closed`/`merged`/`archived`/`completed` into deletion unless | ||
| the upstream object was actually deleted. | ||
| - Add tests for create/update, terminal state, delete, deterministic ordering, | ||
| and empty windows. | ||
| - Keep the provider layout aligned with the category matrix in | ||
| `docs/digest-layout-contract.md`. For example, issue-tracking resources must | ||
| expose `by-state`, `by-assignee`, `by-creator`, and `by-priority`; CI/deploy | ||
| resources must expose `by-status` unless the matrix documents an explicit | ||
| exception. | ||
| - Run `npm run test:digest-contracts` whenever adding or materially changing an | ||
| adapter, digest handler, layout manifest, or category matrix entry. | ||
|
|
||
| ## No-op handlers | ||
|
|
||
| A digest handler that returns `null` is a temporary placeholder, not a pattern. | ||
| Do not add new no-op digest handlers for providers that expose records in | ||
| Relayfile. If a provider intentionally has no digest output, document that | ||
| choice and test the exclusion. |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,4 +34,4 @@ jobs: | |
| run: npx turbo typecheck | ||
|
|
||
| - name: Test | ||
| run: npx turbo test | ||
| run: npm test | ||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Relayfile Digest And Layout Contract | ||
|
|
||
| Relayfile adapters expose provider records as an agent-facing filesystem. A | ||
| record that can be written, synced, or received through a webhook must also be | ||
| discoverable through the activity digest and through the provider's natural | ||
| lookup aliases. | ||
|
|
||
| Run the contract check with: | ||
|
|
||
| ```bash | ||
| npm run test:digest-contracts | ||
| ``` | ||
|
|
||
| ## Baseline Digest Contract | ||
|
|
||
| Every provider package under `packages/<provider>` must: | ||
|
|
||
| - Export `src/digest.ts` from `src/index.ts`. | ||
| - Scope digest reads with `ctx.changeEvents({ providers: [ctx.provider] })`. | ||
| - Return deterministic bullets sorted by event time and id. | ||
| - Test create/update behavior, provider lifecycle behavior, delete or terminal | ||
| behavior, deterministic ordering, and empty windows. | ||
| - Preserve terminal lifecycle state in webhook ingestion unless the upstream | ||
| object was actually deleted. | ||
|
|
||
| No-op digest handlers are not a shipping pattern. A provider that intentionally | ||
| does not appear in digests must document the exception and keep that exclusion | ||
| covered by a test. | ||
|
|
||
| Append-only providers are a narrow exception to the delete-or-terminal portion | ||
| of lifecycle coverage. Segment is currently the only enforced exception: | ||
| records are immutable once written, so its digest contract must explicitly | ||
| classify append/upsert activity and document the append-only behavior in | ||
| `src/digest.ts`. | ||
|
|
||
| ## Category Matrix | ||
|
|
||
| These category rules are enforced by `scripts/digest-layout-contracts.mjs`. | ||
|
|
||
| | Category | Providers/resources | Required lookup | Rationale | | ||
| | --- | --- | --- | --- | | ||
| | issue-tracking | GitHub issues and pull requests, GitLab issues and merge requests, Jira issues, Linear issues | `by-state/<state>/<id>.json`, `by-assignee/<assignee>/<id>.json`, `by-creator/<creator>/<id>.json`, `by-priority/<priority>/<id>.json` | Agents often ask for open, closed, merged, completed, canceled, assigned, created-by, or priority-scoped work without already knowing an id. | | ||
| | task-management | Asana tasks, ClickUp tasks | `by-state/<state>/<id>.json`, `by-assignee/<assignee>/<id>.json`, `by-creator/<creator>/<id>.json`, `by-priority/<priority>/<id>.json` | Task systems expose the same operational questions as issue trackers: what is open or completed, who owns it, who created it, and what priority bucket it sits in. | | ||
| | ci-deploy | GitLab pipelines and deployments | `by-status/<status>/<id>.json` | Status is the primary lifecycle bucket for build and deploy resources. | | ||
| | knowledge | Confluence pages | `by-state/<state>/<id>.json` | Pages can be current, archived, trashed, restored, or deleted and must remain discoverable by lifecycle bucket. | | ||
|
|
||
| Resources outside this matrix still need digest coverage. They only need a | ||
| `by-state`, `by-status`, `by-assignee`, `by-creator`, or `by-priority` alias | ||
| when the resource exposes a durable bucket that agents naturally browse by. Add | ||
| the resource to the matrix when that is true; do not rely on prose alone. | ||
|
|
||
| ## Review Checklist | ||
|
|
||
| When adding or materially changing an adapter: | ||
|
|
||
| 1. Update the adapter digest handler and tests. | ||
| 2. Update the layout manifest when the provider exposes a category lookup such | ||
| as state, status, parent, key, name, or title. | ||
| 3. Add the provider/resource to the category matrix above and to | ||
| `scripts/digest-layout-contracts.mjs` when the category behavior should be | ||
| enforced across future work. | ||
| 4. Run `npm run test:digest-contracts` before opening or updating the PR. | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Alias path format in the Category Matrix contradicts the established convention in AGENTS.md. The canonical pattern is
by-<key>/<value>__<id>.json(flat, double-underscore joiner), but this table showsby-<key>/<value>/<id>.json(nested subdirectory per value). Implementers following this doc will produce a different tree shape than what the rest of the system expects.Prompt for AI agents