Skip to content

Commit b75e645

Browse files
docs: update.
1 parent 61a9ee2 commit b75e645

2 files changed

Lines changed: 27 additions & 5 deletions

File tree

docs/idb-workspace-state.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,24 @@ If a value is required to accurately restore PR/workspace behavior after reload,
4646

4747
`localStorage` should only mirror user preferences and lightweight bootstrap values.
4848

49+
## Post-Push Baseline Invariant
50+
51+
After a successful Push Commit action for an active PR workspace:
52+
53+
- The active workspace record must persist immediately in IDB.
54+
- Any committed tab path returned by push updates must persist with:
55+
- `isDirty = false`
56+
- `syncedContent = content`
57+
- `syncedAt` updated to the push/reconcile time
58+
- `lastSyncedRemoteSha` set when a commit SHA is available
59+
- The same clean baseline must survive a full page reload.
60+
61+
Dirty-state note:
62+
63+
- When `syncedContent` is present for a tab, canonical dirty state is derived from
64+
`content !== syncedContent`.
65+
- This prevents stale UI-only dirty flags from overriding persisted sync baseline truth.
66+
4967
## Behavioral Spec
5068

5169
For action-level drawer semantics and state machine behavior, see:

docs/pr-context-storage-matrix.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ See the full storage ownership docs for non-PR keys:
3434

3535
Use this matrix as the source of truth when debugging UI/storage mismatch.
3636

37-
| Scenario | IDB `prContextState` | IDB `prNumber` | localStorage PR fields | Notes |
38-
| ----------------------------------------- | -------------------- | ---------------- | ---------------------- | ---------------------------------------------------- |
39-
| A. Local workspace only, no PR context | `inactive` | `null` | none | No connected PR context. |
40-
| B. Workspace is for an active, open PR | `active` | PR number | none | Push mode in PR controls. |
41-
| C. Workspace is for a PR closed on GitHub | `closed` | closed PR number | none | Historical context retained for debugging/reference. |
37+
| Scenario | IDB `prContextState` | IDB `prNumber` | localStorage PR fields | Notes |
38+
| ------------------------------------------ | -------------------- | ---------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------- |
39+
| A. Local workspace only, no PR context | `inactive` | `null` | none | No connected PR context. |
40+
| B. Workspace is for an active, open PR | `active` | PR number | none | Push mode in PR controls. |
41+
| C. Workspace is for a PR closed on GitHub | `closed` | closed PR number | none | Historical context retained for debugging/reference. |
42+
| D. Active PR immediately after push commit | `active` | PR number | none | Committed tabs persist clean baseline (`isDirty=false`, `syncedContent=content`) and remain clean after reload. |
4243

4344
## Current Workspace Selection On Load
4445

@@ -80,6 +81,9 @@ When the UI does not match expected PR state:
8081
- `prContextState`
8182
- `prNumber`
8283
- `repo`, `head`, `prTitle`
84+
85+
- committed tab fields: `isDirty`, `syncedContent`, `content`, `syncedAt`, `lastSyncedRemoteSha`
86+
8387
2. Compare against the matrix above.
8488
3. If the PR is still open on GitHub, expect PR controls to return to Push mode and the workspace record to transition back to `active`.
8589
4. If the PR is no longer open, expect Open PR mode to remain and status messaging to explain verification results.

0 commit comments

Comments
 (0)