File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- // Fork-owned seam for the global external-workspace-symlink policy
2- // (RSI-Software/t3code-hyprws#951, reshaping 565594bd75).
3- //
4- // Upstream's read resolver hard-blocks any path whose resolved target leaves
5- // the workspace root. The fork adds a server-authoritative opt-in: when the
6- // `followExternalWorkspaceSymlinks` server setting is enabled, reads may cross
7- // symlinks whose targets are outside the root. The settings service is looked
8- // up optionally so the seam adds no requirement to `WorkspaceFileSystem.layer`
9- // — upstream files and test harnesses keep upstream text, and the production
10- // wiring in `server.ts` provides the service through one marked hook. Without
11- // the service (or on a settings error) the containment guard stays closed.
1+ // Fork seam: reads may cross symlinks whose targets leave the workspace root only when the
2+ // `followExternalWorkspaceSymlinks` server setting is on. The settings service is looked up
3+ // optionally so `WorkspaceFileSystem.layer` gains no requirement; `server.ts` provides it through
4+ // one marked hook. Without it, or on a settings error, the containment guard stays closed.
125import { type ProjectWriteFileInput , projectFileRevision } from "@t3tools/contracts" ;
136import * as Effect from "effect/Effect" ;
147import * as FileSystem from "effect/FileSystem" ;
Original file line number Diff line number Diff line change 11import { projectFileRevision } from "@t3tools/contracts" ;
22
3- // Stale-write guard (RSI-Software/t3code-hyprws#1761): the disk revision each
4- // unsaved draft started from, keyed by the file's optimistic atom. A save sends
5- // it so the server refuses to replace a newer disk version. An entry without a
6- // revision skips the check: the panel never showed disk contents, or the user
7- // chose to overwrite. A saved or reloaded draft holds SETTLED until the next
8- // edit, so an editor still holding it cannot resend it unchecked.
3+ // Stale-write guard: the disk revision each unsaved draft started from, sent on save
4+ // so the server refuses to replace a newer disk version. No revision skips the check
5+ // (disk contents never shown, or the user chose to overwrite). A saved or reloaded draft
6+ // holds SETTLED until the next edit, so a stale editor cannot resend it unchecked.
97const SETTLED = Symbol ( "settled" ) ;
108// Weak keys: a closed file's atom and its settled entry can be collected.
119const draftBases = new WeakMap < object , string | undefined | typeof SETTLED > ( ) ;
Original file line number Diff line number Diff line change 1- // Fork-owned stale-write guard for workspace file saves
2- // (RSI-Software/t3code-hyprws#1761). Client and server hash the same decoded
3- // text, so a save names the disk version its draft started from without
4- // resending that version's contents. Synchronous because `crypto.subtle` is
5- // missing on plain-HTTP remote origins.
1+ // Fork-owned stale-write guard for workspace file saves. Client and server hash the same decoded
2+ // text, so a save names its draft's base disk version without resending it. Synchronous because
3+ // `crypto.subtle` is missing on plain-HTTP remote origins.
64export function projectFileRevision ( contents : string ) : string {
75 let hash = 2_166_136_261 ;
86 for ( let index = 0 ; index < contents . length ; index += 1 ) {
You can’t perform that action at this time.
0 commit comments