feat: VersionGuard — newer-major sidecars are read-only with one warning (F5 SLICE-2, INV-16/PUC-4, #14)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ import { buildFingerprint, resolve, type OffsetRange } from "./anchorer";
|
||||
import { gitUserEmail } from "./identity";
|
||||
import { applyChange, coalesce, type LiveSpan } from "./attributionTracker";
|
||||
import { minimizeReplace, PendingEditRegistry } from "./pendingEdits";
|
||||
import type { VersionGuard } from "./versionGuard";
|
||||
|
||||
/** Test-facing snapshot of live attribution state for a document. */
|
||||
export interface RenderedSpan {
|
||||
@@ -62,7 +63,11 @@ export class AttributionController implements vscode.Disposable {
|
||||
private readonly output = vscode.window.createOutputChannel("Cowriting Attribution");
|
||||
private visible = true;
|
||||
|
||||
constructor(private readonly store: CoauthorStore, private readonly rootDir: string) {
|
||||
constructor(
|
||||
private readonly store: CoauthorStore,
|
||||
private readonly rootDir: string,
|
||||
private readonly guard: VersionGuard,
|
||||
) {
|
||||
this.disposables.push(this.agentType, this.humanType, this.statusItem, this.output);
|
||||
this.disposables.push(
|
||||
vscode.commands.registerCommand("cowriting.toggleAttribution", () => this.toggle()),
|
||||
@@ -277,6 +282,7 @@ export class AttributionController implements vscode.Disposable {
|
||||
|
||||
private onDidSave(document: vscode.TextDocument): void {
|
||||
if (!this.isTracked(document)) return;
|
||||
if (this.guard.isReadOnly(this.docPathOf(document.uri))) return;
|
||||
const docPath = this.docPathOf(document.uri);
|
||||
const s = this.docs.get(docPath);
|
||||
// Allow save when hadAttributions is true even if spans/orphans are now empty:
|
||||
|
||||
Reference in New Issue
Block a user