[Chore, Docs] (...): drop the archived notes and move the skill under tools

- the archive freeze rule goes with the directory
- code comments lose citations to the removed notes
This commit is contained in:
BZLZHH
2026-10-31 19:29:06 +08:00
parent b5d64175a1
commit 6e36bf2c1b
1064 changed files with 1022 additions and 200727 deletions
+3 -62
View File
@@ -94,10 +94,6 @@ FROZEN = {"MobileGL/MG_Remote/Protocol/protocol.fbs"}
# `clang-format off`.
FORMAT_SKIP = {"MobileGL/MG_Impl/GLImpl/Exporting/Definitions.cpp"}
NOTES_DIR = "docs/Disaggregated/notes/"
# The archived planning notes and agent contracts. The commit that adds ARCHIVE_MARKER fills the
# archive; every later commit leaves it alone.
ARCHIVE_DIR = "docs/archive/"
ARCHIVE_MARKER = ARCHIVE_DIR + "README.md"
RATCHETS = ("line_citations", "planning_code_comment_lines", "long_comment_excess_lines",
"allcaps_comment_lines", "non_english_comment_lines")
@@ -157,7 +153,7 @@ def external_names(text):
if not (m.group(1).islower() and text[m.end():m.end() + 1] in ("-", "/"))]
def check_message(message, changed_paths, added_paths, submodules, is_merge=False, archive_frozen=False):
def check_message(message, changed_paths, added_paths, submodules, is_merge=False):
"""Return the list of problems with one commit message."""
problems = []
if message.startswith("\ufeff"):
@@ -222,10 +218,6 @@ def check_message(message, changed_paths, added_paths, submodules, is_merge=Fals
problems.append("adds %s: working papers stay outside the repository" % path)
elif path.endswith(".log"):
problems.append("adds %s: logs are not committed" % path)
if archive_frozen:
touched = [p for p in changed_paths if p.startswith(ARCHIVE_DIR)]
if touched:
problems.append("changes %s (and %d more): %s is frozen" % (touched[0], len(touched) - 1, ARCHIVE_DIR))
return problems
@@ -238,12 +230,6 @@ def commit_paths(sha, repo=ROOT):
return names("--no-renames"), names("-M", "--diff-filter=A")
def archive_creation(repo=ROOT):
"""The commit that created docs/archive/, or None."""
added = git("log", "--diff-filter=A", "--format=%H", "--", ARCHIVE_MARKER, check=False, repo=repo).split()
return added[-1] if added else None
def is_ancestor(a, b, repo=ROOT):
return subprocess.run(["git", "-C", repo, "merge-base", "--is-ancestor", a, b],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0
@@ -272,14 +258,12 @@ def is_merge(sha, repo=ROOT):
def check_commits(rev_range, repo=ROOT):
shas = commits_to_check(rev_range, repo)
submodules = submodule_paths(repo)
created = archive_creation(repo)
failures = 0
for sha in shas:
merge = is_merge(sha, repo)
message = git("log", "-1", "--format=%B", sha, repo=repo)
changed, added = ([], []) if merge else commit_paths(sha, repo)
frozen = bool(created) and sha != created and is_ancestor(created, sha, repo)
problems = check_message(message, changed, added, submodules, is_merge=merge, archive_frozen=frozen)
problems = check_message(message, changed, added, submodules, is_merge=merge)
for p in problems:
report(None, None, "%s %s: %s" % (sha[:9], message.split("\n", 1)[0][:60], p))
failures += bool(problems)
@@ -726,10 +710,6 @@ def self_test():
expect("message rejects new log",
check_message("[Test] (tools/trace_replay): keep the run log\n", ["tools/trace_replay/run.log"],
["tools/trace_replay/run.log"], subs) != [])
archived = ["docs/archive/notes/p9/r.md"]
expect("message: archive frozen",
check_message("[Docs] (docs/archive): fix a typo\n", archived, [], subs, archive_frozen=True) != []
and check_message("[Docs] (docs/archive): fill the archive\n", archived, archived, subs) == [])
expect("merge: valid", check_message("[Merge] (MG_Remote): take the reply-window fix\n", [], [], subs, True) == [])
expect("merge: local path", check_message(
"[Merge] (MG_Remote): take fix\n\n- from /mnt/c/Users/x/repo\n", [], [], subs, True) != [])
@@ -793,7 +773,6 @@ def self_test():
"+ int f();\n+- x\n")
expect("format: moved lines are not checked", unmoved_ranges(moved) == {"b.cpp": [(2, 3)]})
expect("range: first parent and cutoff", range_self_test())
expect("archive: a move fills it, a later edit fails", archive_self_test())
for name in failures:
print("self-test FAILED: %s" % name)
@@ -835,43 +814,6 @@ def range_self_test():
shutil.rmtree(tmp, ignore_errors=True)
def archive_self_test():
"""In a scratch repository: moving a log into the archive is not adding one, the commit that
creates docs/archive/ may fill it, and a later commit that edits it fails."""
tmp = tempfile.mkdtemp()
try:
def g(*args):
return git(*args, repo=tmp)
def write(path, text="x\n"):
full = os.path.join(tmp, path)
os.makedirs(os.path.dirname(full), exist_ok=True)
with open(full, "a", encoding="utf-8") as fh:
fh.write(text)
g("add", path)
g("init", "-q", "-b", "main")
g("config", "user.email", "t@t")
g("config", "user.name", "t")
write("docs/Disaggregated/notes/p1/run.log")
g("commit", "-q", "-m", "old notes")
base = g("rev-parse", "HEAD").strip()
write(SELF_PATH)
g("commit", "-q", "-m", "[CI] (scripts): add the lint")
os.makedirs(os.path.join(tmp, "docs/archive/notes/p1"))
g("mv", "docs/Disaggregated/notes/p1/run.log", "docs/archive/notes/p1/run.log")
write(ARCHIVE_MARKER, "The archived notes.\n")
g("commit", "-q", "-m", "[Docs] (docs/archive, docs/Disaggregated): move the notes into the archive")
with contextlib.redirect_stdout(io.StringIO()):
moved_ok = check_commits("%s..HEAD" % base, tmp)
write("docs/archive/notes/p1/run.log")
g("commit", "-q", "-m", "[Docs] (docs/archive): edit an archived log")
edit_fails = not check_commits("%s..HEAD" % base, tmp)
return moved_ok and edit_fails
finally:
shutil.rmtree(tmp, ignore_errors=True)
# ---------------------------------------------------------------------------------------- main
def main():
@@ -897,8 +839,7 @@ def main():
return 0
added = [p for p in git("diff", "--cached", "--name-only", "-M", "--diff-filter=A").splitlines() if p]
with open(args.file, encoding="utf-8") as fh:
problems = check_message(fh.read(), staged, added, submodule_paths(),
archive_frozen=archive_creation() is not None)
problems = check_message(fh.read(), staged, added, submodule_paths())
for prob in problems:
print(prob)
return 1 if problems else 0
+1 -1
View File
@@ -881,7 +881,7 @@ inline constexpr MGPipeCallClass MGPipeCallClassFor(MGPWireOp op) {
: kCallClassCount;
}
// P5e (docs/archive/contracts/CONTRACT-P5E.md 2.2): THE WAIT CLASS OF EVERY OPCODE, indexed the same way.
// P5e (2.2): THE WAIT CLASS OF EVERY OPCODE, indexed the same way.
// Index 0 is kWaitClassCount - never a real class - for the flags table's reason: the one
// caller that can pass an opcode this catalogue never produced is a decoder holding bytes off
// a stream, and it must reach its own Fatal{ProtocolCorruption} rather than a wait decision.
+1 -1
View File
@@ -1011,7 +1011,7 @@ def self_test():
"the field set (%d of %d)" % (total, len(accessors)))
if len(sticky) != 7:
sys.exit("gen_pipe_field_ownership: self-test: Coverage.def no longer has seven sticky fields")
# EIGHT SINCE P5e (docs/archive/contracts/CONTRACT-P5E.md 5.6): GetBufferBindingPoint joined the seven
# EIGHT SINCE P5e (5.6): GetBufferBindingPoint joined the seven
# when set_shader_buffers got its Coverage.def emitted row. The number is pinned rather
# than merely derived because it is the SIZE OF THE SHAPE-ONLY SET - the rows where an
# emitted call exists and still does not supply the field - and a row that quietly left
+2 -2
View File
@@ -9,8 +9,8 @@
"""The link-closure ratchet: which frontend symbols would a server-only image still need?
CONTRACT-P6.md 12.1 records the debt as 184 symbols and says "a ratchet recomputes the 184
in CI and asserts it only ever falls". This is that ratchet. The measurement is a6's
(docs/archive/notes/p6/a6-link-experiment.md), mechanised:
in CI and asserts it only ever falls". This is that ratchet. The measurement is a6's,
mechanised here:
(SERVER undefined) - (SERVER defined) - (SHARED defined) intersect (FRONTEND defined)
+1 -1
View File
@@ -93,7 +93,7 @@
# expected shape of a #if/#else pair that re-spells one of these bodies beside an untouched copy -
# a finding, not a limitation, because two ladders drift (ID-11, ID-15).
#
# A SHARED TEMPLATE OVER AN ACCESSOR INTERFACE IS REJECTED (ID-13 in docs/archive/notes/p3a/INTEGRATOR-DECISIONS.md): it resizes
# A SHARED TEMPLATE OVER AN ACCESSOR INTERFACE IS REJECTED (ID-13): it resizes
# pull symbols and breaks G1. If a P4a arm needs a variant of one of the seventeen it gets its own
# `#if MOBILEGL_PIPE_PUSH` function with its own name and its own pinned sha - the
# FlushPendingRangesFrom shape.