Skip to content

docs(plans): every entry names a revoke page, and only a 2xx on a held token is a revoke (TASK-172) - #2037

Merged
lilyshen0722 merged 1 commit into
mainfrom
wren/task-172-revoke-page
Sep 30, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
wren/task-172-revoke-page

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Amends the hosted-MCP plan's removal (§3, §9, §10 steps 6–7) and §10.5 of the tools-catalogue plan, from review of the first removal build.

  • Every entry names a page, where a person revokes by hand. An entry whose AS advertises an RFC 7009 endpoint names that as well. When a removal cannot revoke at the vendor, because the entry has no endpoint or the token's secret is not found, it finishes and returns the page as revokeAt. It no longer keeps a row whose retry can never succeed.
  • Only a 2xx on a token we hold counts as revoked, and invalid_grant is a refusal. RFC 7009 answers an already-gone token with 200. RFC 6749 §5.2 also gives invalid_grant for a token issued to another client, and a CIMD client id moves with the API host. This replaces a test imported from §10.5 that counted invalid_grant as revoked.
  • A row with no refresh token revokes its access token. Nothing sends an empty token.
  • §10.5 gains the mark. A revoke that took is recorded before any material goes, so after a later failure the retry finishes without calling the provider. A PATCH cannot write the mark.

Docs only. Gate: Rhea.

🤖 Generated with Claude Code

…d token is a revoke (TASK-172)

A removal that cannot revoke at the vendor now finishes and hands the
person the entry's page, so every entry names one, an endpoint entry
included. Only a 2xx on a token we hold counts as revoked: invalid_grant
also means "issued to another client", and a cimd client id moves with
the API host. §10.5 gains the mark, so a failure after the provider
revoke leaves a row the retry can finish.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lilyshen0722
lilyshen0722 added this pull request to the merge queue Sep 30, 2026
Merged via the queue into main with commit 03c17da Sep 30, 2026
15 checks passed
samxu01 pushed a commit that referenced this pull request Sep 30, 2026
…voke that takes

Removing a hosted Connection is the one sequence with a vendor step, and its
order is load-bearing: grants, row, provider, mark, material, delete. Grants
first because the granter's own revoke resolves ownership through
`findConnection`, so a deleted row orphans them (TASK-145); row second because
the broker refuses a row carrying `revokedAt` from that instant; provider third
while the material is still there; then the mark; material and delete last so a
failed vendor revoke leaves a row a retry can finish.

The mark is the fold's centre. A result code dies with the request and a retry
reads only the row, so a provider revoke that took and a step 4/5 that failed
used to strand the row: the retry found a dead reference and answered
`provider_revoke_failed` forever (Vera 75638, measured). The mark is written
BEFORE any material goes, is server-owned so a PATCH cannot write it, and a
retry that finds it skips the vendor. A failure after it returns
`provider_revoked_removal_incomplete`, which says the revoke happened so the
retry does not call the vendor again.

Only a 2xx on a token we hold counts as revoked (Wren 75660). The
`invalid_grant` arm is dropped: RFC 7009 answers a token already gone with 200,
while RFC 6749 §5.2 also gives `invalid_grant` for a token "issued to another
client" — and our CIMD client id is rebuilt from the API host at call time
(`resolvedClientId`), so after a host move a LIVE token answers it. Counting it
deletes the material and records a revoke that never happened.

The material read discriminates on the error's `code`, never its class: only
`connector_secret_not_found` means we hold nothing to revoke, and that case
finishes and hands the person the page. `connector_secret_configuration_invalid`
and `connector_secret_key_missing` keep the row, or one misconfigured key ring
would delete every hosted row that day while recording the vendor revoke as
done (Vera 75662). Nothing is ever sent as `token: ""` — the token is the
refresh reference or the access one, and a blank or absent secret means send
nothing, finish, and hand over the page.

Per #2037 the entry's `revoke` is now a `page` always and an `endpoint` only
when the AS advertises one, so every refusal and every success carries a
`revokeAt`; both URLs are checked, not just the first (the two-key shape used to
be refused outright, which is why that loop could not run before). A page-only
entry still calls no vendor.

Evidence: 20-mutant ledger, 20 killed, 0 survivors, 0 named-arm misses, no site
mismatches, all pristine copies restored (baseline 50 passed). Touched suites
55/55; neighbourhood 24 suites / 289 tests / 0 failed. eslint finding multisets
identical to the branch base on all five pre-existing files (+0/-0). tsc clean
on every touched file.
samxu01 pushed a commit that referenced this pull request Sep 30, 2026
…voke that takes

Removing a hosted Connection is the one sequence with a vendor step, and its
order is load-bearing: grants, row, provider, mark, material, delete. Grants
first because the granter's own revoke resolves ownership through
`findConnection`, so a deleted row orphans them (TASK-145); row second because
the broker refuses a row carrying `revokedAt` from that instant; provider third
while the material is still there; then the mark; material and delete last so a
failed vendor revoke leaves a row a retry can finish.

The mark is the fold's centre. A result code dies with the request and a retry
reads only the row, so a provider revoke that took and a step 4/5 that failed
used to strand the row: the retry found a dead reference and answered
`provider_revoke_failed` forever (Vera 75638, measured). The mark is written
BEFORE any material goes, is server-owned so a PATCH cannot write it, and a
retry that finds it skips the vendor. A failure after it returns
`provider_revoked_removal_incomplete`, which says the revoke happened so the
retry does not call the vendor again.

Only a 2xx on a token we hold counts as revoked (Wren 75660). The
`invalid_grant` arm is dropped: RFC 7009 answers a token already gone with 200,
while RFC 6749 §5.2 also gives `invalid_grant` for a token "issued to another
client" — and our CIMD client id is rebuilt from the API host at call time
(`resolvedClientId`), so after a host move a LIVE token answers it. Counting it
deletes the material and records a revoke that never happened.

The material read discriminates on the error's `code`, never its class: only
`connector_secret_not_found` means we hold nothing to revoke, and that case
finishes and hands the person the page. `connector_secret_configuration_invalid`
and `connector_secret_key_missing` keep the row, or one misconfigured key ring
would delete every hosted row that day while recording the vendor revoke as
done (Vera 75662). Nothing is ever sent as `token: ""` — the token is the
refresh reference or the access one, and a blank or absent secret means send
nothing, finish, and hand over the page.

The token is the one the ROW NAMES, and there is no fallback past a missing one
(Wren 75713): a named refresh reference is sent, otherwise the access token, and
a not-found read of the named one sends nothing and finishes with the page. A
fallback would try to revoke a grant we may still hold — RFC 7009 §2.1 makes an
access-token revoke a MAY, so the refresh token can survive it. The arm that
says so counts the reads, because its mock throws for every reference and a
fallback would otherwise look identical.

Per #2037 the entry's `revoke` is now a `page` always and an `endpoint` only
when the AS advertises one, so every refusal and every success carries a
`revokeAt`; both URLs are checked, not just the first (the two-key shape used to
be refused outright, which is why that loop could not run before). A page-only
entry still calls no vendor.

Evidence: 21-mutant ledger, 21 killed, 0 survivors, 0 named-arm misses, no site
mismatches, all pristine copies restored (baseline 50 passed). Touched suites
55/55; neighbourhood 24 suites / 289 tests / 0 failed. eslint finding multisets
identical to the branch base on all five pre-existing files and both test files
(+0/-0). tsc clean on every touched file.
samxu01 pushed a commit that referenced this pull request Sep 30, 2026
…voke that takes

Removing a hosted Connection is the one sequence with a vendor step, and its
order is load-bearing: grants, row, provider, mark, material, delete. Grants
first because the granter's own revoke resolves ownership through
`findConnection`, so a deleted row orphans them (TASK-145); row second because
the broker refuses a row carrying `revokedAt` from that instant; provider third
while the material is still there; then the mark; material and delete last so a
failed vendor revoke leaves a row a retry can finish.

The mark is the fold's centre. A result code dies with the request and a retry
reads only the row, so a provider revoke that took and a step 4/5 that failed
used to strand the row: the retry found a dead reference and answered
`provider_revoke_failed` forever (Vera 75638, measured). The mark is written
BEFORE any material goes, is server-owned so a PATCH cannot write it, and a
retry that finds it skips the vendor. A failure after it returns
`provider_revoked_removal_incomplete`, which says the revoke happened so the
retry does not call the vendor again.

Only a 2xx on a token we hold counts as revoked (Wren 75660). The
`invalid_grant` arm is dropped: RFC 7009 answers a token already gone with 200,
while RFC 6749 §5.2 also gives `invalid_grant` for a token "issued to another
client" — and our CIMD client id is rebuilt from the API host at call time
(`resolvedClientId`), so after a host move a LIVE token answers it. Counting it
deletes the material and records a revoke that never happened.

The material read discriminates on the error's `code`, never its class: only
`connector_secret_not_found` means we hold nothing to revoke, and that case
finishes and hands the person the page. `connector_secret_configuration_invalid`
and `connector_secret_key_missing` keep the row, or one misconfigured key ring
would delete every hosted row that day while recording the vendor revoke as
done (Vera 75662). Nothing is ever sent as `token: ""` — the token is the
refresh reference or the access one, and a blank or absent secret means send
nothing, finish, and hand over the page.

The mark's OWN comment was wrong about why a PATCH cannot write it, and the fix
is a measurement rather than a rewording. `stripServerOwnedConfig` is defined at
`routes/integrations.ts:65` and called on the PATCH body at `:750`, and the write
loop at `:757` iterates `Object.keys(incoming)`, where `incoming = relay.next` is
that stripped copy — so a server-owned key never reaches the loop at all. The
explicit refusals (`linkedUserId`, `botToken`) are a different mechanism that
covers two keys; the strip is what covers the rest, the mark included. Both
comments now name that mechanism and the sites, and
`integrations.serverOwnedConfig.test.js` pins it: a PATCH supplying the mark does
not write it, while `liveRelay` in the same body is written, which is the
acceptance control that makes the absence evidence about the strip rather than a
request that never reached a write. (`chatId` was the wrong control — it is on
the list too.)

The token is the one the ROW NAMES, and there is no fallback past a missing one
(Wren 75713): a named refresh reference is sent, otherwise the access token, and
a not-found read of the named one sends nothing and finishes with the page. A
fallback would try to revoke a grant we may still hold — RFC 7009 §2.1 makes an
access-token revoke a MAY, so the refresh token can survive it. The arm that
says so counts the reads, because its mock throws for every reference and a
fallback would otherwise look identical.

Per #2037 the entry's `revoke` is now a `page` always and an `endpoint` only
when the AS advertises one, so every refusal and every success carries a
`revokeAt`; both URLs are checked, not just the first (the two-key shape used to
be refused outright, which is why that loop could not run before). A page-only
entry still calls no vendor.

Evidence: 22-mutant ledger, 22 killed, 0 survivors, 0 named-arm misses, no site
mismatches, all pristine copies restored (baseline 52 passed). M22 removes the
strip from the PATCH call site and dies on the new arm, which is what makes "a
PATCH cannot write it" measured. Touched suites 57/57; neighbourhood 25 suites /
291 tests / 0 failed. eslint finding multisets identical to the branch base on
all five pre-existing source files and both pre-existing test files (+0/-0); the
one new .js suite adds 8 findings, all of them the `import/no-unresolved` +
`import/extensions` pair for each of its four relative `.ts` requires, which is
ambient for a new file in `backend/__tests__` (the resolver's `files: ['**/*.ts']`
override). tsc clean on every touched file.
lilyshen0722 added a commit to thantiklermcirony/commonly that referenced this pull request Oct 9, 2026
…voke that takes (Team-Commonly#2035)

Removing a hosted Connection is the one sequence with a vendor step, and its
order is load-bearing: grants, row, provider, mark, material, delete. Grants
first because the granter's own revoke resolves ownership through
`findConnection`, so a deleted row orphans them (TASK-145); row second because
the broker refuses a row carrying `revokedAt` from that instant; provider third
while the material is still there; then the mark; material and delete last so a
failed vendor revoke leaves a row a retry can finish.

The mark is the fold's centre. A result code dies with the request and a retry
reads only the row, so a provider revoke that took and a step 4/5 that failed
used to strand the row: the retry found a dead reference and answered
`provider_revoke_failed` forever (Vera 75638, measured). The mark is written
BEFORE any material goes, is server-owned so a PATCH cannot write it, and a
retry that finds it skips the vendor. A failure after it returns
`provider_revoked_removal_incomplete`, which says the revoke happened so the
retry does not call the vendor again.

Only a 2xx on a token we hold counts as revoked (Wren 75660). The
`invalid_grant` arm is dropped: RFC 7009 answers a token already gone with 200,
while RFC 6749 §5.2 also gives `invalid_grant` for a token "issued to another
client" — and our CIMD client id is rebuilt from the API host at call time
(`resolvedClientId`), so after a host move a LIVE token answers it. Counting it
deletes the material and records a revoke that never happened.

The material read discriminates on the error's `code`, never its class: only
`connector_secret_not_found` means we hold nothing to revoke, and that case
finishes and hands the person the page. `connector_secret_configuration_invalid`
and `connector_secret_key_missing` keep the row, or one misconfigured key ring
would delete every hosted row that day while recording the vendor revoke as
done (Vera 75662). Nothing is ever sent as `token: ""` — the token is the
refresh reference or the access one, and a blank or absent secret means send
nothing, finish, and hand over the page.

The mark's OWN comment was wrong about why a PATCH cannot write it, and the fix
is a measurement rather than a rewording. `stripServerOwnedConfig` is defined at
`routes/integrations.ts:65` and called on the PATCH body at `:750`, and the write
loop at `:757` iterates `Object.keys(incoming)`, where `incoming = relay.next` is
that stripped copy — so a server-owned key never reaches the loop at all. The
explicit refusals (`linkedUserId`, `botToken`) are a different mechanism that
covers two keys; the strip is what covers the rest, the mark included. Both
comments now name that mechanism and the sites, and
`integrations.serverOwnedConfig.test.js` pins it: a PATCH supplying the mark does
not write it, while `liveRelay` in the same body is written, which is the
acceptance control that makes the absence evidence about the strip rather than a
request that never reached a write. (`chatId` was the wrong control — it is on
the list too.)

The token is the one the ROW NAMES, and there is no fallback past a missing one
(Wren 75713): a named refresh reference is sent, otherwise the access token, and
a not-found read of the named one sends nothing and finishes with the page. A
fallback would try to revoke a grant we may still hold — RFC 7009 §2.1 makes an
access-token revoke a MAY, so the refresh token can survive it. The arm that
says so counts the reads, because its mock throws for every reference and a
fallback would otherwise look identical.

Per Team-Commonly#2037 the entry's `revoke` is now a `page` always and an `endpoint` only
when the AS advertises one, so every refusal and every success carries a
`revokeAt`; both URLs are checked, not just the first (the two-key shape used to
be refused outright, which is why that loop could not run before). A page-only
entry still calls no vendor.

Evidence: 22-mutant ledger, 22 killed, 0 survivors, 0 named-arm misses, no site
mismatches, all pristine copies restored (baseline 52 passed). M22 removes the
strip from the PATCH call site and dies on the new arm, which is what makes "a
PATCH cannot write it" measured. Touched suites 57/57; neighbourhood 25 suites /
291 tests / 0 failed. eslint finding multisets identical to the branch base on
all five pre-existing source files and both pre-existing test files (+0/-0); the
one new .js suite adds 8 findings, all of them the `import/no-unresolved` +
`import/extensions` pair for each of its four relative `.ts` requires, which is
ambient for a new file in `backend/__tests__` (the resolver's `files: ['**/*.ts']`
override). tsc clean on every touched file.
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.

1 participant