Skip to content

Run the AnalysisRepository conformance suite against the C# host - #597

Draft
hahn-kev-bot wants to merge 2 commits into
mainfrom
claude/papi-csharp-i13r-tests-6d9b07
Draft

hahn-kev-bot wants to merge 2 commits into
mainfrom
claude/papi-csharp-i13r-tests-6d9b07

Conversation

@hahn-kev-bot

@hahn-kev-bot hahn-kev-bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

AI summary

Summary

The AnalysisRepository conformance suite's required group now runs against the C# host, with no Platform.Bible in the loop.

sequenceDiagram
    participant Jest as Jest (conformance suite)
    participant Adapter as CSharpRepository
    participant Fake as FakePapi (ws server)
    participant Host as InterlinearizerHost.exe
    Jest->>Fake: start(dataDir)
    Fake->>Host: spawn --papi-port <free> --data-dir
    Host->>Fake: network:registerMethod ×17
    Fake-->>Host: true
    Host-->>Fake: "Interlinearizer host ready"
    Jest->>Adapter: apply / lookups
    Adapter->>Fake: command:interlinearizer.repository.<method> {projectId, ...}
    Fake->>Host: JSON-RPC request
    Host-->>Fake: result (nulls dropped)
    Fake-->>Adapter: result
Loading

What each side gained:

 c-sharp/InterlinearizerHost/
+├── HostOptions.cs                  # --data-dir, --papi-port
 ├── Papi/PapiClient.cs              # port from options; nulls omitted on the wire
 └── Services/
+    └── RepositoryService.cs        # one command per repository method, + open/closeProject
 c-sharp/InterlinearizerCrdt/
 └── AnalysisRepository.cs
+    ReadAll, CountApprovals (WebView tie-break), id-across-kinds refusals
 src/
+├── services/csharpRepository.ts    # AnalysisRepository over a command sender
 └── __tests__/
     ├── analysis-repository-conformance.ts   # record ids are GUIDs, distinct across kinds
+    └── c-sharp-host/
+        ├── fake-papi.ts
+        └── csharpRepository.conformance.test.ts
+jest.c-sharp-host.config.ts          # npm run test:c-sharp:conformance

The second commit guards a Harmony behavior the suite tripped over: entities of every kind share one table, so a second create under an existing id is dropped without error. Apply now refuses an id named in more than one kind, or put under an id stored as another kind.

Apply(changes)
  assert no id named twice, within a kind or across kinds
  load stored records of every kind under every put id
  for each put
    if its id is stored as another kind → throw, applying nothing
    create / replace / patch as before

Evidence

  • Before: HarmonyKeepsOneEntityPerIdWhateverItsKind shows the loss: two creates under one id in one AddChanges leave one phrase analysis and no phrase link. The two refusal tests failed with Expected to throw ArgumentException.
    After: npm run test:dotnet → 115 passed. npm run test:c-sharp:conformance → 35 passed against the published host. npm run test:coverage → 6520 passed, the adapter at 100%.

Merge Danger

Door: two-way

Nothing exposes the repository commands to the WebView yet; the adapter is only reached from the new Jest harness.

Blast Radius: CI

The e2e job gains a step that runs the conformance suite after publishing the host. The suite's fixture ids changed for every implementation, but the DraftRepository and Pt9ImportRepository runs still pass.

Test plan

  • npm run build:c-sharp -- <rid> then npm run test:c-sharp:conformance on a second platform
  • CI e2e job runs the new step green on Linux and Windows

🤖 Generated with Claude Code


This change is Reviewable

hahn-kev and others added 2 commits November 3, 2026 14:18
The host serves its repository as one command per method, under
interlinearizer.repository, and takes --papi-port so a test can stand
up a network of its own. A fake PAPI server in Jest starts the published
host, accepts its registrations, and sends it the suite's commands, so
`npm run test:c-sharp:conformance` needs no Platform.Bible.

CSharpRepository is the TypeScript side of the seam. The C# repository
gains ReadAll and CountApprovals, the latter with the approval tie-break
the WebView uses. The host's serializer drops null fields, as the seam
promises absent optional fields. The suite's record ids are GUIDs,
distinct across record kinds, since Harmony keeps every entity in one
table.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Harmony keeps every entity in one table, so a second create under an id
already created, of whatever kind, is dropped without error. An apply
now refuses an id named in more than one kind of its change set, or put
under an id stored as another kind, applying nothing, rather than losing
the record. A test pins Harmony's behavior beside the two refusals.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants