golded-ftn-squish 1.2.0__tar.gz

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,8 @@
1
+ .venv/
2
+ __pycache__/
3
+ .pytest_cache/
4
+ .mypy_cache/
5
+ .ruff_cache/
6
+ dist/
7
+ *.egg-info/
8
+ .agent-compose-backup-*/
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ ## 1.2.0 — 2026-10-05
4
+
5
+ Add classic Squish create, append, update and delete sessions. Preserve UIDs and
6
+ raw metadata, maintain active and free chains, validate the complete base before
7
+ mutation, and restore files in place after ordinary write failures. GoldED
8
+ concurrent access remains disabled pending build tests.
9
+
10
+ Preserve omitted routing during body edits and omitted MSGID during control-block replacement. Reject conflicting MSGID controls.
11
+
12
+ ## 1.1.0 — Unreleased
13
+
14
+ Add reported archive reading with index-authoritative UIDs, empty control
15
+ segment recovery and strict ASCII fallback. Bad indexed records are skipped;
16
+ ambiguous index order or overlap stops traversal. Strict reading remains the default.
17
+
18
+ ## 1.0.0 — 2026-10-04
19
+
20
+ - Read classic Squish areas through the active index prefix, preserving UIDs.
21
+ - Validate file bounds, frames, controls and strict decoding before returning.
22
+ - Preserve body, addresses, IDs, dates, reply links and source provenance.
23
+ - Include synthetic fixtures, portable CI and isolated distribution checks.
@@ -0,0 +1,22 @@
1
+ # Contributing
2
+
3
+ Use Python 3.12+ and uv with the sibling `golded-ftn` checkout. Run the checks in
4
+ README before proposing a change. Keep runtime dependencies limited to core.
5
+
6
+ Build fixtures from the original Squish byte layout, independently of reader helpers.
7
+ Use synthetic messages; keep private archives out of tests and distributions.
8
+ Verify changed behavior through `SquishReader.read`, including failures and offsets.
9
+
10
+ Keep this package focused on Squish reading and editing. Area discovery, databases,
11
+ packing and repair belong outside this package. Generated AGENTS.md comes from agent-compose.toml and the
12
+ local project fragment; edit those sources and preview, build, check.
13
+
14
+ Protect writer behavior through the public create/open/read/append/update/delete
15
+ API and independent raw records. Check omitted patch fields, explicit clearing,
16
+ controls in each supported physical placement, reply structures and unrelated
17
+ message revisions. Use controlled helper processes for lock conflicts and the
18
+ internal I/O seam for write, truncate, flush and rollback failures. Never reopen
19
+ the lock file while its operation lock is held. Preserve existing lastread data.
20
+
21
+ Keep GoldED closed during editing. A matching write lock alone does not prove
22
+ safe concurrent reads or refresh; build interoperability remains deferred.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GoldED.dev contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,225 @@
1
+ Metadata-Version: 2.5
2
+ Name: golded-ftn-squish
3
+ Version: 1.2.0
4
+ Summary: Strict reader and offline writer for classic Squish message areas
5
+ Project-URL: Repository, https://github.com/golded-dev/golded-ftn-squish-python
6
+ Project-URL: Issues, https://github.com/golded-dev/golded-ftn-squish-python/issues
7
+ Project-URL: Changelog, https://github.com/golded-dev/golded-ftn-squish-python/blob/main/CHANGELOG.md
8
+ Author: GoldED.dev contributors
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.12
18
+ Requires-Dist: golded-ftn<2,>=1.2.0
19
+ Description-Content-Type: text/markdown
20
+
21
+ # golded-ftn-squish
22
+
23
+ Repository: [`golded-ftn-squish-python`](https://github.com/golded-dev/golded-ftn-squish-python).
24
+ The distribution remains `golded-ftn-squish`; imports use `golded_ftn_squish`.
25
+ The source is public on GitHub. This package has not been released on PyPI.
26
+
27
+ Strict reader and offline writer for classic Squish `.SQD` and `.SQI` message areas. Python 3.12+;
28
+ plain Python, using the models and text helpers from `golded-ftn`.
29
+ Version 1.2.0 is prepared locally; these writer changes are unreleased.
30
+
31
+ ```python
32
+ from pathlib import Path
33
+ from golded_ftn_squish import SquishReader
34
+
35
+ base = Path("messages/general") # basename, without an extension
36
+ for message in SquishReader().read(base):
37
+ print(message.msgno, message.from_name, message.subject)
38
+ ```
39
+
40
+ For a local checkout:
41
+
42
+ ```sh
43
+ git clone https://github.com/golded-dev/golded-ftn-python.git
44
+ git clone https://github.com/golded-dev/golded-ftn-squish-python.git
45
+ cd golded-ftn-squish-python
46
+ uv sync --locked
47
+ ```
48
+
49
+ uv uses the sibling `../golded-ftn-python` repository. Wheels and source
50
+ distributions declare only `golded-ftn>=1.2.0,<2`; the development source override
51
+ and lock file are excluded from the sdist.
52
+
53
+ ## Reading an area
54
+
55
+ `SquishReader.read(path, options=None)` implements `MessageBaseReader`. Pass an
56
+ area basename and optionally core `ReaderOptions(fallback_charset="CP850")`.
57
+ Extensions are matched case-insensitively; ambiguous candidates fail. Both files
58
+ must be regular files. Missing files and wrong file types raise filesystem errors.
59
+ Malformed records and decoding failures raise `ParserException` with the actual
60
+ file path, byte offset and chained cause. All active records are validated before
61
+ the result is returned; a damaged later record never produces a partial result.
62
+
63
+ Read a stable area without concurrent writes. The two files are read separately,
64
+ without locking: this does not create an atomic snapshot.
65
+
66
+ The supported layout has a 256-byte area header, 28-byte frame header, 238-byte
67
+ message header and 12-byte index records. Extended layouts, compressed frames and
68
+ frames being updated are rejected. The area header's message count selects the
69
+ active index prefix; preallocated index tail records are ignored. Active records
70
+ must have increasing, positive unique UIDs and distinct, non-overlapping frames.
71
+ UID gaps and arbitrary unused allocation bytes within a frame are accepted.
72
+ Unindexed old and free frames are ignored; an active record pointing to a free
73
+ frame is an error. `.SQL` lastread data is not used.
74
+
75
+ ## Message mapping
76
+
77
+ - `msgno` is the persistent index UID, not its relative index position. Header
78
+ UID is checked against it only when the `MSGUID` attribute marks it as valid.
79
+ - Names, subject and body decode strictly through core helpers. Charset controls
80
+ in the separate control block precede body declarations. Conflicting
81
+ declarations fail; otherwise core charset aliases and CP850 fallback apply.
82
+ Mojibake repair is left to callers.
83
+ - `body_text` contains only the normalized body payload. Separate header controls
84
+ are preserved in `control_lines`, before body controls. Controls are separated
85
+ by SOH bytes. A final NUL is optional inside the declared length; after the first
86
+ NUL only NUL padding is accepted. Empty controls, trailing SOH and line breaks in
87
+ the control block are rejected. Repeated controls remain in source order.
88
+ - Header and body MSGID/REPLY values must agree; identical repetitions are
89
+ accepted. `external_id` is MSGID, otherwise a core synthetic ID over decoded,
90
+ normalized fields. Routing metadata comes from the combined control parser.
91
+ - Binary addresses preserve node 0 and nonzero points. Incomplete components may
92
+ be supplemented by INTL/FMPT/TOPT, following the MSG package's conflict rules.
93
+ Unresolvable addresses become `None`; binary Squish addresses have no domain.
94
+ - Valid packed `DateWritten` is timezone-aware UTC. The signed writer UTC offset
95
+ does not change it. A zero packed date permits a valid FTSC-date fallback, which
96
+ is timezone-naive. Invalid dates become `None`, without calendar normalization.
97
+ Binary UTC offset and arrival time have no dedicated core fields; existing
98
+ TZUTC controls remain available as metadata.
99
+ - Attributes remain raw. `reply_to_msgno` and `reply1st_msgno` preserve header
100
+ UIDs, with zero mapped to `None`. `reply_next_msgno` is `None`: the remaining
101
+ eight reply slots form a reply list, not a next-sibling pointer. The core model
102
+ cannot represent that full list.
103
+ - Provenance records source type `squish`, the actual SQD path, UID as text and
104
+ frame byte offset. Area metadata and other unknown fields remain `None`.
105
+
106
+ Area discovery, packing, repair and databases are outside this package.
107
+
108
+ ## Development
109
+
110
+ Run `uv run pytest`, `uv run ruff check .`, `uv run ruff format --check .`,
111
+ `uv run mypy` and `uv run python -m mypy.stubtest golded_ftn_squish`.
112
+ Build with `uv build`; then run `uv run twine check dist/*` and
113
+ `uv run python scripts/verify_distribution.py`. The distribution check rebuilds
114
+ from sdist and tests both wheels with a local core wheel in separate environments
115
+ outside the repositories. CI runs these checks on Linux Python 3.12–3.14 and tests
116
+ on Windows/macOS Python 3.14. Local results do not establish a passing CI run.
117
+
118
+ ## Format references
119
+
120
+ The binary layout is documented in the original Maximus
121
+ [Squish structures](https://github.com/fidosoft/maximus/blob/master/msgapi/api_sq.h)
122
+ and [MsgAPI headers](https://github.com/fidosoft/maximus/blob/master/msgapi/msgapi.h).
123
+ [Index allocation](https://github.com/fidosoft/maximus/blob/master/msgapi/sq_idx.c)
124
+ explains the unused tail. GoldED's `gmosqsh.h` and its reader/writer provide a
125
+ second implementation reference. The PHP `laravel-ftn-squish` reader and tests
126
+ provide compatibility context; its silent truncation and corruption handling are
127
+ not copied. Tests use independent synthetic bytes, never private message archives.
128
+
129
+ MIT license. See [CONTRIBUTING.md](CONTRIBUTING.md), [SECURITY.md](SECURITY.md) and
130
+ [release instructions](docs/release.md).
131
+
132
+ ## Archive mode
133
+
134
+ Strict reading remains the default. Archive mode requires a report callback:
135
+
136
+ ```python
137
+ from golded_ftn import ReaderIssue, ReaderOptions
138
+
139
+ issues: list[ReaderIssue] = []
140
+ options = ReaderOptions(archive_mode=True, on_issue=issues.append)
141
+ # Pass options to SquishReader().read(source, options).
142
+ ```
143
+
144
+ Issues carry `recovered`, `skipped` or `stopped`, the actual filename, record
145
+ identity and physical offset. Their detail contains no message contents. A stop
146
+ means the traversal is incomplete; a validated prefix may still be returned.
147
+ Multiple issues can describe one record, including recovery followed by a skip.
148
+ Filesystem errors and callback exceptions propagate. Files must remain stable.
149
+
150
+ The index UID wins over a disagreeing header UID and empty SOH control segments
151
+ are ignored, both with reports. Failed indexed frames or messages are skipped
152
+ using the next index slot. Duplicate offsets, overlapping frame extents, invalid
153
+ UID order and truncated indices stop traversal. Metadata conflicts are skipped.
154
+
155
+ If declared ASCII cannot decode a payload, the configured fallback is tried
156
+ strictly and reported. The original charset control stays unchanged. Other
157
+ decoding failures are skipped; there is no lossy decoding or mojibake repair.
158
+
159
+
160
+ ## Writing an area
161
+
162
+ `SquishWriter.create(path)` creates `.SQD`, `.SQI` and an empty `.SQL` lastread
163
+ file. Existing files are rejected. The base header stores the basename, with
164
+ no extension, in its 80-byte name field. The first new UID is 2, following
165
+ GoldED's initialization. Existing `.SQL` bytes remain untouched by editing.
166
+
167
+ ```python
168
+ from pathlib import Path
169
+
170
+ from golded_ftn import MessagePatch, OutgoingMessage
171
+ from golded_ftn_squish import SquishWriter
172
+
173
+ writer = SquishWriter()
174
+ Path("messages").mkdir(exist_ok=True)
175
+ writer.create("messages/new-area")
176
+ with writer.open("messages/new-area") as session:
177
+ created = session.append(
178
+ OutgoingMessage(
179
+ from_name="Alice",
180
+ to_name="Bob",
181
+ subject="Hello",
182
+ body_text="Body",
183
+ )
184
+ )
185
+ current = session.read(created.identity.msgno)
186
+ changed = session.update(
187
+ current.identity, MessagePatch(subject="Revised"), current.revision
188
+ )
189
+ session.delete(changed.identity, changed.revision)
190
+ ```
191
+
192
+ Sessions acquire byte 0 of `.SQD` per operation, reread the whole base and validate
193
+ the physical frames, both linked lists and the active index before writing.
194
+ Revision tokens include the identity, frame offset and raw message bytes;
195
+ neighbor frame links are excluded because an unrelated append changes them.
196
+ A changed or missing target raises `ConflictError`. Unrelated message changes do
197
+ not invalidate the token. Omitted patch fields retain their values; explicit
198
+ `None` clears only fields the format can represent as absent.
199
+
200
+ Content changes append a new frame and move the old frame to the free list.
201
+ UIDs stay fixed. Free frames are kept for other tools; this writer does not
202
+ recycle, merge or pack them. Header patches preserve omitted raw metadata, all
203
+ nine replies, arrival time, UTC offset and unknown attribute bits. Attribute-only
204
+ changes preserve the original control and text bytes. A body-only patch preserves
205
+ omitted SEEN-BY and PATH routing. Explicit control
206
+ replacement replaces the control block while preserving an omitted `external_id`;
207
+ conflicting MSGID controls are rejected. New names and subjects require room for
208
+ their trailing
209
+ NUL; oversized fields and unencodable text fail instead of being truncated.
210
+ `WriterOptions` selects the strict encoding, CP850 by default. Charset declarations
211
+ must agree when text is serialized. Routing and MSGID are explicit caller data.
212
+
213
+ One operation is the rollback unit. Injected write, truncate and flush failures
214
+ restore watched files in place under the lock. A failed rollback raises
215
+ `RollbackError` and makes the session unusable. This does not promise recovery
216
+ from process termination or power loss. A configured `maxmsgs` limit rejects an
217
+ append at capacity; editing never purges other messages automatically.
218
+
219
+ Use Squish offline with GoldED closed. `concurrent=True` is rejected on every
220
+ platform. macOS is the only runtime tested in this checkout. POSIX record locks
221
+ serialize cooperating Python writers; Linux execution remains unverified. Windows
222
+ has
223
+ a byte-lock implementation but has not been exercised here. GoldED build tests,
224
+ concurrent reading and refresh checks are deferred, so no GoldED build is certified.
225
+ See [writer source notes](docs/writer-sources.md).
@@ -0,0 +1,205 @@
1
+ # golded-ftn-squish
2
+
3
+ Repository: [`golded-ftn-squish-python`](https://github.com/golded-dev/golded-ftn-squish-python).
4
+ The distribution remains `golded-ftn-squish`; imports use `golded_ftn_squish`.
5
+ The source is public on GitHub. This package has not been released on PyPI.
6
+
7
+ Strict reader and offline writer for classic Squish `.SQD` and `.SQI` message areas. Python 3.12+;
8
+ plain Python, using the models and text helpers from `golded-ftn`.
9
+ Version 1.2.0 is prepared locally; these writer changes are unreleased.
10
+
11
+ ```python
12
+ from pathlib import Path
13
+ from golded_ftn_squish import SquishReader
14
+
15
+ base = Path("messages/general") # basename, without an extension
16
+ for message in SquishReader().read(base):
17
+ print(message.msgno, message.from_name, message.subject)
18
+ ```
19
+
20
+ For a local checkout:
21
+
22
+ ```sh
23
+ git clone https://github.com/golded-dev/golded-ftn-python.git
24
+ git clone https://github.com/golded-dev/golded-ftn-squish-python.git
25
+ cd golded-ftn-squish-python
26
+ uv sync --locked
27
+ ```
28
+
29
+ uv uses the sibling `../golded-ftn-python` repository. Wheels and source
30
+ distributions declare only `golded-ftn>=1.2.0,<2`; the development source override
31
+ and lock file are excluded from the sdist.
32
+
33
+ ## Reading an area
34
+
35
+ `SquishReader.read(path, options=None)` implements `MessageBaseReader`. Pass an
36
+ area basename and optionally core `ReaderOptions(fallback_charset="CP850")`.
37
+ Extensions are matched case-insensitively; ambiguous candidates fail. Both files
38
+ must be regular files. Missing files and wrong file types raise filesystem errors.
39
+ Malformed records and decoding failures raise `ParserException` with the actual
40
+ file path, byte offset and chained cause. All active records are validated before
41
+ the result is returned; a damaged later record never produces a partial result.
42
+
43
+ Read a stable area without concurrent writes. The two files are read separately,
44
+ without locking: this does not create an atomic snapshot.
45
+
46
+ The supported layout has a 256-byte area header, 28-byte frame header, 238-byte
47
+ message header and 12-byte index records. Extended layouts, compressed frames and
48
+ frames being updated are rejected. The area header's message count selects the
49
+ active index prefix; preallocated index tail records are ignored. Active records
50
+ must have increasing, positive unique UIDs and distinct, non-overlapping frames.
51
+ UID gaps and arbitrary unused allocation bytes within a frame are accepted.
52
+ Unindexed old and free frames are ignored; an active record pointing to a free
53
+ frame is an error. `.SQL` lastread data is not used.
54
+
55
+ ## Message mapping
56
+
57
+ - `msgno` is the persistent index UID, not its relative index position. Header
58
+ UID is checked against it only when the `MSGUID` attribute marks it as valid.
59
+ - Names, subject and body decode strictly through core helpers. Charset controls
60
+ in the separate control block precede body declarations. Conflicting
61
+ declarations fail; otherwise core charset aliases and CP850 fallback apply.
62
+ Mojibake repair is left to callers.
63
+ - `body_text` contains only the normalized body payload. Separate header controls
64
+ are preserved in `control_lines`, before body controls. Controls are separated
65
+ by SOH bytes. A final NUL is optional inside the declared length; after the first
66
+ NUL only NUL padding is accepted. Empty controls, trailing SOH and line breaks in
67
+ the control block are rejected. Repeated controls remain in source order.
68
+ - Header and body MSGID/REPLY values must agree; identical repetitions are
69
+ accepted. `external_id` is MSGID, otherwise a core synthetic ID over decoded,
70
+ normalized fields. Routing metadata comes from the combined control parser.
71
+ - Binary addresses preserve node 0 and nonzero points. Incomplete components may
72
+ be supplemented by INTL/FMPT/TOPT, following the MSG package's conflict rules.
73
+ Unresolvable addresses become `None`; binary Squish addresses have no domain.
74
+ - Valid packed `DateWritten` is timezone-aware UTC. The signed writer UTC offset
75
+ does not change it. A zero packed date permits a valid FTSC-date fallback, which
76
+ is timezone-naive. Invalid dates become `None`, without calendar normalization.
77
+ Binary UTC offset and arrival time have no dedicated core fields; existing
78
+ TZUTC controls remain available as metadata.
79
+ - Attributes remain raw. `reply_to_msgno` and `reply1st_msgno` preserve header
80
+ UIDs, with zero mapped to `None`. `reply_next_msgno` is `None`: the remaining
81
+ eight reply slots form a reply list, not a next-sibling pointer. The core model
82
+ cannot represent that full list.
83
+ - Provenance records source type `squish`, the actual SQD path, UID as text and
84
+ frame byte offset. Area metadata and other unknown fields remain `None`.
85
+
86
+ Area discovery, packing, repair and databases are outside this package.
87
+
88
+ ## Development
89
+
90
+ Run `uv run pytest`, `uv run ruff check .`, `uv run ruff format --check .`,
91
+ `uv run mypy` and `uv run python -m mypy.stubtest golded_ftn_squish`.
92
+ Build with `uv build`; then run `uv run twine check dist/*` and
93
+ `uv run python scripts/verify_distribution.py`. The distribution check rebuilds
94
+ from sdist and tests both wheels with a local core wheel in separate environments
95
+ outside the repositories. CI runs these checks on Linux Python 3.12–3.14 and tests
96
+ on Windows/macOS Python 3.14. Local results do not establish a passing CI run.
97
+
98
+ ## Format references
99
+
100
+ The binary layout is documented in the original Maximus
101
+ [Squish structures](https://github.com/fidosoft/maximus/blob/master/msgapi/api_sq.h)
102
+ and [MsgAPI headers](https://github.com/fidosoft/maximus/blob/master/msgapi/msgapi.h).
103
+ [Index allocation](https://github.com/fidosoft/maximus/blob/master/msgapi/sq_idx.c)
104
+ explains the unused tail. GoldED's `gmosqsh.h` and its reader/writer provide a
105
+ second implementation reference. The PHP `laravel-ftn-squish` reader and tests
106
+ provide compatibility context; its silent truncation and corruption handling are
107
+ not copied. Tests use independent synthetic bytes, never private message archives.
108
+
109
+ MIT license. See [CONTRIBUTING.md](CONTRIBUTING.md), [SECURITY.md](SECURITY.md) and
110
+ [release instructions](docs/release.md).
111
+
112
+ ## Archive mode
113
+
114
+ Strict reading remains the default. Archive mode requires a report callback:
115
+
116
+ ```python
117
+ from golded_ftn import ReaderIssue, ReaderOptions
118
+
119
+ issues: list[ReaderIssue] = []
120
+ options = ReaderOptions(archive_mode=True, on_issue=issues.append)
121
+ # Pass options to SquishReader().read(source, options).
122
+ ```
123
+
124
+ Issues carry `recovered`, `skipped` or `stopped`, the actual filename, record
125
+ identity and physical offset. Their detail contains no message contents. A stop
126
+ means the traversal is incomplete; a validated prefix may still be returned.
127
+ Multiple issues can describe one record, including recovery followed by a skip.
128
+ Filesystem errors and callback exceptions propagate. Files must remain stable.
129
+
130
+ The index UID wins over a disagreeing header UID and empty SOH control segments
131
+ are ignored, both with reports. Failed indexed frames or messages are skipped
132
+ using the next index slot. Duplicate offsets, overlapping frame extents, invalid
133
+ UID order and truncated indices stop traversal. Metadata conflicts are skipped.
134
+
135
+ If declared ASCII cannot decode a payload, the configured fallback is tried
136
+ strictly and reported. The original charset control stays unchanged. Other
137
+ decoding failures are skipped; there is no lossy decoding or mojibake repair.
138
+
139
+
140
+ ## Writing an area
141
+
142
+ `SquishWriter.create(path)` creates `.SQD`, `.SQI` and an empty `.SQL` lastread
143
+ file. Existing files are rejected. The base header stores the basename, with
144
+ no extension, in its 80-byte name field. The first new UID is 2, following
145
+ GoldED's initialization. Existing `.SQL` bytes remain untouched by editing.
146
+
147
+ ```python
148
+ from pathlib import Path
149
+
150
+ from golded_ftn import MessagePatch, OutgoingMessage
151
+ from golded_ftn_squish import SquishWriter
152
+
153
+ writer = SquishWriter()
154
+ Path("messages").mkdir(exist_ok=True)
155
+ writer.create("messages/new-area")
156
+ with writer.open("messages/new-area") as session:
157
+ created = session.append(
158
+ OutgoingMessage(
159
+ from_name="Alice",
160
+ to_name="Bob",
161
+ subject="Hello",
162
+ body_text="Body",
163
+ )
164
+ )
165
+ current = session.read(created.identity.msgno)
166
+ changed = session.update(
167
+ current.identity, MessagePatch(subject="Revised"), current.revision
168
+ )
169
+ session.delete(changed.identity, changed.revision)
170
+ ```
171
+
172
+ Sessions acquire byte 0 of `.SQD` per operation, reread the whole base and validate
173
+ the physical frames, both linked lists and the active index before writing.
174
+ Revision tokens include the identity, frame offset and raw message bytes;
175
+ neighbor frame links are excluded because an unrelated append changes them.
176
+ A changed or missing target raises `ConflictError`. Unrelated message changes do
177
+ not invalidate the token. Omitted patch fields retain their values; explicit
178
+ `None` clears only fields the format can represent as absent.
179
+
180
+ Content changes append a new frame and move the old frame to the free list.
181
+ UIDs stay fixed. Free frames are kept for other tools; this writer does not
182
+ recycle, merge or pack them. Header patches preserve omitted raw metadata, all
183
+ nine replies, arrival time, UTC offset and unknown attribute bits. Attribute-only
184
+ changes preserve the original control and text bytes. A body-only patch preserves
185
+ omitted SEEN-BY and PATH routing. Explicit control
186
+ replacement replaces the control block while preserving an omitted `external_id`;
187
+ conflicting MSGID controls are rejected. New names and subjects require room for
188
+ their trailing
189
+ NUL; oversized fields and unencodable text fail instead of being truncated.
190
+ `WriterOptions` selects the strict encoding, CP850 by default. Charset declarations
191
+ must agree when text is serialized. Routing and MSGID are explicit caller data.
192
+
193
+ One operation is the rollback unit. Injected write, truncate and flush failures
194
+ restore watched files in place under the lock. A failed rollback raises
195
+ `RollbackError` and makes the session unusable. This does not promise recovery
196
+ from process termination or power loss. A configured `maxmsgs` limit rejects an
197
+ append at capacity; editing never purges other messages automatically.
198
+
199
+ Use Squish offline with GoldED closed. `concurrent=True` is rejected on every
200
+ platform. macOS is the only runtime tested in this checkout. POSIX record locks
201
+ serialize cooperating Python writers; Linux execution remains unverified. Windows
202
+ has
203
+ a byte-lock implementation but has not been exercised here. GoldED build tests,
204
+ concurrent reading and refresh checks are deferred, so no GoldED build is certified.
205
+ See [writer source notes](docs/writer-sources.md).
@@ -0,0 +1,14 @@
1
+ # Security
2
+
3
+ Treat message archives as untrusted input. Readers validate record boundaries,
4
+ offsets and decoding, but archives must remain stable while being read.
5
+
6
+ Report vulnerabilities privately through [GitHub security advisories](https://github.com/golded-dev/golded-ftn-squish-python/security/advisories/new).
7
+ Do not put private archives, message contents or credentials in public issues.
8
+ Security review targets the current 1.2.x development line. The writer changes
9
+ are prepared locally and have not been published on PyPI.
10
+
11
+ Writer sessions validate the base under their operation lock and roll back
12
+ handled I/O failures. Keep GoldED closed; direct file access bypasses this lock.
13
+ No recovery guarantee covers process termination or power loss. Archive mode is
14
+ for reading damaged records, never for editing them.
@@ -0,0 +1,82 @@
1
+ # Release checks
2
+
3
+ Run every README development check from a clean checkout with sibling core.
4
+ `scripts/verify_distribution.py` inspects wheel/sdist contents and metadata,
5
+ rebuilds the wheel from sdist, compares archive bytes, builds a local core wheel,
6
+ and tests both Squish wheels in separate environments outside the repositories.
7
+ It also checks runtime imports, README execution, strict test typing and stubtest.
8
+
9
+ CI runs full checks on Linux Python 3.12, 3.13 and 3.14, with pytest on Windows
10
+ and macOS Python 3.14. Local checks do not establish that CI passed.
11
+
12
+ Inspect CHANGELOG and license notices. Commit only when requested. A local
13
+ 1.2.0 build does not publish a release. Remote creation, push, tagging and package
14
+ publication each require explicit authorization.
15
+
16
+ For writer changes, check create/read/append/update/delete through public sessions,
17
+ independent binary fixtures, stale revisions, controlled lock contention and
18
+ handled write/flush failures. Run examples against the installed wheel. Record
19
+ platform results separately: local macOS tests do not establish Linux or Windows
20
+ execution, or GoldED compatibility. Keep `concurrent=True` disabled until both
21
+ competing writes and GoldED read/cache/refresh checks pass against a pinned build.
22
+ The current GoldED build and integration tests are deferred.
23
+
24
+ ## Local 1.2.0 release candidate — 2026-10-05
25
+
26
+ Verified on macOS 27.0 arm64 with CPython 3.14.6. The checkout contains
27
+ uncommitted changes; these checks cover the working tree, not a tagged release.
28
+
29
+ - `uv sync --locked`: passed.
30
+ - Ruff lint and format checks, strict mypy: passed.
31
+ - `uv run pytest -q`: 159 passed, 1 skipped.
32
+ - `uv build` and `uv run twine check dist/*`: passed for wheel and sdist.
33
+ - `scripts/verify_distribution.py`: passed metadata and package-content checks,
34
+ byte comparison against a wheel rebuilt from sdist, isolated installed-package
35
+ tests and strict consumer typing. Format packages also pass installed stubtest.
36
+ - `agent-compose check`: passed using the local mostly-agents tool.
37
+ - `git diff --check`: passed (whitespace only).
38
+
39
+ GitHub's API reports the repository as public and private vulnerability reporting
40
+ as enabled. PyPI's project JSON endpoint returned HTTP 404 on this date. No package
41
+ was uploaded. Local checks do not establish Linux/Windows or remote CI results.
42
+ GoldED build interoperability remains deferred; concurrent use stays disabled.
43
+
44
+ Release order: publish `golded-ftn==1.2.0` first, then the four format packages.
45
+ Each format package requires `golded-ftn>=1.2.0,<2`. Before publication, commit
46
+ and review CI for these exact sources, create the intended release tag, and
47
+ confirm the package-index destination and publishing authority. After core is
48
+ available, verify resolution from that index without local uv sources. Publish
49
+ only the reviewed archives, then check public installation and update the shared
50
+ guide's commit pins to the released commits. These remote actions are not part
51
+ of this local preparation.
52
+
53
+ Archive checksums are recorded separately in `RELEASE-SHA256.txt` at the
54
+ repository root, outside the archives, after the final build.
55
+
56
+ ## PyPI Trusted Publishing
57
+
58
+ Create a PyPI account, verify its email and configure two-factor authentication.
59
+ For a first publication, add a pending publisher at
60
+ <https://pypi.org/manage/account/publishing/> with these exact fields:
61
+
62
+ - PyPI project: `golded-ftn-squish`
63
+ - GitHub owner: `golded-dev`
64
+ - GitHub repository: `golded-ftn-squish-python`
65
+ - Workflow filename: `publish.yml`
66
+ - Environment: `pypi`
67
+
68
+ See [PyPI's pending-publisher instructions](https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/).
69
+ No API token or password is required by the workflow. The account setup is a
70
+ manual prerequisite; a GitHub release does not create the PyPI project.
71
+
72
+ After this tag's CI succeeds and the GitHub release contains both archives and
73
+ `RELEASE-SHA256.txt`, run:
74
+
75
+ ```sh
76
+ gh workflow run publish.yml --repo golded-dev/golded-ftn-squish-python -f tag=v1.2.0
77
+ ```
78
+
79
+ The workflow verifies SHA-256 and uploads those exact release assets. Publish
80
+ core first, verify installation from PyPI, then dispatch the format workflows.
81
+ Confirm the workflow result, PyPI version and hashes, and installation in a fresh
82
+ environment. Do not store publishing credentials in this repository.
@@ -0,0 +1,32 @@
1
+ # Squish writer source notes
2
+
3
+ The reference checkout is `golded-open-source`, commit
4
+ `600266252b73174ff5116cee697ef9a97aeb1859`, with paths relative to that repo.
5
+ This implementation uses independent binary fixtures. It has not been exercised
6
+ against a running GoldED build.
7
+
8
+ - `goldlib/gmb3/gmosqsh.h:154-244`: nine reply slots, 238-byte message headers,
9
+ 28-byte frame headers, 12-byte index entries and the 256-byte base record.
10
+ - `goldlib/gmb3/gmosqsh2.cpp:38-74`: refresh, initial next UID 2 and frame sizes.
11
+ - `goldlib/gmb3/gmosqsh4.cpp:38-82`: byte-0 lock and unlock-before-base/index-write.
12
+ That ordering prevents a concurrency claim based on matching write locks alone.
13
+ - `goldlib/gmb3/gmosqsh4.cpp:129-203`: deletion, active-chain unlinking and free list.
14
+ - `goldlib/gmb3/gmosqsh4.cpp:336-641`: message/header serialization, UID assignment,
15
+ frame allocation, recipient index hash and control/text boundaries. Python
16
+ always appends replacement content frames rather than recycling free frames.
17
+ - `goldlib/gall/gcrchash.cpp:40-61`: case-insensitive recipient hash and read flag.
18
+ - `goldlib/gmb3/gmosqsh1.cpp:201-218`: `.SQL` lastread slots. Editing preserves them.
19
+ - `goldlib/gmb3/gmosqsh2.cpp:88-250`: scan modes, index caching and reread behavior.
20
+
21
+ The local macOS tests cover independent fixtures, revision conflicts, two sessions,
22
+ two processes, controlled lock timeout and injected mutation failures. Windows
23
+ byte locks have an implementation but no live platform test in this run. Linux
24
+ execution is also unverified. GoldED
25
+ commit/compiler/flags/configuration and runtime refresh checks remain pending.
26
+ All platforms reject `concurrent=True`.
27
+
28
+ A deterministic POSIX process-kill probe terminates a child immediately after
29
+ its first appended-frame write. The old header and index remain unchanged and
30
+ the appended bytes remain at the end of `.SQD`. The standalone reader returns
31
+ the old indexed message; the writer rejects the inconsistent end-frame marker.
32
+ This is one observed boundary, not proof that every interrupted write is detected.