feat(7836): lessons and rules are no longer paired by arriving together
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Failing after 1m40s
CI & Build / integration (push) Successful in 2m7s
CI & Build / Build & push image (push) Skipped
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Failing after 1m40s
CI & Build / integration (push) Successful in 2m7s
CI & Build / Build & push image (push) Skipped
The co-arrival recorder counted a lesson and a rule shown in one response as evidence that the lesson is an instance of the rule, and asked the reader to judge the pair once three situations had gathered. Two records that resemble the same prompts arrive together whether or not one is an instance of the other, and the outcome bore that out (2,317 pairs suggested, 23 confirmed). It no longer runs: - neither the prompt door nor the write path records co-arrivals or carries a proposal line; - a rule read lists the lessons judged against it, confirmed first, and a lesson read the rules it was judged against: suggested rows stay in the table and no read shows them; - the lesson page and the rule editor drop the suggested section. The situation-counting helpers stay; rule moment judgments use them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,7 +30,6 @@ import { apiErrorMessage } from "@/api/client";
|
||||
import {
|
||||
deleteLesson,
|
||||
getLesson,
|
||||
judgeLessonLink,
|
||||
type Lesson,
|
||||
type LessonRuleLink,
|
||||
} from "@/api/lessons";
|
||||
@@ -41,7 +40,6 @@ import { DEAD_WEIGHT_ADVICE } from "@/utils/deadWeight";
|
||||
import { useToastStore } from "@/stores/toast";
|
||||
import { renderMarkdown } from "@/utils/markdown";
|
||||
import { vRecordRefs } from "@/directives/recordRefs";
|
||||
import { canWriteRecord } from "@/utils/permission";
|
||||
import { recordHref } from "@/utils/recordHref";
|
||||
|
||||
const route = useRoute();
|
||||
@@ -62,16 +60,11 @@ const insightHtml = computed(() =>
|
||||
);
|
||||
|
||||
|
||||
const canWrite = computed(() => canWriteRecord(lesson.value?.permission));
|
||||
|
||||
/** The links by state — each state reads differently. Confirmed links are
|
||||
* the answer; suggested ones are evidence waiting on a judgment; rejected
|
||||
* ones are kept so the pair is never proposed again, and shown so the reason
|
||||
* stays readable. */
|
||||
* the answer; rejected ones are kept so the reason stays readable. */
|
||||
const linksIn = (state: LessonRuleLink["state"]) =>
|
||||
computed(() => (lesson.value?.rules ?? []).filter((r) => r.state === state));
|
||||
const confirmedRules = linksIn("confirmed");
|
||||
const suggestedRules = linksIn("suggested");
|
||||
const rejectedRules = linksIn("rejected");
|
||||
|
||||
/** A rule opens in the rules view's editor, which takes the rule alone. */
|
||||
@@ -79,36 +72,6 @@ function ruleHref(ruleId: number) {
|
||||
return { path: "/rules", query: { rule: String(ruleId) } };
|
||||
}
|
||||
|
||||
/** What a suggestion rests on, in the units it was proposed by: distinct
|
||||
* situations, not raw arrivals — one situation repeated proves nothing. */
|
||||
function evidenceLine(ev: NonNullable<LessonRuleLink["evidence"]>): string {
|
||||
const situations = `${ev.situations} distinct situation${ev.situations === 1 ? "" : "s"}`;
|
||||
const projects = ev.projects > 1 ? `, across ${ev.projects} projects` : "";
|
||||
return `Arrived together in ${situations}${projects}.`;
|
||||
}
|
||||
|
||||
const judging = ref<number | null>(null);
|
||||
|
||||
/** Judge a suggested link from here. Re-reads the lesson rather than editing
|
||||
* the list in place: confirming also clears a "no rule fits" answer, and the
|
||||
* judgment line has to come back from the server to be right. */
|
||||
async function judge(rule: LessonRuleLink, verdict: "confirm" | "reject") {
|
||||
judging.value = rule.id;
|
||||
try {
|
||||
await judgeLessonLink(lessonId.value, rule.id, verdict);
|
||||
lesson.value = await getLesson(lessonId.value);
|
||||
toast.show(
|
||||
verdict === "confirm"
|
||||
? "Linked — the rule can now surface through this lesson"
|
||||
: "Not an instance — this pair will not be suggested again",
|
||||
);
|
||||
} catch (e) {
|
||||
toast.show(apiErrorMessage(e, "Failed to record the judgment"), "error");
|
||||
} finally {
|
||||
judging.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
async function load() {
|
||||
loading.value = true;
|
||||
error.value = null;
|
||||
@@ -223,39 +186,6 @@ onMounted(load);
|
||||
nobody has said none fits.
|
||||
</p>
|
||||
|
||||
<template v-if="suggestedRules.length">
|
||||
<h3 class="ld-sub-label">Suggested</h3>
|
||||
<ul class="ld-sources">
|
||||
<li v-for="r in suggestedRules" :key="r.id">
|
||||
<router-link :to="ruleHref(r.id)" class="ld-link">
|
||||
{{ r.title }}
|
||||
</router-link>
|
||||
<span v-if="r.kind === 'preference'" class="rule-chip rule-chip-preference">
|
||||
preference
|
||||
</span>
|
||||
<p v-if="r.evidence" class="ld-link-note">{{ evidenceLine(r.evidence) }}</p>
|
||||
<div v-if="canWrite" class="ld-judge">
|
||||
<button
|
||||
type="button"
|
||||
class="ld-ghost ld-small"
|
||||
:disabled="judging === r.id"
|
||||
@click="judge(r, 'confirm')"
|
||||
>
|
||||
Confirm
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="ld-ghost ld-small"
|
||||
:disabled="judging === r.id"
|
||||
@click="judge(r, 'reject')"
|
||||
>
|
||||
Not an instance
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<template v-if="rejectedRules.length">
|
||||
<h3 class="ld-sub-label">Judged not an instance</h3>
|
||||
<ul class="ld-sources ld-rejected">
|
||||
@@ -410,8 +340,6 @@ onMounted(load);
|
||||
color: var(--fs-text-tertiary);
|
||||
}
|
||||
.ld-rejected .ld-link { color: var(--fs-text-secondary); }
|
||||
.ld-judge { display: flex; gap: var(--fs-space-2); margin-top: var(--fs-space-1); }
|
||||
.ld-small { padding: 0.15rem 0.6rem; font-size: var(--fs-size-label); }
|
||||
.ld-ghost:disabled { opacity: var(--fs-disabled-opacity); cursor: default; }
|
||||
|
||||
.ld-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 1.25rem; }
|
||||
|
||||
Reference in New Issue
Block a user