mirror of
https://github.com/stablyai/orca.git
synced 2026-11-04 11:07:42 +00:00
Combine the completed comment cleanup from 319 stacked PRs into one change against `main`, so the full CI suite validates the combined result once. This replaces the previous audit stack; no additional audit work is included. The change shortens redundant comments across 2,753 source and shell-snapshot files (25,235 net lines removed). Conflicts preserve current-main executable code. Runtime behavior, test assertions, directives, licenses, generated notices, SAFETY rationales, and compatibility markers are preserved. The audit tracker remains local, outside the repository. Validation: - Equivalent source/emitted AST and executable tokens across all 2,750 source files, with separate checks for embedded shell, SQL, JavaScript, CSS, and generated fixtures. - Identical executable lines in the three shell snapshots; protected comments unchanged. - Changed-code quality gate passed with no new findings. - 358 tests passed, 2 skipped across 23 focused test files. - `git diff --check` passed.
67 lines
2.4 KiB
TypeScript
67 lines
2.4 KiB
TypeScript
import type {
|
|
BrowserClientHostedPageInventory,
|
|
BrowserClientHostCommandEvent,
|
|
BrowserClientHostLeaseAuthority
|
|
} from '../../shared/browser-client-host-protocol'
|
|
|
|
type BrowserClientPageAuthority = Pick<
|
|
BrowserClientHostedPageInventory,
|
|
| 'authorityRuntimeId'
|
|
| 'authorityEpoch'
|
|
| 'browserHostClientId'
|
|
| 'browserHostGeneration'
|
|
| 'pageHostGeneration'
|
|
>
|
|
|
|
export function assertBrowserClientHostCommandAuthority(
|
|
authority: BrowserClientHostLeaseAuthority,
|
|
command: BrowserClientHostCommandEvent
|
|
): void {
|
|
if (
|
|
command.pageCommandProtocolVersion !== authority.pageCommandProtocolVersion ||
|
|
command.pageReconciliationProtocolVersion !== authority.pageReconciliationProtocolVersion ||
|
|
command.authorityRuntimeId !== authority.authorityRuntimeId ||
|
|
command.authorityEpoch !== authority.authorityEpoch ||
|
|
command.browserHostClientId !== authority.browserHostClientId ||
|
|
command.browserHostGeneration !== authority.browserHostGeneration
|
|
) {
|
|
throw new Error('browser_host_command_authority_stale')
|
|
}
|
|
}
|
|
|
|
export function snapshotBrowserClientHostLeaseAuthority(
|
|
authority: BrowserClientHostLeaseAuthority
|
|
): BrowserClientHostLeaseAuthority {
|
|
return Object.freeze({ ...authority })
|
|
}
|
|
|
|
/** File-channel renegotiation affects transfers only; it must not fence hosted pages. */
|
|
export function sameBrowserClientHostLeaseAuthority(
|
|
left: BrowserClientHostLeaseAuthority,
|
|
right: BrowserClientHostLeaseAuthority
|
|
): boolean {
|
|
return (
|
|
left.authorityRuntimeId === right.authorityRuntimeId &&
|
|
left.authorityEpoch === right.authorityEpoch &&
|
|
left.browserHostClientId === right.browserHostClientId &&
|
|
left.browserHostGeneration === right.browserHostGeneration &&
|
|
left.pageCommandProtocolVersion === right.pageCommandProtocolVersion &&
|
|
left.pageInventoryProtocolVersion === right.pageInventoryProtocolVersion &&
|
|
left.leaseReconnectProtocolVersion === right.leaseReconnectProtocolVersion &&
|
|
left.pageReconciliationProtocolVersion === right.pageReconciliationProtocolVersion
|
|
)
|
|
}
|
|
|
|
export function sameBrowserClientPageAuthority(
|
|
left: BrowserClientPageAuthority,
|
|
right: BrowserClientPageAuthority
|
|
): boolean {
|
|
return (
|
|
left.authorityRuntimeId === right.authorityRuntimeId &&
|
|
left.authorityEpoch === right.authorityEpoch &&
|
|
left.browserHostClientId === right.browserHostClientId &&
|
|
left.browserHostGeneration === right.browserHostGeneration &&
|
|
left.pageHostGeneration === right.pageHostGeneration
|
|
)
|
|
}
|