@davmash/bygone 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,163 @@
1
+ # Pinned evidence and live repair
2
+
3
+ Evidence Review connects a saved requirement to exact Git source, then offers an
4
+ explicit handoff to Bygone's existing synchronized VS Code editor. The saved
5
+ review stays pinned while you edit. This is an inspection aid: a valid source
6
+ reference, a passing recorded command, and a human inspection are separate facts.
7
+ None is an automatic approval or proof that a requirement is fulfilled.
8
+
9
+ ## Load and inspect
10
+
11
+ Use **Bygone: Open Evidence Review** in a trusted local VS Code workspace and
12
+ choose a version 2 review JSON file. The selected workspace binds the artifact to
13
+ a local repository. Bygone requires both immutable commits to exist there and
14
+ validates referenced text against Git; the repository label is descriptive, not
15
+ an authenticated remote identity. Dirty files are excluded from the review.
16
+
17
+ The view shows quoted source material, questions, valid and broken links,
18
+ recorded executions, inspection notes, analysis limits, and changed files with
19
+ no valid evidence link. A linked file can still contain unexplained changes.
20
+ Use **Pinned source** for the exact range or **Pinned file diff** for context.
21
+ Both are read-only. Deleted/missing counterparts remain historical evidence.
22
+
23
+ The CLI exposes the same inspection and refresh policy:
24
+
25
+ ```sh
26
+ bygone -C /path/to/repo evidence inspect review.json
27
+ bygone -C /path/to/repo evidence import exported-review.json --output imported.json
28
+ bygone -C /path/to/repo evidence inspect imported.json --dependencies dependencies.json
29
+ bygone -C /path/to/repo evidence tour imported.json --output evidence.bygone
30
+ bygone -C /path/to/repo present --tour evidence.bygone
31
+ ```
32
+
33
+ Import validates source references and removes carried inspection decisions.
34
+ The versioned review model is in `src/requirements.ts`. Old exports with only
35
+ branch names or timestamps cannot be imported as pinned evidence. All output
36
+ commands require new files; existing artifacts are never overwritten.
37
+
38
+ ## Edit, return, refresh
39
+
40
+ **Edit working counterpart** maps the exact cited snapshot/range to the current
41
+ working document. Whole-declaration mapping uses existing Strand JS/TS analysis.
42
+ Identical file content can retain an exact range. Ambiguous mappings, partial
43
+ ranges in changed files, and unsupported syntax fall back to full-file context;
44
+ no match is inferred from a name or reused offset. Git-reported renames preserve before/after paths. An absent working counterpart
45
+ opens read-only historical source instead. **Edit working file** explicitly opens full-file
46
+ context without symbol mapping.
47
+
48
+ The left side is the cited immutable snapshot; the right side is the live VS Code
49
+ `TextDocument`. The existing version/range-guarded bridge owns edits, dirty state,
50
+ save, undo, and recovery. Staging remains VS Code Git's responsibility. Returning
51
+ with the **Return to Evidence Review** toolbar button or command restores the pinned review panel and
52
+ its scroll position while that panel remains open; a closed panel is recreated.
53
+ Editing or saving does not change its claims. Following's
54
+ **Resume** deliberately leaves the review snapshot and returns to ordinary HEAD
55
+ following.
56
+
57
+ After committing a repair, choose **Refresh to committed revision**. Supply a
58
+ validated correspondence artifact for old-head → new-head to relocate changed
59
+ whole declarations, or refresh unchanged files only and leave changed evidence
60
+ unresolved. The new head must descend from the captured head; rewritten or unrelated history
61
+ requires a separately imported review. The original PR baseline is preserved. A head delta is not a new
62
+ whole-PR comparison. New comparisons require renewed inspection, even if cited
63
+ bytes match; notes remain visible.
64
+
65
+ ```sh
66
+ bygone evidence refresh review.json --head <new-commit> \
67
+ --correspondence old-head-to-new-head.json --output refreshed.json
68
+ bygone evidence refresh review.json --head <same-commit> \
69
+ --requirements edited-review.json --output reworded.json
70
+ bygone evidence tour refreshed.json --output refreshed.bygone
71
+ ```
72
+
73
+ The requirement-only option takes the edited requirement array from a complete
74
+ review document with the same repository/base/head identity; its IDs must remain compatible with existing links/questions.
75
+ Regenerate a current tour after repairs. Keep deliberately historical tours and
76
+ reviews pinned. **Record inspection in new artifact** saves a fingerprint and
77
+ note, not approval, and never overwrites the source artifact.
78
+
79
+ ## Producer boundary
80
+
81
+ Bygone consumes the version 2 review shape from compatible producers, including
82
+ the PR Reviewer bridge. Producers must capture immutable comparison identities
83
+ and retain the original source quotations in their saved snapshots. A later push
84
+ must not relabel historical evidence.
85
+
86
+ Unmapped anchors, producer-reported unexplained hunks, overflow counts, and
87
+ unavailable discussion capture are listed as limitations; producer assessments
88
+ remain rationale. Unexplained-change line labels are retained as unvalidated
89
+ producer context, not source anchors. File-level linked coverage does not
90
+ establish coverage of every hunk. Checklists, discussions, publication state,
91
+ and approvals remain in the producing system; they are not Bygone decisions or
92
+ execution records. Exports without immutable capture cannot be imported as pinned
93
+ evidence.
94
+
95
+ The producer receipt digest identifies the initial exported projection. Its hashing recipe is recorded in the analysis scope: replace that receipt digest with 64 zeroes, serialize sorted keys as compact UTF-8 JSON without ASCII escaping, then SHA-256. It is not authentication or a checksum of later review edits; refresh retains historical provenance.
96
+
97
+ ## Dependency-guided inspection and limits
98
+
99
+ Load an existing `bygone dependencies` report for exactly the review's merge-base
100
+ and head. Navigation includes reported added/removed module edges, direct
101
+ unchanged consumers, and initialization sites, with phase, loading, and resolution labels.
102
+ Source ranges, content digests, blob IDs, and comparison identities are checked
103
+ against Git. Producer coverage, omissions, diagnostics, and assumptions remain
104
+ visible. Imported summaries must match all inventory identity fields. Validation
105
+ checks referenced file counts and bytes against reported coverage and declared
106
+ limits (up to 16 MiB per snapshot, 32 MiB across both), and applies the declared time budget to local validation/Git reads.
107
+ Records provide only a lower bound on producer input: files without sites and
108
+ resolver-only inputs are not reconstructible from the report, nor is the original
109
+ producer's elapsed time independently verifiable.
110
+
111
+ This is syntactic module evidence, not a semantic call graph or runtime trace.
112
+ Changing an imported binding within the same module can leave graph edges
113
+ unchanged. New TypeScript syntax/options, malformed package metadata, and input
114
+ budgets can limit resolution. No graph change is never proof of behavioral safety.
115
+
116
+ Hosts bound JSON/source sizes and refuse oversized or non-text evidence rather
117
+ than silently reporting it as complete. Live editing retains its existing
118
+ 128 KiB/5,000-line limit. Remote workspaces and untrusted workspaces are not
119
+ supported by this first host. The web viewer explains when Symbols is unavailable
120
+ because no validated correspondence artifact was supplied.
121
+
122
+ Keep issue decisions, CI, approval, and merge in their existing systems. A review
123
+ can use ordinary diffs and equivalent source links; a tour is optional. Evidence
124
+ artifacts should be retained only when they help inspect, reproduce, or hand off
125
+ the review, not as a mandatory second task ledger.
126
+
127
+ ## Verification record
128
+
129
+ Implementation was based on `dda37567` after the dependency validation work
130
+ landed. Local verification on 2026-10-26 covered:
131
+
132
+ - Bygone's legacy runner and all 503 Node tests, TypeScript checking, ESLint,
133
+ bundle budgets, VSIX packaging, and npm packaging/dry-run. The staged npm CLI
134
+ also inspected a real pinned review successfully.
135
+ - Producer interoperability: exported review → Bygone import → validated tour.
136
+ - A fresh Linux ARM64 Lima checkout: 9 evidence handoff checks, 29 SCM checks,
137
+ and 16 original following checks on each of VS Code 1.74.0 and 1.143.1. These
138
+ exercise the real Extension Host and Monaco, including dirty text, shared undo,
139
+ intervening native edits, slice boundaries, index preservation, rename/missing
140
+ counterparts, explicit refresh, and unsupported-symbol fallback.
141
+ The evidence suite was repeated after the workflow fixes; the SCM/following
142
+ results cover the unchanged editing bridges from earlier in this implementation.
143
+ The final evidence rerun includes switching or closing the review while a real
144
+ symbol worker is pending; a stale result cannot replace the comparison or its
145
+ return context. Import rejects inconsistent file and unresolved-edge counters.
146
+
147
+ To rerun the handoff suite after compiling:
148
+
149
+ ```sh
150
+ BYGONE_EVIDENCE_TEST=1 BYGONE_VSCODE_EXECUTABLE=/path/to/code \
151
+ xvfb-run -a node scripts/test-following.mjs
152
+ ```
153
+
154
+ A retrospective fixture for merged SCM repair `c7219ed0` validated one quoted
155
+ requirement and two exact implementation/test links, generated a pinned tour,
156
+ and left three other changed files explicitly uncovered. It recorded no test
157
+ execution or approval merely because the linked test exists. The same source
158
+ was inspected through an ordinary diff. The evidence view retains requirement,
159
+ range, and freshness context; no human review-time or comprehension advantage
160
+ was measured. This is a functional comparison, not a usability study.
161
+
162
+ Not verified here: live producer API/model runs, manual browser visual QA, Windows/macOS Extension Hosts, remote workspaces, or a human paired
163
+ review trial. No release was published by these checks.
@@ -139,7 +139,8 @@ VS Code's native Search rather than another bundled ripgrep process.
139
139
  | --- | --- | --- |
140
140
  | `bygone`, paths, `--diff`, `--history`, `--git-diff`, `--read-only`, `review` | Launch Explore sessions | Core launcher; desktop owns writes; `--read-only` is a persisted capability ceiling for that launch |
141
141
  | `present` and `present --tour` | Launch Present sessions | Core, read-only presentation |
142
- | `tour context` | Produce a bounded provider-neutral change dossier | Authoring support, read-only |
142
+ | `tour context` | Produce a bounded provider-neutral change dossier; optional `--dependencies` adds static JS/TS evidence | Node CLI authoring support, read-only |
143
+ | `dependencies` | Compare committed module edges and identify unchanged consumers, with source navigation links | Experimental Node CLI analysis, read-only except explicit output files; no runtime execution |
143
144
  | `tour validate`, `compile`, `schema`, and coverage options | Validate exact evidence and build repository-bound manifests | Advanced authoring, read-only except explicit output files |
144
145
  | `completion` | Generate shell completions from the shared command specification | Supporting tooling |
145
146
 
@@ -0,0 +1,183 @@
1
+ # VS Code SCM, symbols and document editing
2
+
3
+ The contextual Bygone panel uses VS Code's built-in Git API for repository
4
+ identity and change notifications. Source Control actions choose HEAD → index
5
+ or index → working document. Ordinary source following chooses HEAD → working
6
+ document. Symbol navigation changes the focus within that comparison, never
7
+ its revisions. Native SCM diff following is opt-in.
8
+
9
+ ## Snapshot and edit contract
10
+
11
+ `followController.ts` owns the comparison and captured endpoints. HEAD and index
12
+ reads are checked again before publication; working content comes from the open
13
+ `TextDocument`, including unsaved edits. Each policy reads only its endpoints.
14
+ Staged comparisons therefore remain usable even if unrelated working bytes are
15
+ binary or oversized. Git renames retain separate source and destination paths.
16
+
17
+ The installed document-symbol provider identifies the enclosing declaration.
18
+ `liveSymbols.ts` runs Strand's existing inventory and correspondence matcher in
19
+ a cancelable worker. Whole-snapshot and symbol-substring digests are checked
20
+ before accepting ranges. Dirty-to-staged navigation needs an accepted mapping;
21
+ matching names or offsets are insufficient. Committed correspondence artifacts
22
+ and their validation contract are unchanged.
23
+
24
+ Native insertions exactly at either edge of a focused symbol return to file
25
+ context: the inserted text may belong to that declaration or its neighbor.
26
+ Boundary edits made inside Bygone retain the known slice binding. Edits strictly
27
+ inside a slice and shifts caused by edits before it continue to track normally.
28
+
29
+ Working full-file views and symbol slices are projections of the same document.
30
+ `followSync.js` allows one edit in flight and keeps subsequent typing until an
31
+ acknowledgment. `followEdits.ts` computes a granular replacement, preserving
32
+ unrelated text and UTF-16/CRLF boundaries. Before submission, the controller
33
+ checks the projection identity, document version, range and content. An older
34
+ token from an unchanged refresh is accepted only when all those checks still
35
+ match the current projection; a changed version is always rejected. There is no
36
+ asynchronous gap between that check and `workspace.applyEdit`.
37
+
38
+ VS Code's extension host attaches the open document's version to bulk text edits;
39
+ the main thread rejects a changed version before applying them. See the
40
+ [1.74 extension-host bulk edit implementation](https://github.com/microsoft/vscode/blob/1.74.0/src/vs/workbench/api/common/extHostBulkEdits.ts)
41
+ and [main-thread validation](https://github.com/microsoft/vscode/blob/1.74.0/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.ts).
42
+ The integration suite submits competing native and Bygone edits without waiting
43
+ between them and verifies rejection rather than an overwritten native edit.
44
+
45
+ Rejected drafts open in untitled recovery documents. Pending text is also kept
46
+ in workspace state for restoration. Draft clearing is guarded against newer
47
+ drafts. Save, undo and redo operate on the authoritative VS Code document; typing
48
+ does not save or stage. Other comparison panels observe the document change.
49
+ The existing manual two-way bridge also checks its base text and document version.
50
+
51
+ Save, undo and redo retain the document binding from when they were requested.
52
+ Commands queued behind an edit execute in order, including repeated undo requests.
53
+ If the comparison changes before a document command executes, Bygone rejects it
54
+ with a notice rather than applying it to the new document. Recovery deduplicates
55
+ a draft only against an entire current, version-validated projection; a matching
56
+ prefix or an obsolete snapshot is insufficient.
57
+
58
+ Pin freezes the target, historical snapshots and symbol focus. A pinned working
59
+ projection remains editable. Repository changes produce a notice until Resume;
60
+ unpinned comparisons keep their policy when a file leaves its SCM group.
61
+ Live staged and working comparisons reconcile Git-reported rename paths while
62
+ preserving their comparison policy. A captured staged pin remains
63
+ visible even if the live index enters a conflict; Resume checks the current
64
+ index again. Working-change actions also appear in Git's separate untracked group.
65
+ If the Git API repository disappears, live SCM comparisons become unavailable
66
+ until it returns. Captured staged pins remain read-only and explicitly report
67
+ that Git integration is unavailable; Resume requires the repository again.
68
+
69
+ ## Supported scope and budgets
70
+
71
+ - Trusted local text files; maximum 128 KiB and 5,000 lines per endpoint.
72
+ - JavaScript/TypeScript symbol analysis, including JSX/TSX, for the selected file
73
+ pair or Git-reported rename. No repository-wide cross-file symbol matching.
74
+ - HEAD/index/absent endpoints are read-only. Conflicts, binary/invalid text and
75
+ unsupported editor inputs have explicit unavailable states.
76
+ - The matcher allows 300 ms, 20,000 candidate comparisons and 2,000 result records.
77
+ A 2.5-second worker deadline also bounds inventory/parsing and startup. Cancellation
78
+ terminates stale workers. File rendering does not wait for optional analysis.
79
+ - Missing, ambiguous or budget-limited correspondence retains file context or a
80
+ known one-sided slice; it never supplies an inferred counterpart. Invalid syntax
81
+ during typing retains the guarded editable range until it can be analyzed again.
82
+
83
+ ## Reproducing verification
84
+
85
+ Run the normal checks from a clean dependency install:
86
+
87
+ ```sh
88
+ npm ci
89
+ npm test
90
+ npm run lint
91
+ npm run bundle:check
92
+ npm run package:vsix
93
+ ```
94
+
95
+ The Extension Host runner makes disposable synthetic repositories and a disposable
96
+ extension profile. It never stages, commits or checks out the developer's repository.
97
+ On Linux with Xvfb and an installed VS Code binary:
98
+
99
+ ```sh
100
+ BYGONE_VSCODE_EXECUTABLE=/path/to/code xvfb-run -a node scripts/test-following.mjs
101
+ BYGONE_SCM_TEST=1 BYGONE_VSCODE_EXECUTABLE=/path/to/code xvfb-run -a node scripts/test-following.mjs
102
+ ```
103
+
104
+ Set `BYGONE_VSCODE_VERSION` instead to let the runner download a version. Compile
105
+ first (`npm test` includes compilation). The SCM suite injects a renderer driver
106
+ only into the disposable test bundle, so it exercises actual Monaco edits and
107
+ messages without adding production test commands.
108
+
109
+ ## Verification record: 2026-10-24
110
+
111
+ Implementation branch: `feat/vscode-scm-symbol-integration`, based on
112
+ `ec318cfbd9d9cddef2fcac150723958c0f7987c2`. These checks ran against the feature
113
+ implementation before its initial commit, not a published release.
114
+
115
+ | Check | Result |
116
+ | --- | --- |
117
+ | Regression suite | 433 Node tests plus the existing diff-engine runner passed |
118
+ | TypeScript, ESLint, renderer size budgets | Passed |
119
+ | VSIX contents and packaging | Passed; 14 archive entries, 2.65 MB compressed, including the 3.39 MiB Strand worker |
120
+ | Original following suite | 16 cases passed on VS Code 1.74.0 and 1.143.1, Linux ARM64 in a fresh Lima guest checkout |
121
+ | SCM/symbol/editing suite | 19 cases passed on both versions; staged/dirty separation, full-file and slice edits, save/shared undo/redo, range shifts, temporary syntax errors, concurrent rejection/recovery, composition across unchanged refreshes, rapid typing, multiple panels, exact snapshot reveal, native Git lifecycle and disabled-Git fallback |
122
+ | Snapshot fixtures | Added/deleted/renamed files, unborn HEAD, linked worktrees, multiple repositories, conflict stages, encoding/binary/size rejection |
123
+ | Symbol adapter | Renames, duplicate method names, unmatched additions, digest/range validation and worker cancellation |
124
+
125
+ Cold worker measurements in the same Linux ARM64 guest (three runs per input,
126
+ adding an unsaved prefix; no warm worker reuse):
127
+
128
+ | Input | Bytes | Symbols / accepted pairs | Elapsed |
129
+ | --- | ---: | ---: | ---: |
130
+ | `followEdits.ts` | 2,272 | 6 / 6 | 109–153 ms |
131
+ | `gitIntegration.ts` | 4,403 | 22 / 22 | 111–171 ms |
132
+ | `followController.ts` | 35,789 | 70 / 70 | 222–238 ms |
133
+ | 50 repetitive generated functions | 3,380 | 50 / 0 (record budget) | 122–130 ms |
134
+ | 500 repetitive generated functions | 34,781 | 500 / 0 (candidate budget) | 186–202 ms |
135
+
136
+ These are bounded fixture observations, not a general latency guarantee.
137
+ The repetitive cases deliberately demonstrate safe budget fallbacks.
138
+
139
+ Verification limits: IME coverage dispatches composition events in real Monaco;
140
+ it does not drive an operating-system input method. Symbol navigation exercises
141
+ the installed TypeScript provider and command-generated cursor selections, not
142
+ physical clicks in Outline/Go to Symbol. Restoration exercises the serializer
143
+ and persisted-draft constructor path, not a whole application restart. Remote and
144
+ untrusted workspace guards were inspected; a remote host and restricted-mode
145
+ window were not launched. macOS/Windows Extension Hosts, marketplace installation,
146
+ release CI and publication were not exercised.
147
+
148
+ ## Review-fix verification: 2026-10-26
149
+
150
+ The fixes applied over `cfd5e335d75f2be324c0865abe4c2f5bdece06f5` passed
151
+ 435 Node tests plus the existing diff-engine runner, TypeScript compilation,
152
+ ESLint, renderer size budgets and VSIX packaging. In a fresh Linux ARM64 Lima
153
+ checkout, all 25 SCM cases and all 16 original following cases passed on each
154
+ of VS Code 1.74.0 and 1.143.1. Host and guest source/test SHA-256 hashes matched.
155
+
156
+ Six added Extension Host cases cover complete rejected deletion/reversion recovery,
157
+ deferred Save/Undo/Redo across a comparison switch, repeated Undo followed by
158
+ Save and Pin, a live staged rename, conflict-after-staged-pin, and separate
159
+ untracked resources. The untracked case checks the contributed menu conditions
160
+ and executes the command with a resource argument; it does not physically click
161
+ the SCM menu. The earlier platform, IME, restart, remote/restricted-host and
162
+ release-verification limits still apply.
163
+
164
+ ## Rebase and follow-up fixes: 2026-10-26
165
+
166
+ Rebased onto main `728f41e6`, preserving both the requirements and VS Code
167
+ build/test entries. The rebased changes passed 464 Node tests plus the existing
168
+ diff-engine runner. Final source passed TypeScript, ESLint, renderer size budgets
169
+ and VSIX packaging. A fresh Linux ARM64 Lima checkout passed all 29 SCM cases
170
+ and all 16 following cases on each of VS Code 1.74.0 and 1.143.1.
171
+
172
+ New regressions cover native insertions at both symbol boundaries, index refresh
173
+ for two-dot filenames, live working comparisons through successive staged
174
+ renames, loss/recovery of the Git API in an already-open comparison, and the
175
+ explicit read-only snapshot behavior of a staged pin while Git is unavailable.
176
+ The platform and interaction limits above still apply; hosted CI was not run.
177
+
178
+ ## Pinned evidence handoff
179
+
180
+ [Evidence Review](evidence-review.md) uses this same editing bridge for full-file
181
+ and exact symbol projections. Its left endpoint is an immutable cited snapshot,
182
+ and its Return action restores the originating review. It does not stage files
183
+ or alter saved evidence while editing.