docs(refactor): add integration point refactor analysis and implementation plan
Add comprehensive documentation and implementation artifacts for refactoring the plugin to use app-provided content fetchers instead of hardcoded TimeSafari integration. Changes: - Add integration-point-refactor-analysis.md with complete ADR, interfaces, migration plan, and 7-PR breakdown - Add INTEGRATION_REFACTOR_QUICK_START.md for quick reference on new machines - Add src/types/content-fetcher.ts with TypeScript SPI interfaces - Add examples/native-fetcher-android.kt with Kotlin implementation skeleton - Add examples/js-fetcher-typescript.ts with TypeScript implementation skeleton - Add tests/fixtures/test-contract.json for golden contract testing Architecture Decisions: - Dual-path SPI: Native Fetcher (background) + JS Fetcher (foreground only) - Background reliability: Native SPI only, no JS bridging in workers - Reversibility: Legacy code behind feature flag for one minor release - Test contract: Single JSON fixture for both fetcher paths This provides complete specification for implementing the refactor in 7 PRs, starting with SPI shell and progressing through background workers, deduplication, failure policies, and finally legacy code removal. All documentation is self-contained and ready for implementation on any machine.
This commit is contained in:
70
tests/fixtures/test-contract.json
vendored
Normal file
70
tests/fixtures/test-contract.json
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"description": "Golden contract test fixture - used by both JS and Native fetcher tests",
|
||||
"version": "1.0.0",
|
||||
"context": {
|
||||
"trigger": "scheduled",
|
||||
"scheduledTime": 1730179200000,
|
||||
"fetchTime": 1730175600000,
|
||||
"metadata": {
|
||||
"testRun": true,
|
||||
"runId": "test-run-001"
|
||||
}
|
||||
},
|
||||
"expectedOutput": [
|
||||
{
|
||||
"id": "offer_123",
|
||||
"title": "New Offer: Community Garden Project",
|
||||
"body": "A new volunteer opportunity is available",
|
||||
"scheduledTime": 1730179200000,
|
||||
"fetchTime": 1730175600000,
|
||||
"mediaUrl": "https://example.com/images/garden.jpg",
|
||||
"ttlSeconds": 86400,
|
||||
"dedupeKey": "offer_123_2025-10-29T12:00:00Z",
|
||||
"priority": "default",
|
||||
"metadata": {
|
||||
"offerId": "123",
|
||||
"issuerDid": "did:key:test123",
|
||||
"source": "offers_to_person"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "project_456",
|
||||
"title": "Community Center Project Updated",
|
||||
"body": "New updates for Community Center Project",
|
||||
"scheduledTime": 1730179200000,
|
||||
"fetchTime": 1730175600000,
|
||||
"mediaUrl": null,
|
||||
"ttlSeconds": 86400,
|
||||
"dedupeKey": "project_https://endorser.ch/entity/01ABC_789xyz",
|
||||
"priority": "default",
|
||||
"metadata": {
|
||||
"planHandleId": "https://endorser.ch/entity/01ABC",
|
||||
"jwtId": "789xyz",
|
||||
"source": "project_updates"
|
||||
}
|
||||
}
|
||||
],
|
||||
"failureScenarios": [
|
||||
{
|
||||
"name": "network_timeout",
|
||||
"simulate": "timeout_5000ms",
|
||||
"expectedBehavior": "retry_with_backoff"
|
||||
},
|
||||
{
|
||||
"name": "auth_401",
|
||||
"simulate": "http_401",
|
||||
"expectedBehavior": "unretryable_error_logged"
|
||||
},
|
||||
{
|
||||
"name": "rate_limit_429",
|
||||
"simulate": "http_429_retry_after_60",
|
||||
"expectedBehavior": "honor_retry_after_header"
|
||||
},
|
||||
{
|
||||
"name": "partial_failure",
|
||||
"simulate": "malformed_item_in_array",
|
||||
"expectedBehavior": "skip_bad_item_enqueue_valid"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user