Create proof files from templates #28

Merged
marfavi merged 39 commits from feature/create-spec-from-template into main 2026-10-23 15:46:21 +02:00
Owner

Adds the Crocq: Create proof files for project command, which scaffolds Verif_<file>.v proof files from templates.

Fixes #27

Adds the `Crocq: Create proof files for project` command, which scaffolds `Verif_<file>.v` proof files from templates. Fixes #27
michael self-assigned this 2026-10-14 12:17:36 +02:00
Reviewed-on: #17
Reviewed-by: EatOreo <[email protected]>
Co-authored-by: Omid Marfavi <[email protected]>
Co-committed-by: Omid Marfavi <[email protected]>
* `npm run compile-tests` clears `out/` first so stale test files left behind by other branches are not executed.
* Running tests via the Test Runner panel also clears stale test files.

Reviewed-on: #22
Co-authored-by: Omid Marfavi <[email protected]>
Co-committed-by: Omid Marfavi <[email protected]>
Pure rename of the VS Code collaborator directory to avoid clashing with the new src/dependencies module. No behaviour change.

Reviewed-on: #21
Reviewed-by: EatOreo <[email protected]>
Co-authored-by: Omid Marfavi <[email protected]>
Co-committed-by: Omid Marfavi <[email protected]>
Quotes the clightgen file name and the terminal cd target so spaces or metacharacters in a path are not interpreted by the shell.

Reviewed-on: #20
Reviewed-by: EatOreo <[email protected]>
Co-authored-by: marfavi <[email protected]>
Co-committed-by: marfavi <[email protected]>
- Cover the command end-to-end via shell integration
- Test the files, logging and terminal dependencies
- Re-create the log output channel after deactivate

fixes #12

Reviewed-on: #16
Reviewed-by: EatOreo <[email protected]>
Reviewed-by: Michael Jeppesen <[email protected]>
Co-authored-by: Omid Marfavi <[email protected]>
Co-committed-by: Omid Marfavi <[email protected]>
Adds a src/dependencies module that verifies clightgen and VsRocq on activation, with a status bar chip, dependency panel and settings. Create Rocq Model now gates on the check.

fixes #10

Reviewed-on: #19
Co-authored-by: Omid Marfavi <[email protected]>
Co-committed-by: Omid Marfavi <[email protected]>
created dependicies for new command
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 50s
Extension / Format, types, lint, extension tests (pull_request) Failing after 1m8s
faa0c7d3bf
fixed errors caused by merge
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 51s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m42s
9f4660eac3
manually create temp data to test templates
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 45s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m32s
0bcd097c6a
michael force-pushed feature/create-spec-from-template from 0bcd097c6a
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 45s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m32s
to 9b655d83d6
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 39s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m16s
2026-10-14 13:44:25 +02:00
Compare
update template args structure, and make multiple files be generatable at once
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 42s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m29s
b7dbff73fb
michael force-pushed feature/create-spec-from-template from 08aee38637
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 43s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m21s
to 6c3326dbe7
Some checks failed
Extension / Format, types, lint, extension tests (pull_request) Failing after 1m48s
Grammar / Corpus and binding tests (pull_request) Successful in 44s
2026-10-15 14:46:41 +02:00
Compare
added an uri of where to place the proof files to the template args
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 46s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m40s
fd7fb2d37a
minor layout tweaks and improvements
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 47s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m38s
7698c613f3
michael force-pushed feature/create-spec-from-template from 7698c613f3
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 47s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m38s
to 7a229cb9a2
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 41s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m34s
2026-10-16 11:14:58 +02:00
Compare
marfavi changed title from WIP: feature/create-spec-from-template to WIP: Create spec from template 2026-10-16 11:18:03 +02:00
moved files arround
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 47s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m47s
6d1d83889d
Removed temporary logging and access services correctly
Some checks are pending
Extension / Format, types, lint, extension tests (pull_request) Waiting to run
Grammar / Corpus and binding tests (pull_request) Waiting to run
84a0cc6344
Created some tests, might need change as it requires vscode dependencies
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 55s
Extension / Format, types, lint, extension tests (pull_request) Failing after 59s
a93cd8fb51
Added comment to fix tests
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 43s
Extension / Format, types, lint, extension tests (pull_request) Failing after 46s
916c4c0e77
Added optional argument to createProofFile to specify which file to generate
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 55s
Extension / Format, types, lint, extension tests (pull_request) Failing after 57s
f56d3ccf14
michael force-pushed feature/create-spec-from-template from f56d3ccf14
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 55s
Extension / Format, types, lint, extension tests (pull_request) Failing after 57s
to 454502c7ae
Some checks failed
Extension / Format, types, lint, extension tests (pull_request) Failing after 53s
Grammar / Corpus and binding tests (pull_request) Successful in 56s
2026-10-21 13:04:02 +02:00
Compare
Added note about buggy behavior
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 43s
Extension / Format, types, lint, extension tests (pull_request) Failing after 44s
9968b41607
marfavi self-assigned this 2026-10-21 13:46:50 +02:00
Owner

Fix #27

Fix #27
crocq.checkDependencies, crocq.openDependencyPanel and crocq.createProofFiles
were each declared twice in contributes.commands, a leftover of the merge with
main. Keep one entry per command.
The .eta templates lived under src/templates, which .vscodeignore excludes from
the packaged extension (src/**); esbuild does not copy them either. A packaged
build therefore had no templates to render.

Move them to templates/ at the extension root and point the command at that
directory. spec.eta also notes that its funspec arguments are placeholders.
- fileNameFromUri parses Uri.fsPath with node:path instead of splitting
  uri.toString(), which mishandled percent-encoded names and queries.
- getCFilesInWorkspace uses try/catch (findFiles rejects when no folder is
  open) and logs the failure instead of swallowing it.
- Add fileExists, and make writeFile create missing parent directories.
- Add readFileAnnotations, which parses a C file from disk whether or not it
  is open. The document sync only stores annotations of open documents.
- Add showWarningMessage.
- Inject the vscode-facing services (same convention as createRocqModel) so
  the command and the annotation-to-template mapping are unit testable without
  an extension host. The unit tests previously failed to load because they
  imported vscode.
- Read the annotations of every C file from disk instead of opening all of
  them and hoping the asynchronous onDidOpenTextDocument listener had filled
  the store by then. This removes the empty/stale-store race (and the note
  about proofs for deleted files).
- Never overwrite an existing proof file; skip it and warn instead. The old
  code overwrote Verif_*.v on every run, destroying user proofs.
- Match the optional file argument on path boundaries instead of endsWith, and
  name the "all" argument.
- Report failures instead of rejecting: aggregated, de-duplicated annotation
  errors, per-file read resilience, and an information message when there is
  nothing to generate.
- Drop triggerOnDocumentOpen, which the command no longer uses, and move the
  proof file's uri out of the template arguments (it is not a template input).
- Assert that package.json contributes each command exactly once, guarding the
  duplicate-command merge artifact.
- Assert that the verif/spec/proof templates ship where the command looks for
  them.
- Cover fileNameFromUri, fileExists, writeFile (including parent-directory
  creation) and getTargetUriAndSpec against real vscode URIs.
Describe what it scaffolds, that it never overwrites existing documents, and
that the generated funspec arguments are placeholders until deriving a VST
funspec from the C source is implemented.
chore(examples): end _CoqProject with a newline
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 43s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m36s
1796da2e71
marfavi changed title from WIP: Create spec from template to Create proof files from templates 2026-10-21 14:08:06 +02:00
marfavi changed title from Create proof files from templates to WIP: Create proof files from templates 2026-10-21 14:14:50 +02:00
marfavi force-pushed feature/create-spec-from-template from 1796da2e71
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 43s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m36s
to 9968b41607
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 43s
Extension / Format, types, lint, extension tests (pull_request) Failing after 44s
2026-10-21 14:18:43 +02:00
Compare
Add generation of loop invariant template from loop annotations
Some checks failed
Extension / Format, types, lint, extension tests (pull_request) Failing after 44s
Grammar / Corpus and binding tests (pull_request) Successful in 44s
22a053a523
branch suggestion: create proof files from template (#63)
Some checks failed
Extension / Format, types, lint, extension tests (pull_request) Has been cancelled
Grammar / Corpus and binding tests (pull_request) Has been cancelled
e893dc7731
Co-authored-by: Michael Jeppesen <[email protected]>
Reviewed-on: #63
Reviewed-by: Michael Jeppesen <[email protected]>
Co-authored-by: Omid Marfavi <[email protected]>
Co-committed-by: Omid Marfavi <[email protected]>
marfavi changed title from WIP: Create proof files from templates to Create proof files from templates 2026-10-23 13:47:38 +02:00
Merge branch 'main' into feature/create-spec-from-template
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 51s
Extension / Format, types, lint, extension tests (pull_request) Successful in 2m3s
d32cf84aae
michael force-pushed feature/create-spec-from-template from d32cf84aae
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 51s
Extension / Format, types, lint, extension tests (pull_request) Successful in 2m3s
to e3a5e356bf
Some checks failed
Extension / Format, types, lint, extension tests (pull_request) Failing after 58s
Grammar / Corpus and binding tests (pull_request) Has been cancelled
2026-10-23 15:16:56 +02:00
Compare
Removed non existing command from merge
Some checks failed
Extension / Format, types, lint, extension tests (pull_request) Failing after 59s
Grammar / Corpus and binding tests (pull_request) Successful in 1m2s
dc2c746240
fixed duplicated commands being registered
Some checks failed
Extension / Format, types, lint, extension tests (pull_request) Failing after 1m25s
Grammar / Corpus and binding tests (pull_request) Successful in 1m25s
b59634a13f
formatting
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 50s
Extension / Format, types, lint, extension tests (pull_request) Failing after 1m57s
5553fdb070
Remove command for opening dependency panel from package.json
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 40s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m50s
f531a0a45a
marfavi scheduled this pull request to auto merge when all checks succeed 2026-10-23 15:40:53 +02:00
Rename _CoqProject -> _RocqProject
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 44s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m43s
d1eff1c6c4
marfavi approved these changes 2026-10-23 15:46:18 +02:00
marfavi deleted branch feature/create-spec-from-template 2026-10-23 15:46:21 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code2rocq/crocq!28
No description provided.