]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/transitive_dependencies.mdwn
add bug about transitive dependencies
[ikiwiki.git] / doc / bugs / transitive_dependencies.mdwn
1 If a sidebar contains a map, or inline (etc), one would expect a
2 change/add/remove of any of the mapped/inlined pages to cause a full wiki
3 rebuild. But this does not happen.
4
5 If page A inlines page B, which inlines page C, a change to C will cause B
6 to be updated, but A will not "notice" that this means A needs to be
7 updated.
8
9 One way to look at this bug is that it's a bug in where dependencies are
10 recorded when preprocessing the rendered or sidebar page. The current code
11 does:
12
13         add_depends($params{page}, $somepage);
14
15 Where `$params{page}` is page B. If this is changed to `$params{destpage}`,
16 then the dependency is added to page A, and updates to C cause it to
17 change. This does result in the page A's getting lots more dependency info
18 recorded than before (essentially a copy of all the B's dependency info).
19
20 It's also a fragile, since all plugins that handle dependencies have to be
21 changed, and do this going forward. And it seems non-obvious that this should
22 be done. Or really, whether to use `page` or `destpage` there. Currently,
23 making the "wrong" choice and using `destpage` instead of `page` (which nearly
24 everything uses) will just result in semi-redundant dependency info being
25 recorded. If we make destpage mandatory to fix this, goofing up will lead to
26 this bug coming back. Ugh.
27
28 Another approach to fix it could be to say that anything that causes a
29 rebuild of B is treated as a change of B. Then when C is changed, B is
30 rebuilt due to dependencies, and in turn this means A is rebuild because B
31 "changed". 
32
33 This is essentially what is done with wikilinks now, and why, if a sidebar
34 links to page C, add/remove of C causes all pages to be rebuilt, as seen 
35 here:
36
37         removing old page meep
38         building sidebar.mdwn, which links to meep
39         building TourBusStop.mdwn, which depends on sidebar
40         building contact.mdwn, which depends on sidebar
41         ...
42
43 The only downside I can see with this approach is that it involves more work.
44 Does the dep resolver have to keep looping until no new pages are rebuilt?
45 Seems worth a try to implement this approach.
46
47 --[[Joey]]