steid

@jamesgill /

Rust26.3 KBCode·Blame·History·Raw
1use std::time::SystemTime;
2
3use crate::domain::{
4 Actor, DomainError, ImportSource, ImportState, OrgName, RefName, RepoId, RepoName, RepoWrite,
5 Repository, Visibility,
6 repository::{
7 IssueRepository, MembershipRepository, OrgRepository, PullRequestRepository, RepoRepository,
8 },
9};
10
11use super::{
12 access::{Stores, changeable_repo, is_org_member, is_org_owner, visible_repo},
13 error::{Error, Result},
14 paging::Paged,
15 port::{GitQuery, GitStorage, GitStorageError},
16};
17
18/// How many repositories one page of the Repositories tab shows.
19///
20/// An instance with more than this is not the case Steid is designed around — the tab
21/// is where completeness lives — so the control is something most instances will never
22/// render.
23pub const REPO_LIMIT: usize = 50;
24
25/// The repository a visitor is asking to create.
26///
27/// Raw input: `name` is whatever was typed, and normalising it is
28/// [`Repository::new`]'s job, not the caller's.
29#[derive(Debug, Clone, PartialEq, Eq)]
30pub struct NewRepo {
31 pub name: String,
32 pub description: Option<String>,
33 pub visibility: Visibility,
34}
35
36/// Creates a repository as a record and as a bare repo on disk.
37///
38/// Owner only. A member's read access is not permission to add repositories to the
39/// instance.
40///
41/// Returns the created [`Repository`] rather than `()` because the name normalises on
42/// the way in — someone who typed `MyRepo` has to be redirected to `myrepo`, and only
43/// the returned value knows that.
44///
45/// **The two writes cannot share a transaction.** The bare repo is created first and
46/// removed again if the record fails to save, per
47/// `plans/architecture.md#db-plus-filesystem-writes`. If the process dies between them
48/// the directory is orphaned; that hole is known and unclosed.
49pub async fn create_repo(
50 actor: &Actor,
51 handle: &OrgName,
52 spec: &NewRepo,
53 now: SystemTime,
54 stores: &Stores<'_, impl OrgRepository, impl MembershipRepository, impl RepoRepository>,
55 storage: &impl GitStorage,
56) -> Result<Repository> {
57 let Some(org) = stores.orgs.find_by_name(handle).await? else {
58 return Err(DomainError::NotFound {
59 entity: "repository owner",
60 }
61 .into());
62 };
63
64 if !is_org_owner(&org, actor, stores.memberships).await? {
65 return Err(DomainError::Forbidden.into());
66 }
67
68 // Validated before anything is written, so a bad name leaves neither a row nor a
69 // directory behind.
70 let repo = Repository::new(
71 RepoId::generate(),
72 org.id.clone(),
73 spec.name.clone(),
74 spec.description.clone(),
75 spec.visibility,
76 now,
77 )?;
78
79 if stores
80 .repos
81 .find_by_org_and_name(&org.id, &repo.name)
82 .await?
83 .is_some()
84 {
85 return Err(taken());
86 }
87
88 storage
89 .init_bare(handle, &repo.name)
90 .await
91 .map_err(|error| {
92 match error {
93 // No record, but something is already on disk: an orphan from a create that
94 // died between the two writes. The name really is unavailable, so this is
95 // what the visitor is told — at the cost of an orphan being
96 // indistinguishable from a duplicate from the outside. The durable fix is
97 // the reconciliation sweep noted in architecture.md.
98 GitStorageError::AlreadyExists => taken(),
99 other => Error::GitStorage(other),
100 }
101 })?;
102
103 if let Err(error) = stores.repos.save(&repo).await {
104 // Compensation. Safe to delete by path because `init_bare` just proved nothing
105 // was there — this can never remove a repository that won a race, because the
106 // loser of that race never gets past `init_bare`.
107 //
108 // Best effort: if the removal also fails the caller still needs the error that
109 // started this, and an orphaned directory is the documented failure mode.
110 let _ = storage.remove(handle, &repo.name).await;
111 return Err(error.into());
112 }
113
114 Ok(repo)
115}
116
117/// A repository as a viewer is allowed to see it.
118#[derive(Debug, Clone, PartialEq, Eq)]
119pub struct RepoView {
120 /// The owning handle, carried so a page can build links without a second lookup.
121 pub handle: OrgName,
122 pub name: RepoName,
123 pub description: Option<String>,
124 pub visibility: Visibility,
125 /// When code last landed here. The repository page dates itself from this rather
126 /// than asking git, which costs a fork.
127 pub updated_at: SystemTime,
128 /// Whether this repository leads the owner's profile. Here as well as on
129 /// [`RepoSummary`] because the settings page renders the pin control from this view
130 /// and would otherwise have to read the row a second time to know the box's state.
131 pub pinned: bool,
132 /// Whether the repository is archived: readable, not writable. Every repository
133 /// page renders the badge from this, so it travels with the view rather than being
134 /// looked up again per page.
135 pub archived: bool,
136 /// Whether the viewer may change this repository. Decided here so a page and
137 /// `/api` cannot disagree about who sees a management control.
138 pub viewer_is_owner: bool,
139 /// How far an import has got, or `None` for an ordinary repository.
140 ///
141 /// Carried on the view rather than looked up separately because **every page that
142 /// reads a repository has to check it**: the contents are not there yet, and asking
143 /// git for them costs five processes to be told the directory is empty.
144 pub import: Option<ImportStatus>,
145 /// How many issues are open, for the Issues tab.
146 ///
147 /// On the view because the tab is part of the frame *every* repository page draws,
148 /// and a number that appears on three of them is worse than no number at all. One
149 /// `count(*)`, and pull requests get the same treatment for the same reason.
150 pub open_issues: u64,
151 /// How many pull requests are open, for the Pull requests tab.
152 ///
153 /// Beside [`open_issues`](Self::open_issues) and read alongside it: the tab is part
154 /// of the same frame, so a number that appeared on only some pages would read as a
155 /// bug in the number.
156 pub open_pulls: u64,
157}
158
159/// An import, as a page renders it.
160///
161/// The state, the address and the reason travel together because no page wants one
162/// without the others: the importing panel names the source, and the failed panel names
163/// the source and the reason.
164#[derive(Debug, Clone, PartialEq, Eq)]
165pub struct ImportStatus {
166 pub state: ImportState,
167 pub source: Option<ImportSource>,
168 pub error: Option<String>,
169}
170
171impl ImportStatus {
172 /// Reads the import off a repository, or `None` for an ordinary one.
173 fn of(repo: &Repository) -> Option<Self> {
174 Some(Self {
175 state: repo.import_state?,
176 source: repo.import_source.clone(),
177 error: repo.import_error.clone(),
178 })
179 }
180
181 pub fn is_running(&self) -> bool {
182 self.state == ImportState::Importing
183 }
184}
185
186/// Resolves a handle and name into the repository as a page renders it.
187///
188/// [`visible_repo`](super::access::visible_repo) decides whether it may be seen; this
189/// adds what the frame every repository page carries needs, which is one extra query: the open issue count for the
190/// Issues tab. That count used to be an optional parameter the issues pages passed and
191/// nothing else did, so the tab showed a number on three pages out of a dozen — a count
192/// that appears when you click Issues and vanishes when you click Code reads as a bug in
193/// the count rather than as a design.
194///
195/// One `count(*)` per page that draws the header, and *only* those pages: everything
196/// that merely needs the authorization goes through
197/// [`visible_repo`](super::access::visible_repo) instead.
198pub async fn view_repo(
199 handle: &OrgName,
200 name: &RepoName,
201 actor: &Actor,
202 stores: &Stores<'_, impl OrgRepository, impl MembershipRepository, impl RepoRepository>,
203 issues: &impl IssueRepository,
204 pulls: &impl PullRequestRepository,
205) -> Result<Option<RepoView>> {
206 let Some((org, repo)) = visible_repo(actor, handle, name, stores).await? else {
207 return Ok(None);
208 };
209
210 // Two counts, run together: both are drawn by the same tab strip on the same page,
211 // so paying two round trips for one header would be a round trip wasted.
212 let (issue_counts, pull_counts) =
213 tokio::try_join!(issues.counts(&repo.id), pulls.counts(&repo.id))?;
214
215 Ok(Some(RepoView {
216 handle: org.name.clone(),
217 import: ImportStatus::of(&repo),
218 name: repo.name,
219 description: repo.description,
220 visibility: repo.visibility,
221 updated_at: repo.updated_at,
222 pinned: repo.pinned,
223 archived: repo.archived,
224 viewer_is_owner: is_org_owner(&org, actor, stores.memberships).await?,
225 open_issues: issue_counts.open,
226 open_pulls: pull_counts.open,
227 }))
228}
229
230/// A repository as it appears in a listing.
231///
232/// Leaner than [`RepoView`] on purpose: the owning handle and whether the viewer owns
233/// it are constant across a listing and already known to whatever is rendering it.
234#[derive(Debug, Clone, PartialEq, Eq)]
235pub struct RepoSummary {
236 pub name: RepoName,
237 pub description: Option<String>,
238 pub visibility: Visibility,
239 pub updated_at: SystemTime,
240 /// Whether this is the owner's lead repository. Carried in the listing because the
241 /// profile picks the lead *out of* the listing rather than fetching it separately —
242 /// one query, and no chance of the lead and the list disagreeing.
243 pub pinned: bool,
244 /// Whether the repository is archived. Carried for the same reason `pinned` is: the
245 /// profile's badge comes out of the listing rather than a row read per repository.
246 pub archived: bool,
247 /// How far an import has got, or `None` for an ordinary repository.
248 ///
249 /// The state rather than the whole [`ImportStatus`]: a listing row needs to tell
250 /// "still copying" from "did not copy" — a badge saying "Importing" on a row that
251 /// failed an hour ago is a lie — but the address and the reason belong on the page
252 /// that has room for them.
253 pub import_state: Option<ImportState>,
254}
255
256/// Every repository under a handle that the viewer is allowed to see, most recently
257/// updated first — the order [`RepoRepository::list_by_org`] defines.
258///
259/// `Ok(None)` means no such handle — distinct from `Ok(Some(vec![]))`, which means the
260/// handle exists and the viewer can see nothing under it. A caller serving `/api` needs
261/// that difference to answer 404 rather than an empty list.
262///
263/// **The filtering happens here, not in the port.** `list_by_org` deliberately returns
264/// everything, so that the page and `/api` cannot end up applying different rules.
265/// A viewer who may see nothing gets an empty list, never a count or a hint — that
266/// would leak both the existence and the number of private repositories.
267pub async fn list_repos(
268 handle: &OrgName,
269 actor: &Actor,
270 page: Option<usize>,
271 stores: &Stores<'_, impl OrgRepository, impl MembershipRepository, impl RepoRepository>,
272) -> Result<Option<Paged<RepoSummary>>> {
273 let Some(org) = stores.orgs.find_by_name(handle).await? else {
274 return Ok(None);
275 };
276
277 // Resolved once rather than per row: membership cannot change mid-listing, and
278 // asking per repository would be a query per repository.
279 let is_member = is_org_member(&org, actor, stores.memberships).await?;
280
281 // Sliced here rather than at the port, and *after* the visibility filter: paging in
282 // SQL would count private repositories a visitor cannot see, so page 2 would be
283 // short and the total would leak how many are hidden.
284 let visible: Vec<RepoSummary> = stores
285 .repos
286 .list_by_org(&org.id)
287 .await?
288 .into_iter()
289 .filter(|repo| repo.visibility.is_public() || is_member)
290 .map(|repo| RepoSummary {
291 import_state: repo.import_state,
292 name: repo.name,
293 description: repo.description,
294 visibility: repo.visibility,
295 updated_at: repo.updated_at,
296 pinned: repo.pinned,
297 archived: repo.archived,
298 })
299 .collect();
300
301 Ok(Some(
302 // `None` is every repository in one page: the profile overview picks the pinned
303 // one out of the whole list and counts the rest, and `/api` answers with all of
304 // them. Only the Repositories tab is a list somebody scrolls.
305 match page {
306 Some(page) => Paged::slice(visible, page, REPO_LIMIT),
307 None => {
308 let size = visible.len().max(1);
309 Paged::slice(visible, 1, size)
310 }
311 },
312 ))
313}
314
315/// The changes an owner is asking to make to a repository.
316///
317/// Grouped like [`NewRepo`] rather than passed loose, so that adding a settable field
318/// later does not change every call site — and so the argument list stays readable.
319///
320/// **No `name`.** See [`update_repo`].
321#[derive(Debug, Clone, PartialEq, Eq)]
322pub struct RepoEdit {
323 pub description: Option<String>,
324 pub visibility: Visibility,
325 /// Whether this repository should lead the owner's profile. Setting it unpins
326 /// whichever repository held the spot — see [`update_repo`].
327 pub pinned: bool,
328}
329
330/// Changes a repository's description and visibility.
331///
332/// Owner only. Seeing a private repository is not permission to change it.
333///
334/// **The name is deliberately not changeable here.** A rename is not a column update:
335/// the bare repo lives at `{data_dir}/{handle}/{name}.git`, so renaming means moving a
336/// directory while clones, pushes and in-flight requests point at the old path, and it
337/// needs its own use case with its own answer for the two-writes problem in
338/// `plans/architecture.md#db-plus-filesystem-writes`. Half-doing it — updating the row
339/// and leaving the directory — would break every existing clone silently.
340///
341/// Returns the saved [`Repository`] so a caller can re-render from what was actually
342/// stored rather than from what was submitted; the description normalises on the way in.
343pub async fn update_repo(
344 actor: &Actor,
345 handle: &OrgName,
346 name: &RepoName,
347 edit: &RepoEdit,
348 stores: &Stores<'_, impl OrgRepository, impl MembershipRepository, impl RepoRepository>,
349) -> Result<Repository> {
350 let existing = changeable_repo(actor, handle, name, stores).await?;
351
352 // Rebuilt through `new` rather than assigned field by field, so the description
353 // length rule lives in exactly one place. The stored name goes back through
354 // validation as a side effect — acceptable because it was validated on the way in
355 // and has not changed, and the alternative is a second copy of the rule here.
356 let mut updated = Repository::new(
357 existing.id,
358 existing.org_id.clone(),
359 existing.name.as_str(),
360 edit.description.clone(),
361 edit.visibility,
362 // The existing timestamp, not the current time. `updated_at` means "code last
363 // landed here" and orders the listing recently active first; rewording a
364 // description is not work on the repository and must not jump it to the top.
365 existing.updated_at,
366 )?;
367 updated.pinned = edit.pinned;
368 // Carried, not edited. Archiving is its own use case with its own control; a
369 // description save must not quietly un-archive a repository.
370 updated.archived = existing.archived;
371 // **And the import, for the same reason and a worse consequence.** `new()` resets
372 // these three, so before this a save during an import ended the import as far as
373 // Steid was concerned: the page went back to reading like an ordinary empty
374 // repository, `refuse_writes` stopped refusing pushes into the directory
375 // `git clone --mirror` was still writing into, and the provenance — which is meant
376 // to outlive the state — was gone for good. Found by saving a visibility change
377 // while a real import was running.
378 let updated = updated.with_import(
379 existing.import_state,
380 existing.import_source.clone(),
381 existing.import_error.clone(),
382 );
383
384 // **At most one pinned repository per owner**, enforced here rather than in storage.
385 // The rule is not "refuse a second pin" but "pinning this unpins that", and a
386 // constraint — a partial unique index would express the shape exactly — can only
387 // refuse. Enforcing it in the use case also keeps the two `RepoRepository`
388 // implementations from having to agree on a behaviour neither of them is asked for.
389 //
390 // The two writes are not one transaction, so a crash between them can leave nothing
391 // pinned. That is the harmless direction: no lead section, rather than two.
392 if updated.pinned {
393 for other in stores.repos.list_by_org(&existing.org_id).await? {
394 if other.pinned && other.id != updated.id {
395 stores
396 .repos
397 .save(&Repository {
398 pinned: false,
399 ..other
400 })
401 .await?;
402 }
403 }
404 }
405
406 stores.repos.save(&updated).await?;
407
408 Ok(updated)
409}
410
411/// Renames a repository: its record, and the bare repo on disk.
412///
413/// Owner only, and the second of Steid's two writes that cannot share a transaction.
414/// **The directory moves first, then the row**, which is the opposite order from
415/// [`delete_repo`] and the same one as [`create_repo`], for the same reason: a move is
416/// reversible and a delete is not, so the filesystem write can be undone if the record
417/// write fails. If the process dies between them the repository is on disk under its
418/// new name while the row still says the old one, and every page 404s until it is moved
419/// back by hand — the same class of hole `create_repo` documents, and closed by the same
420/// reconciliation sweep in `plans/architecture.md#db-plus-filesystem-writes`.
421///
422/// **Nothing redirects from the old name.** Steid is single tenant and the owner holds
423/// the clones; a permanent alias table would outlive its usefulness on the first repo
424/// that is renamed twice. Existing remotes have to be updated, and the form says so.
425///
426/// Renaming to the name it already has is a no-op rather than an error: the name
427/// normalises on the way in, so `MyRepo` submitted for `myrepo` is somebody confirming
428/// what is already true, not a collision with itself.
429///
430/// **Refused while an import is landing** — [`Repository::refuse_writes`] with
431/// [`RepoWrite::Settings`] — because the directory being moved is the one the clone is
432/// writing into. An archived repository renames freely: archived means finished, not
433/// frozen.
434pub async fn rename_repo(
435 actor: &Actor,
436 handle: &OrgName,
437 name: &RepoName,
438 new_name: &str,
439 stores: &Stores<'_, impl OrgRepository, impl MembershipRepository, impl RepoRepository>,
440 storage: &impl GitStorage,
441) -> Result<Repository> {
442 let existing = changeable_repo(actor, handle, name, stores).await?;
443
444 // Nothing moves while an import is landing: the directory `git clone --mirror` is
445 // writing into is the one this would rename, and git holds a path, not a row. An
446 // *archived* repository renames freely — see [`RepoWrite`].
447 existing.refuse_writes(RepoWrite::Settings)?;
448
449 // Rebuilt through `new` rather than assigning a `RepoName`, so the reserved list and
450 // the traversal rules are applied to the new name exactly as they were to the old.
451 // Validated before anything moves, so a bad name leaves the repository untouched.
452 let mut renamed = Repository::new(
453 existing.id.clone(),
454 existing.org_id.clone(),
455 new_name,
456 existing.description.clone(),
457 existing.visibility,
458 // `updated_at` means "code last landed here". A rename is not a push.
459 existing.updated_at,
460 )?;
461 renamed.pinned = existing.pinned;
462 renamed.archived = existing.archived;
463 // Nothing can be renamed *during* an import — the guard above refuses it — but a
464 // repository that was imported keeps saying so afterwards, and `new()` would drop
465 // that: where a repository came from is not a fact a rename changes.
466 let renamed = renamed.with_import(
467 existing.import_state,
468 existing.import_source.clone(),
469 existing.import_error.clone(),
470 );
471
472 if renamed.name == existing.name {
473 return Ok(existing);
474 }
475
476 if stores
477 .repos
478 .find_by_org_and_name(&existing.org_id, &renamed.name)
479 .await?
480 .is_some()
481 {
482 return Err(taken());
483 }
484
485 storage
486 .rename(handle, &existing.name, &renamed.name)
487 .await
488 .map_err(|error| match error {
489 // Something is already at the destination with no record to match — an
490 // orphan, exactly as in `create_repo`. The name is genuinely unavailable.
491 GitStorageError::AlreadyExists => taken(),
492 other => Error::GitStorage(other),
493 })?;
494
495 if let Err(error) = stores.repos.save(&renamed).await {
496 // Compensation. Safe because the move above proved the destination was empty,
497 // and the source is the path this repository's own row still names.
498 let _ = storage.rename(handle, &renamed.name, &existing.name).await;
499 return Err(error.into());
500 }
501
502 Ok(renamed)
503}
504
505/// Points the repository's `HEAD` at a different branch.
506///
507/// Owner only. **Nothing is stored in the database**: git already holds the answer, and
508/// every read of it goes through [`GitQuery::default_branch`], so a column would be a
509/// second answer that can drift from the first — see
510/// [`GitStorage::set_default_branch`].
511///
512/// The branch has to exist, and is checked against the repository's own branch list
513/// rather than trusted: `symbolic-ref` will happily point `HEAD` at a branch that is
514/// not there, which is precisely the state an empty repository is in, and doing it to a
515/// repository with commits makes every page say "nothing pushed yet".
516///
517/// **One `git` process to check, one to write.** An empty repository has no branches to
518/// choose from, so the caller does not offer the control at all.
519pub async fn set_default_branch(
520 actor: &Actor,
521 handle: &OrgName,
522 name: &RepoName,
523 branch: &str,
524 stores: &Stores<'_, impl OrgRepository, impl MembershipRepository, impl RepoRepository>,
525 queries: &impl GitQuery,
526 storage: &impl GitStorage,
527) -> Result<RefName> {
528 let repo = changeable_repo(actor, handle, name, stores).await?;
529
530 // Validated before it reaches git, the same way a revision from a URL is: this
531 // value ends up as an argument to the binary.
532 let branch = RefName::new(branch)?;
533
534 let exists = queries
535 .branches(handle, &repo.name)
536 .await?
537 .iter()
538 .any(|row| row.name == branch);
539
540 if !exists {
541 return Err(DomainError::NotFound { entity: "branch" }.into());
542 }
543
544 storage
545 .set_default_branch(handle, &repo.name, &branch)
546 .await?;
547
548 Ok(branch)
549}
550
551/// Archives or unarchives a repository.
552///
553/// Owner only. An archived repository is **finished, not hidden**: everything that
554/// reads keeps working — browsing, cloning, search, archive download — and only writing
555/// stops. The refusal itself lives in [`serve_git`](super::git::serve_git), beside the
556/// `Role::Owner` check, so it applies to every transport rather than to one handler.
557///
558/// Separate from [`update_repo`] rather than a field on [`RepoEdit`], because it is a
559/// state change with its own consequence and its own control: bundling it into the
560/// description form would let a mistyped save silently reopen a repository for writing.
561///
562/// Idempotent. Archiving an archived repository is what a double-clicked button does.
563///
564/// **Refused while an import is landing**, in either direction — see
565/// [`Repository::refuse_writes`]. Declaring a repository finished before its contents
566/// have arrived says something untrue about it, and the state it would be left in is one
567/// no page renders.
568pub async fn set_repo_archived(
569 actor: &Actor,
570 handle: &OrgName,
571 name: &RepoName,
572 archived: bool,
573 stores: &Stores<'_, impl OrgRepository, impl MembershipRepository, impl RepoRepository>,
574) -> Result<Repository> {
575 let existing = changeable_repo(actor, handle, name, stores).await?;
576
577 // Not while an import is landing, in either direction: "finished" is not a thing to
578 // say about a repository whose contents have not arrived, and the panel the owner is
579 // looking at offers Delete for exactly this case.
580 existing.refuse_writes(RepoWrite::Settings)?;
581
582 // `updated_at` is untouched: archiving is not code landing, and a listing ordered
583 // by recency must not float a finished repository to the top on the day it is
584 // declared finished.
585 let updated = Repository {
586 archived,
587 ..existing
588 };
589
590 stores.repos.save(&updated).await?;
591
592 Ok(updated)
593}
594
595/// Deletes a repository: its record, and the bare repo on disk.
596///
597/// Owner only, and irreversible — the git history goes with it.
598///
599/// **The row goes first, then the directory.** The two writes cannot share a
600/// transaction, so one of the two orphans is possible, and this picks the less harmful
601/// one deliberately. An orphaned *directory* only blocks reusing that name, and is
602/// already the documented failure mode of [`create_repo`]'s compensation path. An
603/// orphaned *row* is worse and visible: a repository that still lists on the profile and
604/// 404s the moment anyone clicks it.
605///
606/// If the directory cannot be removed this still reports success, because as far as
607/// Steid is concerned the repository genuinely is gone — there is nothing the caller
608/// could usefully do about it, and failing here would leave the visitor thinking the
609/// delete had not happened when the record is already destroyed. The failure is logged.
610pub async fn delete_repo(
611 actor: &Actor,
612 handle: &OrgName,
613 name: &RepoName,
614 stores: &Stores<'_, impl OrgRepository, impl MembershipRepository, impl RepoRepository>,
615 storage: &impl GitStorage,
616) -> Result<()> {
617 let repo = changeable_repo(actor, handle, name, stores).await?;
618
619 stores.repos.delete(&repo.id).await?;
620
621 if let Err(error) = storage.remove(handle, &repo.name).await {
622 eprintln!(
623 "steid: repository {handle}/{} deleted, but its directory could not be removed: {error}",
624 repo.name
625 );
626 }
627
628 Ok(())
629}
630
631fn taken() -> Error {
632 DomainError::AlreadyExists {
633 entity: "repository",
634 }
635 .into()
636}
637
638#[cfg(test)]
639#[path = "repo_tests.rs"]
640mod tests;