You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Git commit and branch workflow preferences
3
+
alwaysApply: true
4
+
---
5
+
6
+
# Git Workflow
7
+
8
+
- **Never commit without explicit approval.** After making changes, show a summary and ask the user if they want to commit before running any `git commit` command.
9
+
- **Run the project's unit tests and confirm they pass before proposing a commit.** If tests fail, fix them first. For this repo that is `make test`.
10
+
- Never push to remote unless explicitly asked.
11
+
- Never force-push.
12
+
- Always show `git diff --stat` or a plain-language summary of changes before proposing a commit message.
Copy file name to clipboardExpand all lines: docs/context-settings.md
+124Lines changed: 124 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -162,8 +162,132 @@ auto context = c2pa::Context::ContextBuilder()
162
162
|`with_settings(settings)`| Apply a `Settings` object |
163
163
|`with_json(json_string)`| Apply settings from a JSON string |
164
164
|`with_json_settings_file(path)`| Load and apply settings from a JSON file |
165
+
|`with_signer(signer)`| Store a `Signer` in the context (consumed; used by `Builder::sign` with no explicit signer) |
166
+
|`with_progress_callback(callback)`| Register a progress/cancel callback (see [Progress callbacks and cancellation](#progress-callbacks-and-cancellation)) |
165
167
|`create_context()`| Build and return the `Context` (consumes the builder) |
166
168
169
+
## Progress callbacks and cancellation
170
+
171
+
You can register a callback on a `Context` to receive progress notifications during signing and reading operations, and to cancel an operation in flight.
172
+
173
+
### Registering a callback
174
+
175
+
Use `ContextBuilder::with_progress_callback` to attach a callback before building the context:
-**`phase`** — which stage the SDK is in (see [`ProgressPhase` values](#progressphase-values) below).
202
+
-**`step`** — monotonically increasing counter within the current phase, starting at `1`. Resets to `1` at the start of each new phase. Use as a liveness signal: a rising `step` means the SDK is making forward progress.
-**Return value** — return `true` to continue, `false` to request cancellation (same effect as calling `context.cancel()`).
205
+
206
+
**Do not throw** from the progress callback. Exceptions cannot cross the C/Rust boundary safely; if your callback throws, the wrapper catches it and the operation is aborted as a cancellation (you do not get your exception back at the call site). Use `return false`, `context.cancel()`, or application-side state instead.
207
+
208
+
### Cancelling from another thread
209
+
210
+
You may call `Context::cancel()` from another thread while the same `Context` remains valid and is not being destroyed or moved concurrently with that call. The SDK returns a `C2paException` with an `OperationCancelled` error at the next progress checkpoint:
0 commit comments