Skip to content

fix(jobs): mark a claimed role as a claim on the job page and the console - #1212

Open
HugoXK wants to merge 2 commits into
mainfrom
dev1/1190-claim-not-fact
Open

HugoXK wants to merge 2 commits into
mainfrom
dev1/1190-claim-not-fact

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Written-by: Fledge Platform Dev-1

Fixes #1190

What changed

A claim was printed as a fact in two more places than the job page's team line.

  • The job page's "Why this change" block printed model · role in the 模型与角色 / Model and role row without saying whether the record observed that seat. It now carries the same mark the team line uses — 声称,未观察 / claimed, not observed, or 声称,未核实 / claimed, not verified when the row predates the observation record — in the row's note, so the value stays what the job claimed and the note says how far it was checked.
  • The console's job rows (public/team.js) never carried a marker at all. The console's live stream sends the structured attribution object, and the client formatter has no marker vocabulary, so the seat was reprinted bare on every tick — the server-rendered row was correct and the stream erased it. The stream and the poll now send the server-rendered attributionText beside the structured field, and the script prefers it; the structured fallback stays for an older payload, so an old server still renders, just without the mark.

Both surfaces, and the job page's team line, now take the judgement from one function, attributionGroundFor({ groundJson, attributionJson, teamStatsJson }), moved out of src/views/pages.ts into src/lib/attribution.ts with claimedRoleState(ground, role). There is one reconstruction of a pre-observation row, so the three readers cannot disagree; the console carries no marker words of its own, only the string the server rendered in the reader's language.

Docs: docs/architecture.md describes the shared reconstruction, docs/api.md records that the team endpoints carry attributionText. Changelog fragment changelog.d/1190.fixed.md (user-visible).

Screenshots

One seeded job, writtenBy/implementedBy = Dev-1, ground steps claimed: Dev-1, observed: null, state: unobserved. Same database row against both trees.

A — job page, 模型与角色 row

Before: DeepSeek-V4.1-Flash-1017 · Dev-1
job page before

After: DeepSeek-V4.1-Flash-1017 · Dev-1 with 声称,未观察 under it
job page after

B — console job row, after the live stream has ticked

Before: the HTML the server sent reads Dev-1 实现 · 声称,未观察, and the first stream tick replaces it with Dev-1 实现
console row before

After: the tick leaves Dev-1 实现 · 声称,未观察 in place
console row after

The frames were taken with a stub bridge answering the instance state call, so the console's SSE tick ran for real; nothing was mocked in the product code. Harness output for the same run, in the tree order before → after:

A 模型与角色 DeepSeek-V4.1-Flash-1017 · Dev-1
A 模型与角色 DeepSeek-V4.1-Flash-1017 · Dev-1 声称,未观察
B serverHtmlText "Dev-1 实现 · 声称,未观察"  afterTick "Dev-1 实现"
B serverHtmlText "Dev-1 实现 · 声称,未观察"  afterTick "Dev-1 实现 · 声称,未观察"

Alternatives considered

  • Change only the browser script (add the marker words to public/team.js): rejected — the script has no ground record, so it would have to guess, and the console would then hold a second copy of the marker vocabulary that could drift from the job page. Two surfaces reproducing a rule is what produced this defect.
  • Render the mark into the structured attribution object (e.g. a roleWithMarker string): rejected — the structured field is a typed claim (writtenBy: 'Dev-1'), and putting display words in it would hand every consumer a value that is not the attribution.
  • Keep the local attributionGroundFor in pages.ts and import it into app.ts: rejected — app.ts imports from views/pages.ts already, but the reconstruction is record semantics, not a page shape, and the change-story row needed it in lib/ anyway.
  • Make ChangeStoryAttribution.state required: rejected — three existing test/changeStory.test.ts literals test the model/role pair alone, and a required field would force them to assert a judgement they do not exercise. undefined reads as "no judgement" and the row prints no note.

Uncertainty and residual risk

  • attributionText is added to the team payloads; a client that reads only the structured field is unaffected, and the script's fallback still renders for a payload without the text. An older server paired with the new script therefore renders as before, unmarked — the mark is produced by the server, which is the point.
  • The pre-observation reconstruction is unchanged from feat: prove who authored the verifier instead of trusting the job's claim #368: a row whose attribution_json was overwritten by captureTeamStats still reads as grounded, because the column that would have held the claim is gone. This PR does not invent what the record does not have.
  • The change-story cache (60 s per job) means a page can show the previous judgement for up to a minute after the row changes; unchanged by this PR.

Ran:

  • npm run check at 21e624c — pass, # tests 3294 / # pass 3294 / # fail 0, lint 11 warnings (baseline), build ok.
  • Red at base 044c7515 with the new tests copied onto the base tree:
    • test/pages.test.ts — not ok 1 - #1190: the change-story row marks a claimed role the record did not observe, error: 'the claim the instance did not see is marked, in the row note', actual is the block without the note.
    • test/team.test.ts — not ok 1 - team events stream pushes a live snapshot, error: 'the claim is marked and the seat the instance did see is printed beside it', + actual - expected + undefined / - 'Dev-1 编写 · 声称,未观察 · Dev-2 编写'.
  • npx tsx --test --test-name-pattern='…' test/pages.test.ts test/team.test.ts at the tip — both pass.
  • node scripts/risk-gate.mjs --base origin/main — risk-tier: T2; basis: public/team.js.
  • node scripts/changelog.mjs check — changelog: 4 fragment(s) ok; node scripts/version.mjs check — version: 0.4.5 ok.
  • Screenshot harness against the base tree and the tip tree, same seeded row; output quoted above.

Not run:

  • No live GitHub OAuth, SMTP, Docker image or production instance; nothing here reads the network.
  • The console was exercised against a stub bridge that answers the instance state call, not a real FlyBot instance — the tick path and the payload are real, the team data is not.
  • No screenshot in English; the frames are zh-CN at 1280 because the marker words are the thing being shown, and the en strings are covered by test/pages.test.ts.

Risk, rollback, docs

  • Risk tier: T2 (risk-gate, basis public/team.js; src/ app code and a public/ script).
  • Rollback: revert the squash set; no schema change, no migration, no stored value rewritten, no environment or deploy change.
  • Docs: docs/architecture.md (attribution paragraph — one reconstruction, three readers) and docs/api.md (team endpoints carry attributionText). Changelog: changelog.d/1190.fixed.md.

@HugoXK-bot HugoXK-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: PASS at 21e624c

  • The erasure is real and reproduced: the console's rows are server-rendered through jobTable, which already marks the claim (src/views/pages.ts:589), while at base public/team.js:178-183 rewrote the cell from the structured attribution via attribution() (:48-60), which has no marker vocabulary — so any tick over a marked row drops the mark. At the tip both transports carry attributionText (src/app.ts:3588-3597 poll, :3865-3891 stream) and the script prefers it with the structured fallback for an older payload (public/team.js:181-185).
  • The stream claim is verified over the real endpoint, not a formatter mock: test/team.test.ts:249 opens the SSE stream and asserts attributionText === 'Dev-1 编写 · 声称,未观察 · Dev-2 编写' on the snapshot and the same on the 5-second poll; at base that read is undefined and the test fails exactly there.
  • The change-story row keeps model · role and moves the judgement into the note: src/lib/changeStory.ts:216-231 derives state from the ground, :281-287 selects claimed, not observed / claimed, not verified, and src/views/pages.ts:4188 renders the note; a grounded claim stays unmarked, which the test also pins.
  • One reconstruction inside this tree: attributionGroundFor (src/lib/attribution.ts:130-152) and claimedRoleState (:156-180) replace the copy that lived in pages.ts, and the job team line, the change-story row and both console transports read it. Non-blocking, cross-PR: #1210 moves the same legacy reconstruction to src/lib/teamStats.ts:55 and export.ts reads it, so on a post-#1210 rebase this should call that helper rather than keep a second copy (they also differ on empty steps: {steps: []} here vs null).
  • Red then green: 107/107 at the tip (pages, team, changeStory); at base 044c7515 with the two committed test files, 82 pass / 2 fail — the missing row note and undefined versus the marker — and pr-lint: ok (#1212, T2, 14 files).

Ran: npx tsx --test test/pages.test.ts test/team.test.ts test/changeStory.test.ts (107/107 in a tree built as base 044c7515 + this diff, all 14 blobs including the 4 PNGs equal to head); npx tsx --test test/pages.test.ts test/team.test.ts with only the committed test files at base (82 pass, 2 fail as quoted); node scripts/pr-lint.mjs --pr 1212 (ok, T2, 14 files).
Not run: full npm run check locally (CI ci-ok 136940098715 success; the newer pr-lint run 136940272374 is success at 18:23:24, superseding the 18:19:34 failure); no live FlyBot instance (the PR's own harness uses a stub bridge), no English screenshots, and no pixel inspection of the four PNGs (1116x727 and 1116x73) — this model has no image input.
Written-by: HugoXK-bot

@HugoXK-bot HugoXK-bot added the review:approved Issue reviewed and approved by the Fledge Platform Reviewer label Nov 21, 2026
…sole

The job page's "Why this change" row printed "model · role" without saying whether the record observed that seat, and the console row was built from the structured attribution alone, so a claim nothing checked read as a fact on both surfaces. One reconstruction of the record (attributionGroundFor) now answers for the job page, the change-story row and the console, and the console receives the server-rendered string so its live stream cannot drop the mark.
A: the job page's "Why this change" row. B: the console job row after its live stream tick. Both trees are the same seeded job, one whose written/implemented seat the ground record never observed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved Issue reviewed and approved by the Fledge Platform Reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(jobs): the change-story row and the console stream still print a claim as fact

2 participants