Skip to content

Feat/staging test - #43

Merged
dzdidi merged 9 commits into
masterfrom
feat/staging-test
Sep 9, 2026
Merged

Feat/staging test#43
dzdidi merged 9 commits into
masterfrom
feat/staging-test

Conversation

@dzdidi

@dzdidi dzdidi commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Treat Pubky 410 Gone responses as an absent Paykit namespace, matching existing 404 Not Found behavior.
This makes has_paykit_data return false for deleted or tombstoned Paykit data instead of returning a lookup error. Other failures remain errors.

Contract and risk impact

☑ Public API or SDK contract
☐ Persisted data or migration
☐ Authentication, authorization, identity, or secret handling
☑ Payment or entitlement behavior
☐ Runtime, deployment, or observability
☐ No contract/risk impact

No persisted-data impact. Low risk: change only expands absence classification from 404 to 404 | 410.

Verification

Passed:

• cargo test -p locks-sdk --lib paykit::tests::gone_namespace_means_no_paykit_data -- --exact
• cargo test -p locks-sdk
• cargo test -p locks-sdk-wasm
• cargo clippy -p locks-sdk --all-targets --all-features -- -D warnings
• cargo clippy -p locks-sdk-wasm --target wasm32-unknown-unknown -- -D warnings
• cargo fmt --all -- --check
• git diff --check

Independent closure review: approved with no findings.

Documentation

No documentation changes required. Public API shape is unchanged; behavior now matches Pubky and Paykit absence semantics.

Checklist

☑ The change is focused and self-reviewed.
☑ Regression tests were added where practical.
☑ No credentials, identities, private content, payment material, or generated local state are included.
☑ Formatting and relevant tests/lints pass.

- add Rust probe for public Paykit v0 namespace data
- expose static JS/WASM discovery methods with custom relay support
- distinguish invalid user input from operational lookup failures
- derive Paykit namespace from pinned paykit-lib at build time
- keep Paykit crypto dependencies outside the WASM runtime graph
- pin compatible pubky-noise rc7 build dependency
- raise workspace MSRV and build toolchain to Rust 1.91.1
- document data-presence semantics and explicit non-claims
- cover Rust, generated API, WASM, and failure behavior

Signed-off-by: dzdidi <dzdidi@users.noreply.github.com>
Signed-off-by: dzdidi <dzdidi@users.noreply.github.com>
Signed-off-by: dzdidi <dzdidi@users.noreply.github.com>
@dzdidi
dzdidi requested a review from ben-kaufman September 3, 2026 19:10
@dzdidi
dzdidi marked this pull request as ready for review September 3, 2026 19:10
Signed-off-by: dzdidi <dzdidi@users.noreply.github.com>

@ben-kaufman ben-kaufman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found five issues that should be addressed before merging.

Comment thread locks-sdk/src/paykit.rs Outdated
fn classify_listing(listing: pubky::Result<Vec<PubkyResource>>) -> pubky::Result<bool> {
match listing {
Ok(entries) => Ok(!entries.is_empty()),
Err(pubky::Error::Request(RequestError::Server { status, .. }))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only treats 404 Not Found as an absent Paykit namespace. Pubky and the pinned Paykit library also treat 410 Gone as absence, so deleted or tombstoned data currently produces PaykitDataLookupFailed instead of false. Could we classify StatusCode::GONE as absence too?

if (!raw) return;
try {
Object.assign(state, JSON.parse(raw), {
Object.assign(state, restorePersistedReaderState(JSON.parse(raw)), {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This filters old bearer fields out of memory but leaves the original JSON in localStorage. In staging mode there is no periodic refresh to rewrite it, so credentials saved by the previous implementation can remain on disk indefinitely. Could we rewrite the filtered public state or remove this key after a successful restore?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if the ./examples should stay beyond first release... I kinda intended them for demo for FE team on how do integration.

render();
});

el.readerPublicKey.addEventListener('input', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The staging reader remains editable while submitPaykitPaymentProof() is running. If the user changes reader A to B after the initial check, the post-submit guard does not compare the reader key, so A’s bundle is accepted while the UI displays B. Could we disable this input during submission or invalidate and recheck the reader snapshot afterward?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as #43 (comment)

- |
node examples/js-sdk/scripts/init-staging-config.mjs
mkdir -p /workspace/.local/paykit-staging-demo/creator-session
chown -R 1000:1000 /workspace/.local/paykit-staging-demo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hardcodes ownership of the host bind mount to UID/GID 1000. On Linux hosts using another UID, creator-session becomes a 0700 directory that the host user cannot traverse or remove with the documented reset. Could we avoid fixed bind-mount ownership or pass through the host UID/GID?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as #43 (comment)

"prepare-paykit-reader": "node scripts/prepare-paykit-reader.mjs",
"receive-paykit-request": "node scripts/receive-paykit-request.mjs",
"test:paykit-reader-worker": "node scripts/test-paykit-reader-worker.mjs",
"test:staging-config": "node scripts/test-staging-config.mjs",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we run the new staging test scripts in CI? They currently exist as standalone package scripts, but the workflow only runs the older setup contract and bindings suite, so the new Compose, staging-mode, persistence, and reset behavior is not gated.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dzdidi
dzdidi requested a review from ben-kaufman September 7, 2026 18:28

@ben-kaufman ben-kaufman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 410 handling is fixed. Given these are integration demos that may be removed after the first release, I am treating the remaining demo issues as non-blocking.

If the demos stay in use, please clean up old credentials left in browser storage and prevent a result for reader A from being accepted after switching to reader B. Credential cleanup is worth addressing before using real credentials. The Linux reset permissions and remaining CI suites can be follow-ups.

Signed-off-by: dzdidi <dzdidi@users.noreply.github.com>
@dzdidi
dzdidi merged commit a9d52b8 into master Sep 9, 2026
2 checks passed
@dzdidi
dzdidi deleted the feat/staging-test branch September 9, 2026 12:17
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