-
Notifications
You must be signed in to change notification settings - Fork 0
feat(clearfolio): expose capability readiness without failing liveness #502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
seonghobae
wants to merge
24
commits into
cursor/bc-d8443854-d031-4b84-b085-56f439fcbf05-df45
Choose a base branch
from
feat/clearfolio-capability-readiness-489
base: cursor/bc-d8443854-d031-4b84-b085-56f439fcbf05-df45
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
0846f9f
test(clearfolio): define capability readiness contract
seonghobae 9a2da6a
test(clearfolio): register capability readiness regression
seonghobae e19744b
feat(clearfolio): expose safe capability readiness
seonghobae fa12c4f
test(clearfolio): verify liveness separation and readiness status
seonghobae 6261a3c
feat(ops): publish Clearfolio readiness at startup
seonghobae 1e6b387
docs(clearfolio): document readiness and operator actions
seonghobae 723aa17
docs(changelog): record Clearfolio capability readiness
seonghobae 423b3d6
docs(clearfolio): record capability readiness boundary
seonghobae cb4ab9f
merge: record reconciled Clearfolio readiness parent ancestry
seonghobae e45a2f3
test(clearfolio): preserve provider rejection cleanup on readiness stack
seonghobae fd24a6c
fix(clearfolio): preserve provider response cancellation
seonghobae 1f96718
merge(clearfolio): reconcile capability readiness with artifact trust
seonghobae cf9598f
merge(clearfolio): reconcile capability readiness with current artifa…
seonghobae fa9a747
merge(clearfolio): reconcile capability readiness with current artifa…
seonghobae 4ac599f
fix(clearfolio): preserve canonical artifact origins in readiness stack
seonghobae fa93865
merge(clearfolio): reconcile capability readiness with canonical arti…
seonghobae 8455fb1
fix(clearfolio): restore canonical artifact-origin evidence after sta…
seonghobae 3ffc13b
docs(clearfolio): preserve parent artifact-origin operations with rea…
seonghobae f1f0cee
docs(changelog): preserve parent wording in readiness stack
seonghobae 460dbae
chore(clearfolio): reconcile readiness to current artifact policy parent
seonghobae 96f2177
merge(clearfolio): reconcile readiness with current artifact policy
seonghobae f9755c5
merge(clearfolio): reconcile capability readiness with current artifa…
seonghobae 33921bb
merge(stack): reconcile capability readiness with current artifact-or…
seonghobae 9e465a2
fix(stack): restore protected orchestration in capability readiness
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| # Clearfolio capability readiness and liveness separation | ||
|
|
||
| ## Decision | ||
|
|
||
| Clearfolio is an optional ScopeWeave MSA capability. Its local configuration state must be visible to an operator without turning the whole planner process unhealthy and without making a provider network request merely to answer a health question. | ||
|
|
||
| ScopeWeave therefore keeps `GET /api/health` as whole-process liveness and publishes one non-secret structured `capability.readiness` record for Clearfolio at server startup. The readiness record is produced by the same configuration validator used by production Clearfolio operations and returns only four bounded fields: `ready`, `mode`, `reason`, and `action`. | ||
|
|
||
| This is a bounded follow-up slice of issue #489. It does not claim remote Clearfolio reachability, latency, authentication success, artifact availability, or end-to-end readiness. Those require operational evidence from real provider calls and the attachment status path; the startup record proves configuration readiness only. | ||
|
|
||
| ## States | ||
|
|
||
| ### Provider | ||
|
|
||
| A valid root Clearfolio origin, HMAC secret, and optional artifact-origin policy returns: | ||
|
|
||
| ```json | ||
| {"ready":true,"mode":"provider","reason":null,"action":null} | ||
| ``` | ||
|
|
||
| No DNS lookup or HTTP request occurs while deriving this state. | ||
|
|
||
| ### Explicit development mock | ||
|
|
||
| `SCOPEWEAVE_DEV=1` with no provider URL returns: | ||
|
|
||
| ```json | ||
| {"ready":true,"mode":"development_mock","reason":null,"action":"Configure a Clearfolio provider before using this deployment for production document conversion."} | ||
| ``` | ||
|
|
||
| The mode name deliberately prevents the mock from being presented as production-provider readiness. | ||
|
|
||
| ### Unavailable or invalid production configuration | ||
|
|
||
| Missing or invalid production configuration returns `ready=false`, `mode=unavailable`, a stable configuration reason, and an action that tells the operator what to change without echoing a URL, shared secret, provider body, network address, or tenant claim. | ||
|
|
||
| Examples include: | ||
|
|
||
| - `clearfolio_not_configured` -> configure the provider URL and HMAC secret, or use the development flag only for local work; | ||
| - `clearfolio_hmac_secret_invalid` -> provide at least 32 non-whitespace characters; | ||
| - URL component or transport failures -> use a root HTTPS origin without credentials, path, query, or fragment; | ||
| - `clearfolio_artifact_origins_invalid` -> provide only comma-separated HTTPS origins or remove the optional setting. | ||
|
|
||
| ## Why liveness remains independent | ||
|
|
||
| Kubernetes distinguishes liveness from readiness: a failed liveness probe can trigger container restart, while readiness controls whether a workload should receive service traffic. Clearfolio is not required for planning, authentication, project CRUD, or the static client, so treating its configuration as whole-process liveness would turn an optional dependency failure into an unnecessary planner outage. | ||
|
|
||
| The existing `/api/health` response remains `{"ok":true}` while the Clearfolio capability is unavailable. Operators inspect the startup readiness record for the optional integration and continue to use attachment failure/status evidence for remote operational diagnosis. | ||
|
|
||
| RFC 9110 defines a successful GET response as a representation of the target resource state. ScopeWeave keeps the `/api/health` resource narrowly defined as process liveness rather than silently changing its semantics to aggregate every optional dependency. | ||
|
|
||
| ## Security and privacy boundary | ||
|
|
||
| The readiness function calls only local configuration validators. It never: | ||
|
|
||
| - calls `fetch`, resolves DNS, follows redirects, or contacts Clearfolio; | ||
| - includes `CLEARFOLIO_HMAC_SECRET`, tenant claims, provider response text, job IDs, artifact tokens, or configured URLs in output; | ||
| - changes a capability from unavailable to a successful mock outside explicit development mode; | ||
| - weakens the provider URL or artifact-origin allowlist checks established by the parent stack. | ||
|
|
||
| Unknown non-configuration exceptions are rethrown instead of being silently misclassified as a configuration state. | ||
|
|
||
| ## Verification contract | ||
|
|
||
| `tests/unit/clearfolio-capability-readiness.test.mjs` launches fresh processes so module-import configuration cannot leak between cases. It replaces global `fetch` with a throwing function and proves that readiness evaluation performs no provider transport. The cases cover: | ||
|
|
||
| - unconfigured production with live `/api/health` and unavailable Clearfolio; | ||
| - explicit development mock with a production-configuration action; | ||
| - valid production provider configuration; | ||
| - insecure production HTTP configuration; | ||
| - malformed artifact-origin policy detected before provider transport. | ||
|
|
||
| The regression executes in both `test:unit` and `test:coverage:cases`; `server/clearfolio.mjs` remains in the canonical owned-production c8 target set. | ||
|
|
||
| ## Rollback | ||
|
|
||
| Rollback removes the startup capability record and exported readiness function together. It must not restore implicit production mocks or make `/api/health` fail because Clearfolio is optional. If operators require a remote dependency probe later, add it as a separately named operational signal with bounded timeout and explicit failure semantics rather than expanding liveness implicitly. | ||
|
|
||
| ## References | ||
|
|
||
| Fielding, R., Nottingham, M., & Reschke, J. (2022). *HTTP semantics* (RFC 9110; STD 97). Internet Engineering Task Force. https://doi.org/10.17487/RFC9110 | ||
|
|
||
| The Kubernetes Authors. (2026). *Liveness, readiness, and startup probes*. Kubernetes Documentation. https://kubernetes.io/docs/concepts/workloads/pods/probes/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,14 @@ | ||
| import { serve } from '@hono/node-server'; | ||
| import { app } from './app.mjs'; | ||
| import { clearfolioCapabilityStatus } from './clearfolio.mjs'; | ||
|
|
||
| const port = Number(process.env.PORT) || 8787; | ||
| const clearfolioCapability = clearfolioCapabilityStatus(); | ||
| console.log(JSON.stringify({ | ||
| event: 'capability.readiness', | ||
| capability: 'clearfolio', | ||
| ...clearfolioCapability, | ||
| })); | ||
| serve({ fetch: app.fetch, port }, (info) => { | ||
| console.log(`ScopeWeave API listening on http://localhost:${info.port}`); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.