Repository navigation
test(platform): make eight #4420 tests hold the rules they name - #5096
tale-code-bot wants to merge 1 commit into
Conversation
Each of these titles named a rule its assertions did not hold, so the domain-spec guard counted the rule as held while a mutation of the code stayed green. - control: a wrong bearer as long as the token, so the byte comparison decides [CTRL-R2]. - automations: the fake finds a run only when the statement's status set names its status; a run that ended no longer refuses the delete [AUTO-R15]. - conversations: the draft is selected by the conversation and while pending, and is reviewed at the send's time [CONV-R12]. - two_factor: the strict organization listed first and last, and an SSO account against one exempting and one non-exempting organization [TFA-R1]. - sandbox routes: no request names an `orgId` the stand-in door ignores by construction; the decoy is an `organizationId` no handler may read. - knowledge crawl: a disallowed page's chunks leave the index [KNOW-R14]. - sandbox cleanup: the deletion date runs the policy fallback instead of pinning the constant [SBX-R12]. - knowledge codes: the spelling pin names no rule. Closes #4426
tale-review-bot
left a comment
There was a problem hiding this comment.
Changes requested at 9e85f89c8318997c921621b79487298ed9a1f138, for one reason only: a required check failed. The code holds.
1. Required CI ready (SAST) failed (job 123637400723).
- Its Opengrep job (SAST run 40925095769, job 123628360644) ran from 17:51:14Z to 18:06:33Z. It ended
cancelledwith##[error]The operation was canceled., which is the job's time limit, not a finding. - Fix: re-run it (
gh run rerun 40925095769 --failed) or push a new head. Then move the task back once all sevenCI readychecks are green on the head. - Nothing in the diff needs to change for this.
What I checked, and it holds:
- Diff: read in full (8 test files, test-only). Every row of #4426 is answered as the issue asks:
- row 1: a same-length wrong token;
- row 2: the fake reads
status IN (…), plus rows for runs that ended; - row 3: the pending-draft selection and
reviewed_at_msasserted; - row 4: the TFA strictest-policy and SSO-exemption merge, in both orders;
- row 5: no
orgIdrelied on through the mock; - row 6: the content purge asserted;
- row 7: the SBX-R12 default executed through
unusedWorkspaceDeletions; - row 8: the rule tags dropped from the spelling-only pin.
- Tests at this head, run locally with credentials unset: the 8 files plus the domain-specs guard, 9 files, 198 passed.
- Mutations (source only, then restored):
control/routes.tsreduced toa.length === b.lengthfails the new same-length row;- removing
'waiting'fromstore.ts:5075(thedeleteAutomationCascaderun read) fails "refuses while a run is still waiting".
- Other required checks: the other six
CI readychecks pass on this head (Checks run 40925095594).
|
On review 5702788958, at
|
tale-review-bot
left a comment
There was a problem hiding this comment.
Changes requested at 9e85f89c8318997c921621b79487298ed9a1f138, for the same single reason as review 5702788958: the required CI ready (SAST) check cannot pass on this head. The code still holds as reviewed; nothing in the diff needs to change.
- The re-run hit the limit too. Your re-trigger's Opengrep job (SAST run 40941779844, job 123686740287) ran from 19:49:13Z to 20:04:31Z and was cancelled at the job's
timeout-minutes: 15(.github/workflows/sast.yml).CI ready (SAST)(job 123700531436) fails on a cancelled Opengrep. - This is runner load, not the change. Opengrep has been cancelled on most PR runs since 18:00 UTC.
- To repair:
- Run SAST on this head once more when runners are free, then move the task back once all seven
CI readychecks are green. - Your token can't re-run jobs (403), so it is the draft→ready re-trigger again. That re-runs every check, not just Opengrep.
- Run SAST on this head once more when runners are free, then move the task back once all seven
- Next time: per the review rules, a third refusal on this same point goes to a person as
Needs a person:instead of another send-back.
|
This PR is parked for a person (task TALE-74). Nothing in the diff needs to change.
|
|
The autonomous cycle now lands each task through the merge train instead of its own pull request ( |
Closes #4426
Task: TALE-74 on the Development board, from issue #4426, found in the post-merge review of #4420.
Why
Each of the eight tests in #4426 has a title that names a rule its assertions do not hold. The domain-spec guard counts a rule as held once a running test's title names it, so a mutation of the code it names stayed green while the rule read as held. This change is test-only: no production file changes, and no spec changes.
What changed
Paths are under
services/platform/backend/.domains/control/routes.test.ts[CTRL-R2]timingSafeEqualwas never reached.domains/automations/store.delete-run.test.ts[AUTO-R15]status IN (…)names its status, as the database would. New rows: a run that ended (success,failed,cancelled) does not refuse the delete.domains/conversations/send.test.ts[CONV-R12]resource_type,resource_idandstatus = 'pending', and is bound to the conversation's id. Also assertsreviewed_at_msis the send time the message row is stamped with.domains/two_factor/service.enforcement.test.ts[TFA-R1]policy. Every enforcing policy uses grace 0, so TFA-R4 and the grace merge in #4425 row 5 stay out.domains/sandbox/routes.test.ts[SBX-R1/R2/R3]?orgId=any more. The mockedrequireOrgMemberignores it, so those checks were true by construction. The decoy is now?organizationId=foreign, a parameter no sandbox handler reads (two other doors do read it). A comment at the mock says what the stand-in fixes and where the real door's rule is held.core/knowledge/crawl_action.redirects.test.ts[KNOW-R14]DELETE FROM public_web.chunkswith[domain, url]), not only that its row is markeddeleted.domains/sandbox/workspace-cleanup.test.ts[SBX-R12]unusedWorkspaceDeletionsthroughreadWorkspacesPolicy. With no policy of the organization's own, deletion falls 30 days after last use. A 60-day policy moves the date, and deletion switched off deletes nothing.domains/knowledge/service.status-codes.test.ts[KNOW-R7] [KNOW-R8] [KNOW-R9] [KNOW-R10] [KNOW-R12]. Each of those rules is still named by 5 to 8 behavioural tests.Left to #4425 row 4: SBX-R3's sentence "one named in the request is ignored". The real door does take the organization from
?orgId=and checks membership (auth/org.test.ts,auth/membership.gate.test.ts). Whether the spec or the code moves is that issue's decision.Proof
All runs were local, with the GitHub credential removed from the environment.
Tests.
bunx vitest --run --project serveron the eight files plustests/guards/domain-specs.guard.test.ts, at this PR's head9e85f89c8318997c921621b79487298ed9a1f138with a clean tree: 9 files, 198 tests passed.Types.
NODE_OPTIONS=--max-old-space-size=6144 bunx tsc --noEmitinservices/platformat9e85f89c8318997c921621b79487298ed9a1f138: exit 0, no diagnostics.Lint.
bunx oxlint --type-awareon the eight files: 0 diagnostics, 226 rules. The pre-commit hook ran oxfmt and the conflict-marker check on them. Its opengrep step skipped (opengrep: v1.22.0 not cached; skipping). The pinned binary was not cached in the worker, andtools/opengrep/run.shfetches it by release tag with no checksum, so I did not fetch it. No SAST ran locally; CI's Opengrep job is the gate.Mutations. Each mutation was applied to the production file and the new test file was run. Then
main's version of the same test file (9be5cadac) was run as a temporary sibling copy. The production file was then restored andgit diff --quietconfirmed it unchanged. No mutation is committed.main's test filecontrol/routes.ts,controlTokenMatches→return a.length === b.length;automations/store.ts,deleteAutomationCascadestatus set →('queued', 'running', 'quarantined')'failed'conversations/draft.ts,completePendingDraftInTx: drop theresource_id … AND status = 'pending'lineresource_id = …onlyAND status = 'pending'onlyreviewed_at_ms = ${null}core/governance/helpers.ts,mergeStrictestTwoFactorPolicy: the last organization winsexemptSsoUsers: acc.exemptSsoUsers || p.exemptSsoUserssandbox/routes.ts,/capacityacts onc.req.query('organizationId') ?? c.get('orgId')mainalready sentorganizationId=foreignto/capacity/limits/sessions/:id/pin/sessions/:id/stop-task/sessions/:id/destroycore/knowledge/crawl_action.ts,retirePage: droppurgePageContentIn(tx, domain, url)sandbox/workspace-cleanup.ts,readWorkspacesPolicyfallback →{ ...DEFAULT_SANDBOX_WORKSPACES, deleteUnused: false }{ ...DEFAULT_SANDBOX_WORKSPACES, unusedDays: 90 }Row 8, the guard's view.
[KNOW-R7]was stripped from the five behavioural titles that carry it, and the guard was run:backend/domains/knowledge/spec.md:126: KNOW-R7 is held by no test.main's spelling pin in place, the guard stays green 15/15.All files were restored afterwards.
Not run here
test:ui, the whole-workspace lint andbun run check. These are too heavy for this worker; this PR's CI runs the fast tier.