Skip to content

Add ndi.cloud.api.feedback commands and ndi.unittest.cloud.feedbackTest - #1023

Merged
stevevanhooser merged 1 commit into
mainfrom
claude/feedback-api-test
Oct 11, 2026
Merged

stevevanhooser merged 1 commit into
mainfrom
claude/feedback-api-test

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Adds an NDI-matlab client for the new in-app problem report endpoints, plus a cloud unit test for them.

Server side: Waltham-Data-Science/ndi-cloud-node#158, PR Waltham-Data-Science/ndi-cloud-node#159.

New commands

  • ndi.cloud.api.feedback.submitFeedback(app, category, description, ...) → POST /feedback, returns the new report id.
    • Optional name-value arguments: appVersion, datasetId, documentId, environment (struct), state (struct), log, traceback.
    • category must be "bug", "performance" or "other".
  • ndi.cloud.api.feedback.deleteFeedback(feedbackID) → DELETE /feedback/{feedbackId}. The reporter withdraws their own report; another user's report, or a missing one, is answered with 404.
  • Implementation classes ndi.cloud.api.implementation.feedback.SubmitFeedback / DeleteFeedback, and the submit_feedback / delete_feedback endpoints in ndi.cloud.api.url (new feedback_id option).

ndi.unittest.cloud.feedbackTest

  • Submit a minimal report, then delete it; a second delete returns 404.
  • Submit a full report with every optional field, including a fake bearer token and signed URL in log. The reporter can't read a report back, so redaction itself is checked in the server's tests.
  • Server validation (400): unknown category, missing description, unsupported schemaVersion.
  • Size cap (413): a 600,000-character log.
  • POST with no token is rejected; the test accepts 401 or 403, and the API returns 403 today.
  • Deleting a missing id (404) or a malformed id (400).
  • The wrapper's own argument validation (no network call).

Every report a test creates is deleted again, with a teardown as a backstop. Deleted reports don't count toward the server's limit of 10 reports per user per hour.

Environment gate: test-cloud-api.yml runs the cloud tests against both prod and dev every day. The suite first probes DELETE /feedback/not-a-valid-id: the route answers 400 once deployed and the API's catch-all answers 404 before that. On 404 the suite skips instead of failing, so prod runs stay green until ndi-cloud-node#159 reaches prod. The downside is that if the route ever disappeared, this suite would skip rather than fail.

Testing

Not run: this was written without access to MATLAB (per AGENTS.md). To verify once ndi-cloud-node#159 is deployed to dev:

setenv("CLOUD_API_ENVIRONMENT", "dev")
results = runtests("ndi.unittest.cloud.feedbackTest")

🤖 Generated with Claude Code

https://claude.ai/code/session_01HZqqhYo3AFqWMNXh8Qmiqf


Generated by Claude Code

Client for the in-app problem report endpoints in ndi-cloud-node#158
(PR Waltham-Data-Science/ndi-cloud-node#159):

- ndi.cloud.api.feedback.submitFeedback(app, category, description, ...)
  -> POST /feedback, returns the new report id
- ndi.cloud.api.feedback.deleteFeedback(feedbackID)
  -> DELETE /feedback/{feedbackId} (reporter withdraws own report)
- implementation classes SubmitFeedback / DeleteFeedback and the
  submit_feedback / delete_feedback endpoints in ndi.cloud.api.url

feedbackTest covers submit+delete (and 404 on a second delete), a full
report with every optional field, server validation (400), the log size
cap (413), an unauthenticated POST (401/403), delete of a missing or
malformed id, and the wrapper's own argument validation. Every report a
test creates is deleted, with a teardown as a backstop. The suite skips
itself in an API environment that does not have /feedback deployed yet,
so the daily prod run stays green until prod has it.

Not run: no MATLAB in the authoring environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HZqqhYo3AFqWMNXh8Qmiqf

Copy link
Copy Markdown
Contributor Author

CI note: Cloud CI fails because of a problem already on main, not because of this PR.

Every cloud test that logs in errors inside ndi.cloud.internal.decodeJwt (line 43):

Unable to resolve the name 'javax.xml.bind.DatatypeConverter.parseBase64Binary'.

The MATLAB on the runner no longer ships javax.xml.bind. That means ndi.cloud.authenticate() fails before any request is sent. UserTest/testMe, readIngested and the compute tests fail the same way. The nightly Test NDI Cloud Api workflow on main has been red from this too: the 2026-10-11 dev run hit the error 68 times, with 107 failed tests. feedbackTest fails in its class setup because its first step is an authenticated call.

There's no fix for this yet. A one-line fix, using MATLAB's built-in decoder instead of Java:

% src/ndi/+ndi/+cloud/+internal/decodeJwt.m, line 43
payloadBytes = matlab.net.base64decode(payloadBase64);

matlab.net.base64decode decodes standard Base64, which is what the preceding lines already convert the token to. It returns uint8, which native2unicode accepts as before. I haven't put this into this PR because it's outside its scope; it can come in here or as its own PR.


Generated by Claude Code

@stevevanhooser
stevevanhooser merged commit 846c4bd into main Oct 11, 2026
5 of 9 checks passed
stevevanhooser pushed a commit that referenced this pull request Oct 11, 2026
Brings in the ndi.cloud.api.feedback commands + feedbackTest (#1023) and
the cloud login JWT decode fix (#1024).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wj6cuvAwgAaYN5dNM1o6L
@stevevanhooser
stevevanhooser deleted the claude/feedback-api-test branch October 12, 2026 19:42
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.

3 participants