feat(modes): the kernel modes - a patch series and a mailing-list reply
Beside the push gates, crafter-review runs the pre-send review of a kernel contributor's workbench: --mode series over a format-patch export with its cover letter, --mode reply over a mail draft. The inventory partitions a cover letter, a plain mail and the camera review's shape; ten kernel lenses join the table with their gates (structure, code, artifact truth) and the persona gate - one maintainer-persona instance per --reviewers entry, its whole pass gating its blocks and pruning the units that are not theirs. A series' code units are keyed on the code like the push gates'; every text unit on its text, the references it cites and the anchor when it is dated. The references an artifact cites are prefetched through utilities/lore.py into the gate-state, with a digest in the run layer, and a persona's calibration map is its lore listing. The kernel schema carries the persona vocabulary, the kernel note kinds, the predicted review and the not-mine list; the matrix the persona holes, the thin and the modelled units; gates clean without a persona pass is GATES CLEAN. A reply's gate-state sits beside the draft and is read once; a kernel mode needs --subsystem, defaults the effort to max and the trees to work/linux,work/milos-linux, and excuses no unit from the holes. The kernel lenses and the common text ship verbatim; the table lists them after the push gates' lenses and the config template holds them off, so a repository that never turns them on changes nothing. Prompts, keys and plans were checked byte for byte against the pipeline these modes replace, on its own artifacts: two replies and a series, every system prompt, user prompt, job and reuse key identical.
This commit is contained in:
parent
4fc15fe1c2
commit
339f4b9b40
46 changed files with 5732 additions and 362 deletions
|
|
@ -72,7 +72,7 @@ namespace Crafter::Review::State {
|
|||
return EmptyState();
|
||||
}
|
||||
|
||||
Json MergeState(const Json& disk, const Json& sets, std::span<const std::string> drops, const Json& read) {
|
||||
Json MergeState(const Json& disk, const Json& sets, std::span<const std::string> drops, const Json& read, const Json& persona) {
|
||||
const bool ok = disk.is_object() && Dyn::Get(disk, "entries").is_object();
|
||||
Json state = {
|
||||
{"version", 1},
|
||||
|
|
@ -108,6 +108,7 @@ namespace Crafter::Review::State {
|
|||
}
|
||||
entries[it.key()] = std::move(entry);
|
||||
}
|
||||
if (!persona.is_null()) state["personaPass"] = persona;
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
@ -121,10 +122,10 @@ namespace Crafter::Review::State {
|
|||
fs::rename(temp, path);
|
||||
}
|
||||
|
||||
Json SaveState(const fs::path& path, const Json& sets, std::span<const std::string> drops, const Json& read) {
|
||||
Json SaveState(const fs::path& path, const Json& sets, std::span<const std::string> drops, const Json& read, const Json& persona) {
|
||||
// Without the lock the write is still made; a failed write throws.
|
||||
const Platform::FileLock lock(std::format("{}.lock", path.string()));
|
||||
Json merged = MergeState(LoadState(path), sets, drops, read);
|
||||
Json merged = MergeState(LoadState(path), sets, drops, read, persona);
|
||||
Platform::WriteAtomic(path, DumpFile(merged), 0666);
|
||||
return merged;
|
||||
}
|
||||
|
|
@ -249,9 +250,16 @@ namespace Crafter::Review::State {
|
|||
}
|
||||
const Json& coverage = Dyn::Or(Dyn::Get(dump, "coverage"), Dyn::EmptyDict());
|
||||
if (Dyn::Truthy(coverage)) {
|
||||
lines.push_back(std::format("matrix: {} units x {} lenses; holes {}, not reviewed by any lens that runs (messages, diffstats, documentation, the units of a lens the config turns off) {}, units with a defect verdict {}",
|
||||
Dyn::Str(Dyn::At(coverage, "units")), Len(Dyn::At(coverage, "lenses")), Len(Dyn::At(coverage, "holes")),
|
||||
Len(Dyn::Or(Dyn::Get(coverage, "notReviewed"), Dyn::EmptyList())), Len(Dyn::At(coverage, "defects"))));
|
||||
const Json& mode = Dyn::Get(dump, "mode");
|
||||
if (mode == "reply" || mode == "series") {
|
||||
lines.push_back(std::format("matrix: {} units x {} lenses; holes {}, persona holes {}, thin {}, modelled {}, units with a defect verdict {}", Dyn::Str(Dyn::At(coverage, "units")),
|
||||
Len(Dyn::At(coverage, "lenses")), Len(Dyn::At(coverage, "holes")), Len(Dyn::Or(Dyn::Get(coverage, "personaHoles"), Dyn::EmptyList())),
|
||||
Len(Dyn::Or(Dyn::Get(coverage, "thin"), Dyn::EmptyList())), Len(Dyn::Or(Dyn::Get(coverage, "modelled"), Dyn::EmptyList())), Len(Dyn::At(coverage, "defects"))));
|
||||
} else {
|
||||
lines.push_back(std::format("matrix: {} units x {} lenses; holes {}, not reviewed by any lens that runs (messages, diffstats, documentation, the units of a lens the config turns off) {}, units with a defect verdict {}",
|
||||
Dyn::Str(Dyn::At(coverage, "units")), Len(Dyn::At(coverage, "lenses")), Len(Dyn::At(coverage, "holes")),
|
||||
Len(Dyn::Or(Dyn::Get(coverage, "notReviewed"), Dyn::EmptyList())), Len(Dyn::At(coverage, "defects"))));
|
||||
}
|
||||
}
|
||||
const Json& usageAll = Dyn::Has(dump, "usage") ? Dyn::At(dump, "usage") : Dyn::EmptyDict();
|
||||
const Json& usage = Dyn::Or(Dyn::Get(usageAll, "run"), Dyn::EmptyDict());
|
||||
|
|
|
|||
Loading…
Reference in a new issue