CLI app for developers prototyping atproto functionality

Add report stage to test labeler conformance suite #17

Open str4d.xyz
targeting main from labeler-report-stage
Open opened by str4d.xyz
targeting main from labeler-report-stage

Summary #

Adds a new report stage to atproto-devtool test labeler that exercises the full com.atproto.moderation.createReport authenticated-write path. The stage emits exactly 10 checks in a stable canonical order covering contract-published advertisement, no-JWT negatives (unauth + malformed bearer), self-mint negatives (wrong aud / lxm / exp / shape), the self-mint positive commit path, and two PDS-mediated positive modes (service-auth JWT and proxied createReport).

  • 38 acceptance criteria (AC1.1–AC8.4) all covered by automated tests; 196 tests pass in debug mode.
  • 11 stable labeler::report::* miette diagnostic codes, each pinned by assertion + snapshot.
  • Pollution-avoidance helpers pick reasonOther + record subject for remote labelers, lex-first + own-DID for local ones, and always carry a sentinel reason "atproto-devtool conformance test <RFC3339> <run-id>".
  • Commit-gated: --commit-report required for any write-side check.
  • Locality gate: --force-self-mint overrides the is_local_labeler_hostname heuristic.
  • New CLI flags: --commit-report, --self-mint-curve <es256|es256k>, --force-self-mint, --report-subject-did, --handle, --app-password (symmetric requires).
  • New primitives: AnySigningKey, hand-rolled RFC 7515 compact JWS in src/common/jwt.rs (ES256/ES256K only — no JWT library dep), encode_multikey companion to parse_multikey, is_local_labeler_hostname, SelfMintSigner with an ephemeral did:web:127.0.0.1%3A{port} identity server.
  • New seams: CreateReportTee (production + fake), PdsXrpcClient (production + fake). No production network hop bypasses the seams.
  • getrandom = "0.2" added as a direct dep (the transitive rand_core inside elliptic-curve is built without the getrandom feature).
  • CLAUDE.md files updated at repo root, src/commands/test/labeler/, and src/common/.

Implementation plan and rationale: docs/implementation-plans/2026-04-17-labeler-report-stage/. Human test plan: docs/test-plans/2026-04-17-labeler-report-stage.md.

Test Plan #

See the human test plan file for step-by-step verification.

🤖 Generated with Claude Code

Summary

  • Branch labeler-report-stage pushed to origin with 58 commits.
  • PR must be opened manually at the URL above (Tangled has no CLI integration in this environment).
  • Worktree preserved at /home/str4d/dev/ai/atproto-devtool/.worktrees/labeler-report-stage.
  • Reminder: human test plan at docs/test-plans/2026-04-17-labeler-report-stage.md documents end-to-end scenarios against a real labeler, the --commit-report sentinel grep-ability check, and the release-gate CONFORMANCE_REPORT_SUBJECT_URI placeholder replacement — review before considering this work fully complete.
Commits 69

refactor: remove implementation-plan phase references from code
fix(create_report): target the reporter's PDS, not the labeler's
fix(create_report): attribute PDS-mediated failures to the right party
Set the hard-coded post to use in `--commit-report` runs
Improve errors for pds_service_auth_rejected and pds_proxied_rejected
Refactor to clean up code
Remove redundant comment from CLI help
fix(create_report): make diagnostic span non-optional so response body renders
feat(crypto): skip rollup for local labelers whose signing key differs from the DID document
feat(identity): accept local http:// endpoints and downgrade mismatches to advisory
feat(cli): accept http:// targets with local hostnames
docs: add test plan for labeler report stage
docs: update CLAUDE.md after labeler report stage
fix(test/report): minor cleanups and test coverage improvements (M1-M5)
fix(test/subscription): restore timing normalization (I3)
fix(create_report): eliminate duplicate createSession call (I1, I2)
feat(create_report): fix ac5_1 and add end-to-end snapshot tests
test(create_report): AC5/AC6 PDS-mode integration tests and AC8.4 CLI exit-code test
test(create_report): AC8.3 subject override + AC7.1 row count tests
feat(create_report): wire PDS service-auth and PDS-proxied checks (AC5, AC6)
feat(create_report): PdsXrpcClient trait + Real/Fake impls
feat(labeler): add --handle and --app-password with clap requires
refactor: follow-up cleanup for Phase 7 review feedback
feat(create_report): self_mint_accepted with pollution avoidance (AC4)
feat(create_report): thread run_id through CreateReportRunOptions
feat(create_report): pollution-avoidance helpers
refactor: follow-up cleanup for Phase 6 review feedback
test(create_report): accept Phase 6 snapshot churn
feat(create_report): wire self-mint negative checks (AC3.1-AC3.8)
feat(labeler): construct SelfMintSigner based on locality + --force-self-mint
feat(create_report): diagnostics for AC3 self-mint negative checks
feat(create_report): wire unauthenticated_rejected and malformed_bearer_rejected
feat(create_report): XRPC error envelope parser and diagnostics for AC2.2/AC2.4
refactor: follow-up cleanup for Phase 4 review feedback
style(tests): use imported Duration type instead of fully-qualified std::time::Duration
refactor(identity): introduce FetchedLabelerRecord struct
test(report): add pipeline-level integration test for report stage
fix(tests): normalize elapsed timing in snapshots to Xms
test: accept subscription snapshot updates for report stage integration
feat(pipeline): integrate report stage with AC1 coverage
feat(create_report): stage run() with contract check and stubs
feat(labeler): add report-stage CLI flags
feat(create_report): ContractMissing diagnostic for AC1.3
feat(create_report): Check enum and CreateReportStageOutput
feat(report): add Report variant to Stage enum
feat(identity): retain reason_types / subject_types / subject_collections in IdentityFacts
test(create_report): FakeCreateReportTee with scripted responses
feat(create_report): RealCreateReportTee wrapping reqwest
feat(create_report): CreateReportTee trait and response/error types
refactor(self_mint): hoist imports to module top and clarify rand_core comment
feat(create_report): SelfMintSigner with curve-selected identity
feat(create_report): ephemeral did:web document server
feat(create_report): did:web constructor for self-mint identities
feat(identity): add encode_multikey companion to parse_multikey
test(jwt): cover InvalidSignatureScalar verification path
fix: correct sentinel test timestamps and four-segment detection test
refactor(jwt): count compact-form segments explicitly
refactor(jwt): require explicit map_err for json encode paths
refactor(identity): move to_jws_bytes onto AnySignature
refactor(sentinel): move tests into module, simplify hex encoding, and tidy docs
fix(jwt): distinguish invalid-scalar from length errors
fix(identity): actually assert P-256 low-s normalization in test
feat(labeler): add create_report stage module seed with sentinel builder
feat(identity): classify labeler hostnames as local vs remote
test(jwt): round-trip ES256/ES256K tokens against AnyVerifyingKey
feat(jwt): add hand-rolled compact JWS helpers for ES256/ES256K
feat(identity): add AnySigningKey newtype with ES256/ES256K low-s signing
chore(deps): add getrandom for CSPRNG access
docs: add labeler report stage design plan
Sign up or Sign in to add to the discussion.