diff --git a/.kiro/breadth.toml b/.kiro/breadth.toml index 0cdaf678..8b5846b2 100644 --- a/.kiro/breadth.toml +++ b/.kiro/breadth.toml @@ -41,14 +41,14 @@ open_fronts = 0 # filled by the gate script once it exists [spec.dspy-driver] status = "active" # opened 2026-11-30 line = "dspy-driver" -phase = "design-generated" +phase = "tasks-generated" owner = ["src/openultrasast/hunt"] closes = "n/a (active)" [spec.hunter-learning-loop] status = "done" # 2026-11-30: built; open tasks moved to dspy-driver line = "hunter-learning-loop" -phase = "design-generated" +phase = "tasks-generated" owner = ["src/openultrasast/learn", "src/openultrasast/tool_hunter.py", "src/openultrasast/hunter_tools.py"] closes = "n/a (active)" diff --git a/.kiro/specs/dspy-driver/requirements.md b/.kiro/specs/dspy-driver/requirements.md index a7a11897..87737da6 100644 --- a/.kiro/specs/dspy-driver/requirements.md +++ b/.kiro/specs/dspy-driver/requirements.md @@ -225,3 +225,16 @@ that a good result here can still be tested fairly. the stored result and shall record that it did. - Requirement 5, criterion 7: When E0 is run a second time on the unchanged example book, the driver work shall start no engine and shall report the same annotations byte for byte. +- **2026-11-30, the example book.** The search of the development data (same day) found that the book + cannot be filled with AI-written applications only: no path-traversal case exists in an AI-written + TypeScript application, and most AI-written fixes carry a label taken from a commit title that nobody + reviewed. The maintainer chose "Mixed, as proposed". Requirement 1.2 now reads: the example book shall + draw every change from web application repositories in TypeScript or Python, AI-written where a sound + case exists and advisory-backed otherwise, with at least three vulnerable changes in each language; it + shall record for each repository whether it shows a sign of being AI-written. The ten proposed + repositories are in `tasks.md`, task 1.1. +- **2026-11-30, a new machine.** The maintainer: "once we have spec'ed this out, I plan to move this to a + new machine". This machine had 2.1 GB free on that day and one of the ten repositories is 1.8 GB. So no + repository is cloned here. Requirement 1 gains criterion 8: When the example book is set up on a machine, + the driver work shall fetch every repository of the book from its recorded address and revisions with one + command, and shall need no file that is not in the repository of this project. diff --git a/.kiro/specs/dspy-driver/spec.json b/.kiro/specs/dspy-driver/spec.json index 4c2fcd2e..6762fc1e 100644 --- a/.kiro/specs/dspy-driver/spec.json +++ b/.kiro/specs/dspy-driver/spec.json @@ -3,7 +3,7 @@ "created_at": "2026-11-30T00:00:00+01:00", "updated_at": "2026-11-30T00:00:00+01:00", "language": "en", - "phase": "design-generated", + "phase": "tasks-generated", "approvals": { "requirements": { "generated": true, @@ -12,10 +12,11 @@ }, "design": { "generated": true, - "approved": false + "approved": true, + "note": "maintainer 2026-11-30, question tool: 'Approve, generate tasks'" }, "tasks": { - "generated": false, + "generated": true, "approved": false } }, diff --git a/.kiro/specs/dspy-driver/tasks.md b/.kiro/specs/dspy-driver/tasks.md new file mode 100644 index 00000000..665cc76c --- /dev/null +++ b/.kiro/specs/dspy-driver/tasks.md @@ -0,0 +1,88 @@ +# Implementation Plan + +Stage one of `dspy-driver`: the example book, the wiring, the cache, E0 and E1. Nothing beyond it +(Requirement 7). The work moves to a new machine before it starts, so task 1 makes the setup travel. A task +is done when its "Done when" line can be shown, and tasks 4.2 and 5.2 are done by a record that is read, not +by a green test. + +- [ ] 1. The example book, on any machine +- [ ] 1.1 Write the book's manifest and its fetch command + - The ten vulnerable changes as approved by the maintainer on 2026-11-30 ("Mixed, as proposed"), each with repository address, vulnerable and fixing revision, family, labelled file and lines, label source and the AI-written sign. Access control: triggerdotdev/trigger.dev, mage-ai/mage-ai, andrea9293/mcp-documentation-server, HHHHHejia/openniw, langflow-ai/langflow. Path traversal: lfnovo/open-notebook (the upload), hkuds/vibe-trading, dgtlmoon/changedetection.io, ulab-uiuc/tiny-scientist, naorsabag/openhop + - One command clones every repository into a directory named by an environment variable, checks both revisions exist, and prints the size on disk. It reads nothing outside this repository: no local results directory, no git-ignored file + - The loader refuses a repository that a reserved, admission or evaluation population names, using the guard the tree already has + - Done when the command, run on a machine with an empty target directory, fetches all ten repositories and reports both revisions present for each + - _Requirements: 1.1, 1.2, 1.3, 1.5, 1.8_ +- [ ] 1.2 Check every label by hand and add the ordinary changes + - Each vulnerable label is read against its fix diff; openniw (label from a commit title) and vibe-trading (review pending) first. A label that does not hold is replaced from the candidate list of 2026-11-30 and the replacement is recorded + - Two ordinary changes per repository from its own history, each read by hand: none touches authorization or file handling + - The list of thirty goes to the maintainer; a change the maintainer names is added or its refusal recorded + - Done when the maintainer has approved the list and the freeze has written the book's digest + - _Requirements: 1.1, 1.4, 1.6, 1.7_ + +- [ ] 2. Abstract interpretation reaches the driver +- [ ] 2.1 The prover's trace as a producer (P) + - `trace` producer in the existing producer form: one `prove_change` per change, the traces of the changed function rendered as ordered text, or one cause from the closed list + - First check in this task: whether the prover's coverage and degradation fields decide the cause per location; if they do not, the cause is "to be read" and the gap is reported, not papered over + - Done when a fixture change with a known trace yields nonzero trace bytes with provenance, and each cause has a test that produces it + - _Requirements: 2.1, 2.3, 2.4, 2.5_ + - _Boundary: hunt/annotations.py_ +- [ ] 2.2 Joern's results as a producer (P) + - `joern` producer: the graph of the head revision once per revision, the `path` taint query and the `access_control` dominance query per changed function, rendered as ordered steps; "no path" is a result, "did not start" and "timed out" are failures + - The record holds the image digest, the Joern version, the source bytes read, the exit status, start-up seconds and query seconds; the image is rebuilt from HEAD before the first recorded run + - Done when, in the shipped image, one Python and one TypeScript fixture application with a known path traversal each yield a nonempty flow, and an engine made to exit nonzero yields a failed annotation + - _Requirements: 2.2, 2.3, 2.4, 2.5, 2.6_ + - _Boundary: hunt/annotations.py_ +- [ ] 2.3 The cache through the memory store + - Joern results keyed by repository, revision, path, function content, language, family, query, spec and image digests; model answers keyed by request digest, sample index and model version; both through the store's blob calls + - Done when a second producer run on unchanged input starts no engine and returns the same bytes, and a changed query digest is a miss + - _Requirements: 2.8, 5.7_ + - _Depends: roadmap step C1_ +- [ ] 2.4 The two inputs and the three masks + - `FEATURE_NAMES`, `PRODUCERS` and `INPUTS` gain the two producers; the arms of E1 are masks over one stored table, so every annotated arm reads the same bytes + - Done when a run with each of the three masks shows the expected inputs present and absent in its record + - _Requirements: 2.7_ + - _Depends: 2.1, 2.2_ + +- [ ] 3. Reading a run +- [ ] 3.1 Three answers and a vote (P) + - Ask a program three times with distinct sample indices; a location counts on two of three within ten lines; every answer and the agreement share are kept + - First check in this task: three calls at the fixed temperature return three samples and not one cached answer; if not, use DSPy's rollout id + - Done when scripted answers give the expected votes, and a live probe of three calls (inside the E1 ceiling) shows three distinct request records + - _Requirements: 6.3_ + - _Boundary: hunt/sampling.py_ +- [ ] 3.2 One page per example (P) + - Label, each annotation with byte count and provenance, the answers, the vote, hit or miss; the miss causes the records decide are set, the two that need a person are marked "to be read" and counted apart + - Done when golden pages on fixtures match for a hit, each decidable miss cause, and an ordinary change that drew a suspicion + - _Requirements: 3.1, 3.2, 3.3, 3.4_ + - _Boundary: hunt/pages.py_ +- [ ] 3.3 Show a page and rerun one example + - `ousast-hunt page` shows the page of an example and run; `ousast-hunt rerun` runs one example and arm again and states the cost before it starts + - Done when both commands work against a fixture run with the scripted model + - _Requirements: 3.5, 3.6_ + +- [ ] 4. E0, the delivery check +- [ ] 4.1 The E0 command + - Both producers over the frozen book, no model call, both API keys unset; the report per family and language of vulnerable examples whose annotation covers the labelled function, the causes for the rest, the count for ordinary examples, and the producer times + - Done when the command runs on a fixture book and its report shows every field + - _Requirements: 5.1, 5.2, 5.3, 5.5, 5.6, 8.5_ +- [ ] 4.2 Run E0 and read it + - The run on the frozen book in the shipped image; then the same run again + - A family with fewer than four of five covered is reported not ready, with its examples and causes handed to `engine-change-scoped-analysis` + - Done when the E0 record is published with the book's digest, the readiness of each family is stated, and the second run started no engine and gave the same bytes + - _Requirements: 5.2, 5.4, 5.5, 5.7_ + +- [ ] 5. E1, the baseline +- [ ] 5.1 The E1 manifest and its refusals + - One registered manifest: the book's digest, the three masks, model and version, three samples, the 10 USD ceiling, the mark; a second difference between arms, a reserved repository, or a missing registration refuses the run; the ceiling stops it and keeps its records; an arm with more than one instrument failure in ten is "not read" + - Done when each refusal and the stop have a test with the scripted model + - _Requirements: 4.1, 4.2, 4.3, 4.6, 4.7, 8.1, 8.2, 8.4_ +- [ ] 5.2 Run E1 and read it + - The three arms over the ready families of the book; counts, paired differences and top-K per arm with the per-example table; the pages; "to be read" causes set by a person + - The mark per family: the annotated arm finds at least two more of five than the arm without, with no more suspicions per ordinary change + - Done when the record is published under `benchmarks/measurements/` with the proof that every input was read, the mark is stated met or not per family, and one dated decision line is written + - _Requirements: 4.4, 4.5, 4.8, 6.1, 6.2, 6.4, 6.6, 6.7, 6.8, 8.3_ + +- [ ] 6. Close the stage with the maintainer + - The E1 result and its pages go to the maintainer. If a family met the mark, the next stage is opened by a dated amendment of the requirements that cites this result. If none did, the strategy experiments stop and the miss causes are the result + - Done when the maintainer's decision is recorded in the requirements + - _Requirements: 6.5, 7.2, 7.3, 7.5_