Files
lucisv/tools/perf/phases_r3b.py
T
Guoliang ChenandClaude Mythos 5.2 71d13b5fbe
ci / checks (push) Successful in 1m0s
ci / corpus (push) Successful in 18s
ci / linux (push) Successful in 6m4s
release / build-and-publish (push) Successful in 5m31s
Release 0.66.2: every source file names its author
Every tracked file that can carry a comment (880 of them) now opens with
"Author: Guoliang Chen, a Senior Digital Design Engineer" and closes with
"Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love,
luciochen.com", in the file's own comment syntax. No behaviour change: the
diff outside the version bump and changelogs is comment lines only.

- tools/stamp_author.py: writes the lines; idempotent, `--check` lists
  what is missing. Headers go under a shebang and under Markdown front
  matter.
- Left alone: test fixtures, cases and snapshots (byte-exact inputs), JSON
  and JSONL, logs, images, lockfiles, docs/site/dist (regenerated) and the
  LICENSE files (already carry the copyright line).
- tools/linux_check.sh: --help reads its header from line 3, now that the
  author line sits under the shebang.
- tools/gates.sh green on this tree: 5 545 tests, corpus 814/6 as before.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>
2026-11-24 12:11:09 -08:00

63 lines
3.0 KiB
Python

#!/usr/bin/env python3
# Author: Guoliang Chen, a Senior Digital Design Engineer
"""The review round's §R3b phase: `renamewarn`.
`renametrace` fingerprints a rename's **edits**; a rename's warnings do not
travel in the `WorkspaceEdit` at all — the server sends them as
`window/logMessage` notifications (`server/client.rs::report_scope`), one per
sentence, and `schema.fingerprint` never sees them. So a change that reused a
file's index record instead of parsing it could in principle keep every edit
and lose a warning, and the existing phases would call that a pass.
This phase closes that hole: it issues the renames whose warnings are worth
comparing, reads every `lucisv: …` line the session logged back off
`window/logMessage`, and writes the **whole list, verbatim and in order**, into
the row. Two labels' rows are then compared line by line — no hash, no
summary, so a reader can see which sentence moved if one ever does.
`ms` is still the wire latency and nothing else (schema 2); the warnings are
the row's `titles`, which is the field schema 2 already keeps a list of
strings in.
"""
import phases_p2
from harness import ARGS, at, phase, record, samples, session, settled, sites
#: `(row, file, needle, occurrence, offset, new_name, also_open)` — the renames
#: that produce warnings, plus one that produces none as the control. Taken
#: from `phases_p2.RENAMES` so the two phases speak about the same requests.
WARNED = ["tail", "ordinary", "unique internal", "common port", "bind"]
@phase("renamewarn")
def phase_renamewarn():
"""Every warning sentence four renames say, verbatim."""
for row, relative, needle, occurrence, offset, new_name, also in phases_p2.RENAMES:
if not any(row.startswith(prefix) for prefix in WARNED):
continue
warn_row(row, relative, needle, occurrence, offset, new_name, also)
def warn_row(row, relative, needle, occurrence, offset, new_name, also):
"""One rename, with every sentence it logged written into the row."""
with session("workspace", storage_name="renamewarn") as s:
settled(s)
s.did_open(sites.path(relative))
if also:
s.did_open(sites.path(also))
s.wait_quiet(0.8)
s.take_notifications()
s.log_messages = []
params = dict(at(relative, needle, occurrence, offset), newName=new_name)
got = samples(s, "textDocument/rename", params, ARGS.tries + 1)
s.drain()
warnings = [text for text in s.log_messages if text.startswith("lucisv: ")]
record(phase="renamewarn", row=row, client=s.client_shape(),
file=relative, new_name=new_name,
**dict(got.row(), titles=warnings, result_count=len(warnings)),
note="every `lucisv: ` window/logMessage the session sent, in "
"order and repeated once per try; compared line by line "
"between labels, never hashed")
# Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com