mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 07:13:29 +00:00
fix(coach): give a series read its numbers when the shared build cut its block
Inside a chat turn every tool read lands on the turn's shared full-source
snapshot when its window matches. On an account with many synced series
that build passes the prompt budget, and the budget pass collapses blocks
to a bare unit and then to an `{ omitted }` marker. get_metric_series
sliced the marker out and answered `present: true` with it, so the model
was told the readings exist and was given no figure. The same held for
sleep, glucose, compliance and workouts.
- The snapshot result names the blocks the budget pass cut. A tool whose
block was cut in the shared build reads it again from its own source at
the same window.
- A read scoped to one source condenses its own blocks last and never
swaps them for the marker: it keeps a summary (first, last, min, max,
mean, change) taken before anything is cut, the newest daily values,
weekly means folded into monthly means, and names each cut.
- get_metric_series never answers present with a block holding no figure;
that read reports retrieval_failed instead.
- A chat series read carries the readings it counted, so the step shows
them, and on a long or condensed window a note on what it covers. The
tool description and a new tool-mode rule tell the model to call
get_metric_table itself for longer history instead of asking.
- The screen-reader comma between step parts is unselectable, so a copied
row no longer reads "Weight · ,all time".
MCP output is unchanged: the source-snapshot equality suite stays green.
This commit is contained in:
1 parent
6cea4be2a1
commit
ac48e0d0ed
10 files changed
+1049
-46
No files matched your search
@@ -243,7 +243,10 @@ describe("<CoachTurnStepList>", () => {
|
||||
expect(html).toContain('data-status="done"');
|
||||
expect(html).toContain('data-status="empty"');
|
||||
expect(html).toContain('data-status="running"');
|
||||
let text = html.replace(/<span class="sr-only">, <\/span>/g, "");
|
||||
let text = html.replace(
|
||||
/<span class="sr-only select-none">, <\/span>/g,
|
||||
"",
|
||||
);
|
||||
// Strip tags until nothing changes, so no fragment can survive one pass.
|
||||
for (let prev = ""; prev !== text;) {
|
||||
prev = text;
|
||||
@@ -349,3 +352,27 @@ describe("legacyAreaLabels", () => {
|
||||
).toContain("1 Bereich angesehen");
|
||||
});
|
||||
});
|
||||
|
||||
describe("a step row copied out of the list", () => {
|
||||
it("reads 'domain · window' without the screen reader's comma", () => {
|
||||
const html = render(
|
||||
<CoachTurnStepList
|
||||
steps={[{ ...BP, domain: "weight", count: undefined }]}
|
||||
active={false}
|
||||
/>,
|
||||
"de",
|
||||
);
|
||||
// What a selection copies: every text node except the unselectable ones.
|
||||
const copied = html
|
||||
.replace(
|
||||
/<span[^>]*class="[^"]*\bselect-none\b[^"]*"[^>]*>[^<]*<\/span>/g,
|
||||
"",
|
||||
)
|
||||
.replace(/<[^>]+>/g, "")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
expect(copied).toBe("Gewicht · letzte 90 Tage");
|
||||
// The comma is still there for a screen reader.
|
||||
expect(html).toMatch(/class="sr-only select-none">, <\/span>/);
|
||||
});
|
||||
});
|
||||
@@ -314,7 +314,10 @@ export function CoachTurnStepList({
|
||||
{meta.map((part, i) => (
|
||||
<span key={i}>
|
||||
<span aria-hidden="true"> · </span>
|
||||
<span className="sr-only">, </span>
|
||||
{/* The comma is for a screen reader only. `select-none`
|
||||
keeps it out of a copied row, which otherwise read
|
||||
"Weight · ,all time". */}
|
||||
<span className="sr-only select-none">, </span>
|
||||
{part}
|
||||
</span>
|
||||
))}
|
||||
|
||||
Reference in new issue
Block a user