Files
seaweedfs/seaweed-block/.github/model-code-trace.md
T
Ping QiuandClaude Opus 5.5 a5686e7fa7 Sync seaweed-block v1.1.1 into seaweed-block/ (#13411)
Brings seaweed-block main (v1.1.1 plus the docs and a test fix after it)
into seaweed-block/ as one commit. Only files under seaweed-block/ change,
and the subtree equals seaweed-block main exactly. The module's full
history stays in the seaweed-block repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 19:04:53 -08:00

59 lines
3.1 KiB
Markdown

# Model citations for mapped files
The spec-trace workflow reads `model-code-trace.tsv` and the validator from
the target branch. A PR cannot replace its own mapping or checker.
Each non-comment line has two tab-separated columns: an exact repository
path and `Module.Action`. Repeat a path to list alternative actions that
cover it. Paths are case-sensitive; directories and glob patterns are not
expanded. Missing, empty or malformed mappings refuse the check.
Source line numbers are not part of this file-wide mapping. Moving a function
or test within its file does not change its model obligations or rewrite the
table. The time-bound registry separately keys individual bounds by file,
function, bound kind and occurrence; CI scans current source locations for
diagnostics rather than committing those locations.
Git uses its built-in union merge for this table so concurrent row additions
are retained. After a merge, sort and deduplicate the non-comment rows; the
checker refuses unsorted or duplicate rows. Review removals explicitly: a
union merge does not decide whether an old mapping should be removed.
The reviewed map uses the neutral public module names: `SnapshotRemoval`,
`RestoreTarget`, `HolderInterface`, `EngineAdapter`, `StopAndRestart`,
`MoveAdmission`, `Promotion`, `ProbeRound`, `FencingRound`, `VolumeCreate`,
`ReplicationPeer` and `RestoreCommand`.
Actions name top-level definitions used by the corresponding model's `Next`.
The mapping is the source of accepted citations; private model names and
storage locations do not belong in the public map or PR description.
For every changed mapped path, including deletions, the PR's `Model:` line
must contain a listed action or `NONE (pure function of Module)` for that
module. Separate multiple citations with semicolons, for example:
```text
Model: EngineAdapter.Begin; MoveAdmission.Revoke; NONE (pure function of RestoreTarget)
```
Unmapped paths keep the existing spec-trace policy. The pure-function
declaration is a review claim; CI checks its module, not its truth.
## Adding a model or file
1. Have the model owner confirm its neutral public module name and the
top-level action definitions used by `Next`. Use those names in public
code, mapping rows and PR descriptions.
2. Add an exact-path TSV row for each implementation and enforcement file
that the action covers. Split actions get separate rows. Include receiving
guards as well as senders; a reviewer checks that each file really enforces
the cited action. Environment actions without a Go site and mutant test
obligations are not implementation mappings.
3. Add controls for accepted and refused citations when extending the
checker. For mapping additions, check the real map against representative
affected paths. Run `python3 -B .github/scripts/model-trace-check-test.py`
and `bash .github/scripts/spec-trace-check-test.sh` on Linux.
4. Submit the map and its evidence for review with the model change or before
its callers land. The PR description cites the applicable public actions.
The new rows govern later PRs once they are on the target branch; changing
a PR's own map never changes the check that evaluates that PR.